<p dir="ltr">I'm generally of the opinion that if things can be unified under the hood, it makes for fewer edge cases and easier testing.</p>
<p dir="ltr">It also seems to me that I describe Maybe and Either () in the same way, if I were to explain verbally: "it's either nothing, or it's something".</p>
<p dir="ltr">Aside from the point made about typeclass instances, I don't see an issue with:</p>
<p dir="ltr">type Maybe = Either ()</p>
<p dir="ltr">nothing :: Maybe a<br>
nothing = Left ()</p>
<p dir="ltr">just :: a -> Maybe a<br>
just = Right</p>
<div class="gmail_quote">On Jan 9, 2014 12:02 PM, "Niklas Larsson" <<a href="mailto:metaniklas@gmail.com">metaniklas@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>
<div>
<div style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif">Maybe doesn't have to be used for error reporting. Optional values is a very big use case for it.</div></div>
<div dir="ltr">
<hr>
<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Från: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif"><a href="mailto:vlatko.basic@gmail.com" target="_blank">Vlatko Basic</a></span><br>
<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Skickat: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif">2014-01-09 16:37</span><br><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Till: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif"><a href="mailto:haskell-cafe@haskell.org" target="_blank">haskell-cafe@haskell.org</a></span><br>
<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Ämne: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif">Re: [Haskell-cafe] Why Maybe exists if there is Either?</span><br><br></div>
Hi Daniel,<br><br>> If you just want to signalize a fail case without any additional<br>> information, then a Maybe fits better than an Either, because<br>> why should you need this bogus empty string?<br><br>Now it looks to me that it might be better and more consistent to write an empty <br>
bogus string (as with: nothing = Left "") than to have two distinct ways of <br>error reporting, and both are used widely and often should be intermixed.<br>And at the end, call site could decide does it want to use the string or not.<br>
<br><br>vlatko<br><br><br>-------- Original Message  --------<br>Subject: Re: [Haskell-cafe] Why Maybe exists if there is Either?<br>From: Daniel Trstenjak <<a href="mailto:daniel.trstenjak@gmail.com" target="_blank">daniel.trstenjak@gmail.com</a>><br>
To: <a href="mailto:haskell-cafe@haskell.org" target="_blank">haskell-cafe@haskell.org</a><br>Date: 09.01.2014 16:13<br><br>><br>> Hi Vlatko,<br>><br>> On Thu, Jan 09, 2014 at 03:50:16PM +0100, Vlatko Basic wrote:<br>
>> I'm curious to find out what was the reasoning to make Maybe?<br>>> What is the added value with introducing it?<br>>> In which situations the above substitution does not hold?<br>><br>> If you just want to signalize a fail case without any additional<br>
> information, then a Maybe fits better than an Either, because<br>> why should you need this bogus empty string?<br>><br>> How should you know that the string doesn't contain something relevant?<br>><br>
><br>> Greetings,<br>> Daniel<br>> _______________________________________________<br>> Haskell-Cafe mailing list<br>> <a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>><br>_______________________________________________<br>Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div>