[Haskell-cafe] Re: Curiose types

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Sun May 27 06:33:17 EDT 2007


POST
X-Face: H#SM:U1U-/6#NN83s6?Die557~]Dfifz~-|V:wSKGL6T-|!qk{U4/M7+k5Py!-{q=2Q/%0@
        E29yc_kQC&^
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Andrew Coppin <andrewcoppin at btinternet.com> writes:

> As I lay in bed last night, a curios fact occurred to
> me. (Yes, I don't get out very much...)

You probably ought to get out of bed from time to time, you
know.

> Consider the map function:
> 
>   map :: (a -> b) -> [a] -> [b]
> 
> There are two ways you can think about this function. First,
> you can see it as meaning
> 
>   map :: (a -> b) -> ([a] -> [b])
> 
> Which is beautifully symmetric. Alternatively, you can think
> about how you actually use it:
> 
>   map :: ((a -> b) -> [a]) -> [b]

No, if you think like that, you're wrong! That would be a
function that takes an object of type ((a->b) -> [a]) and
returns a [b] (which if you think about it, would be an odd
sort of function). (->) associates to the right.



-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list