[Haskell-cafe] Newbie Question on type constructors
Ben Rudiak-Gould
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Mon Nov 1 14:32:51 EST 2004
Finn Wilcox wrote:
>On Mon, 1 Nov 2004, Ben Rudiak-Gould wrote:
>
>>In particular, one cannot write an invert :: (a->b) -> Maybe
>>(b->a) which never returns a wrong answer, except for invert = const
>>Nothing
>
>How about:
>
>invert = undefined
>
>This never returns an answer at all, so it can't return a wrong one!
Sorry, I should have been clearer: my Nothing return was intended to
mean "I don't know an answer", not "there is no answer". So my const
Nothing is like your undefined, a function which never returns an answer
(and thus never returns a wrong one).
-- Ben
More information about the Haskell-Cafe
mailing list