Ich bin mir nicht sicher, warum der folgende Code den folgenden Fehler verursacht.Haskell-Typ Fehler beim Kompilieren
Code:
type Symbol = Char
symbols :: [Symbol]
symbols = ['a'..'f']
type Code = [Symbol]
members :: Code -> Bool
members xs = and [ b | x <- xs, b <- map (elem x) symbols ]
Compilation Fehler:
Couldn't match type ‘Char’ with ‘t0 Symbol’
Expected type: [t0 Symbol]
Actual type: [Symbol]
• In the second argument of ‘map’, namely ‘symbols’
In the expression: map (elem x) symbols
In a stmt of a list comprehension: b <- map (elem x) symbols
Ihr Code ist unvollständig - was ist 'xs'? –
@FrankSchmitt Sorry, das war ein Tippfehler, bearbeitet –