[Haskell-beginners] problem with type
miroslav.karpis at gmail.com
Sun Jun 17 20:53:35 CEST 2012
On 6/17/12 9:08 AM, Morel Pisum wrote:
> What you want is probably
> checkNode :: String -> [String] -> Bool
> checkNode s nodes = and (map (==s) nodes)
> which returns True iff all nodes equal s.
>> Am a bit stuck here,... please, what is wrong with this?
>> checkNode :: String -> [String] -> Bool
>> checkNode s nodes =
>> [s == node | node<- nodes ]
>> Couldn't match expected type `Bool' with actual type `[t0]'
>> [1 of 1] Compiling Main ( src/me.hs, interpreted )
>> In the expression: [s == node | node<- nodes]
>> Failed, modules loaded: none.
>> In an equation for `checkNode':
>> checkNode s nodes = [s == node | node<- nodes]
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners