I encountered exactly this issue in my use of the Max &amp; Min monoids in Reactive.  I wanted to allow already-bounded types to use their own minBound for Max and maxBound for Min, and also allow unbounded types to be used.  So, rather than entangling bound addition with Max &amp; Min, I defined AddBounds type wrapper, which is *orthogonal* to Max &amp; Min.  If your type is already Bounded, then use my simple Max &amp; Min wrappers directly.  If not (as in Reactive&#39;s use), compose Max or Min with AddBounds.<br>

<br>I&#39;m sorry I didn&#39;t think to mention this useful composition the Max &amp; Min trac ticket.<br><br>   - Conal<br><br><div class="gmail_quote">On Thu, Sep 23, 2010 at 10:47 AM, Gregory Collins <span dir="ltr">&lt;<a href="mailto:greg@gregorycollins.net">greg@gregorycollins.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Felipe Lessa &lt;<a href="mailto:felipe.lessa@gmail.com">felipe.lessa@gmail.com</a>&gt; writes:<br>


&gt; On Thu, Sep 23, 2010 at 12:58 PM, Jake McArthur &lt;<a href="mailto:jake.mcarthur@gmail.com">jake.mcarthur@gmail.com</a>&gt; wrote:<br>
&gt;<br>
</div><div class="im">&gt;&gt;&gt;    -- | Ordered monoid under &#39;max&#39;.<br>
&gt;&gt;&gt;    newtype Max a = Max { getMax :: a }<br>
&gt;&gt;&gt;            deriving (Eq, Ord, Read, Show, Bounded)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    instance (Ord a, Bounded a) =&gt; Monoid (Max a) where<br>
&gt;&gt;&gt;            mempty = Max minBound<br>
&gt;&gt;&gt;            Max a `mappend` Max b = Max (a `max` b)<br>
&gt;<br>
&gt; Why should we prefer this monoid over<br>
&gt;<br>
&gt;&gt; data Max a = Minimum | Max a<br>
&gt;&gt;              deriving (Eq, Ord, Read, Show)<br>
&gt;&gt;<br>
&gt;&gt; instance Ord a =&gt; Monoid (Max a) where<br>
&gt;&gt;   mempty = Minimum<br>
&gt;&gt;   Minimum `mappend` x   = x<br>
&gt;&gt;   x `mappend` Minimum   = x<br>
&gt;&gt;   Max a `mappend` Max b = Max (a `max` b)<br>
<br>
</div>You&#39;re right, the original wouldn&#39;t fly because there are unbounded<br>
types (like Integer) that you&#39;d like to be able to use with Max/Min.<br>
<br>
Rather than your proposal I would suggest that Max/Min mirror<br>
the existing First/Last, namely:<br>
<br>
    newtype Max a = Max { getMax :: Maybe a }<br>
<div class="im">      deriving (Eq, Ord, Read, Show)<br>
<br>
    instance (Ord a) =&gt; Monoid (Max a) where<br>
</div>        mempty  = Max Nothing<br>
        mappend = max<br>
<br>
G<br>
<font color="#888888">--<br>
Gregory Collins &lt;<a href="mailto:greg@gregorycollins.net">greg@gregorycollins.net</a>&gt;<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br>