[Haskell-beginners] Type classes and synonyms

Daniel Fischer daniel.is.fischer at web.de
Sat Nov 21 16:27:20 EST 2009


Am Samstag 21 November 2009 22:13:49 schrieb John Dorsey:
> Chaddaï Fouché wrote:
> > second :: (b -> c) -> (d, b) -> (d, c)
> > which corresponds exactly to the action of second you described
> > (that's the only function that could have this type, except bottom of
> > course).
>
> Nonsense!  There are several perfectly good Haskell functions with that
> type.  I count seven:
>
> second :: (b -> c) -> (d, b) -> (d, c)
> second = Control.Arrow.second
> second = undefined
> second = const undefined
> second = const (const undefined)
> second = const (const (undefined,undefined))
> second f (d,b) = (undefined, f b)
> second f (d,b) = (d, undefined)

I don't see

second f (d,b) = (undefined, f undefined)
second f (d,b) = (d, f undefined)

in there.

>
> Why I'm stickling on that point on the beginners list, however, is a
> mystery.  I'll go write a more useful response, in contrition.
>
> John




More information about the Beginners mailing list