<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div style>+1 for something like this. I've written these at least once, and encountered them on a few more occasions.</div><div style><br></div><div style>
I would prefer specific types as Roman suggests, I think. I prefer to match on Plus/MinusInfinity rather than going via Maybe.</div><div style><br></div><div style>John L.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Roman Cheplyaka <<a href="mailto:roma@ro-che.info">roma@ro-che.info</a>><br>
Subject: Re: Maximum and Minimum monoids </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To: Gabriel Gonzalez <<a href="mailto:gabriel439@gmail.com">gabriel439@gmail.com</a>><br>
Cc: <a href="mailto:libraries@haskell.org">libraries@haskell.org</a><br>
Message-ID: <20121227202510.GA24842@sniper><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
Wouldn't it be better to have a real algebraic type instead of wrapping<br>
Maybe?<br>
<br>
Something like<br>
<br>
data Maximum a = MinusInfinity | Maximum a<br>
data Minimum a = PlusInfinity | Minimum a<br>
<br>
Maximum x is more concise than Maximum (Just x), and MinusInfinity is<br>
more descriptive than Maximum Nothing. getMaximum/getMinimum functions<br>
can still return Maybes.<br>
<br>
Anyway, I'm +1 to having something along these lines.<br>
<br>
Roman<br></blockquote></div></div></div>