
Why have Bool? Just let true = 1, false = 0, (||) = (+), (&&) = (*).
Why have Ordering? Just use Integer and let lt = -1, eq = 0, gt = 1.
Why have three-tuples (a, b, c)? Just use ((a, b), c).
Why have Data.Map a b? Just use a -> Maybe b. You don't even need an Ord
constraint any more!
Why have Data.Set a? Just use a -> Bool (or, a -> Integer).
For that matter, why use algebraic data types? data Person = Person String
Int is isomorphic to type Person = (String, Int).
On Thu, Jan 9, 2014 at 9:50 AM, Vlatko Basic
Hello Cafe,
With my current knowledge of Haskell, I do not see why is there Maybe if we have Either.
For example, Functor and Monad instances (and many others) of Maybe and Either are the same (except for fail).
In other words, this should hold:
Maybe a = Either String a -- String or something else Nothing = Left "" Just a = Right a
I'm curious to find out what was the reasoning to make Maybe? What is the added value with introducing it? In which situations the above substitution does not hold?
Best regards,
vlatko
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe