lambda notation vs function-argument notation in GHCi

Let's define a function in GHCi:
Prelude> let f s n = and (map (==s) n) Prelude> :t f f :: Eq a => a -> [a] -> Bool
This is fine. But when I define this function using lambda notation, I get this
Prelude> let f = \s n -> and (map (==s) n) Prelude> :t f f :: () -> [()] -> Bool
which is really weird. Why does this happen?

http://www.haskell.org/haskellwiki/Monomorphism_restriction
On 17 June 2012 08:13, Morel Pisum
Let's define a function in GHCi:
Prelude> let f s n = and (map (==s) n) Prelude> :t f f :: Eq a => a -> [a] -> Bool
This is fine. But when I define this function using lambda notation, I get this
Prelude> let f = \s n -> and (map (==s) n) Prelude> :t f f :: () -> [()] -> Bool
which is really weird.
Why does this happen?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Ozgur Akgun

Aaaaah, of course! I didn't think I will ever stumble upon this… Thank you!
http://www.haskell.org/haskellwiki/Monomorphism_restriction
On 17 June 2012 08:13, Morel Pisum
wrote: Let's define a function in GHCi:
Prelude> let f s n = and (map (==s) n) Prelude> :t f f :: Eq a => a -> [a] -> Bool This is fine. But when I define this function using lambda notation, I get this
Prelude> let f = \s n -> and (map (==s) n) Prelude> :t f f :: () -> [()] -> Bool which is really weird.
Why does this happen?
participants (2)
-
Morel Pisum
-
Ozgur Akgun