[Haskell-cafe] On to applicative
nowgate at yahoo.com
Fri Aug 27 20:57:24 EDT 2010
A "map" can be a function (applied to a (single) value).
--- On Fri, 8/27/10, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
From: Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com>
Subject: Re: [Haskell-cafe] On to applicative
To: "michael rice" <nowgate at yahoo.com>
Cc: haskell-cafe at haskell.org
Date: Friday, August 27, 2010, 8:46 PM
On 28 August 2010 10:38, michael rice <nowgate at yahoo.com> wrote:
> fmap seems oddly named because no "mapping" takes place, except in the fourth example, where the map is "passed in." Just sayin'.
> Prelude Control.Monad Control.Applicative Data.Char> fmap toUpper getLine
> Couldn't match expected type `Char' against inferred type `[Char]'
> Expected type: IO Char
> Inferred type: IO String
> In the second argument of `fmap', namely `getLine'
> In the expression: fmap toUpper getLine
Right; this is because the fmap only gets the "Char -> Char" function
inside the IO; but since it's "IO String" rather than "IO Char", this
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe