
9 Jan
2014
9 Jan
'14
2:29 p.m.
Brandon Allbery
On Thu, Jan 9, 2014 at 12:11 PM, Ben Foppa
wrote: Aside from the point made about typeclass instances, I don't see an issue with:
type Maybe = Either ()
nothing :: Maybe a nothing = Left ()
just :: a -> Maybe a just = Right
Not until you try to pattern match on it....
Although with pattern synonyms[1][2] this will become possible if I'm not mistaken, pattern Nothing = Left () pattern Just a = Right a Cheers, - Ben [1] https://ghc.haskell.org/trac/ghc/ticket/5144 [2] https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms