Re: HasCallStack constraint for maximum in Prelude?

Tom Ellis <[email protected]> Wed, 25 Mar 2026 14:47:35 +0000
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <acP1h7F--QidJl_Y@cloudinit-builder>
On Wed, Mar 25, 2026 at 11:56:21PM +1100, Viktor Dukhovni wrote:
> On Wed, Mar 25, 2026 at 10:23:37AM +0000, Tom Ellis wrote:
> 
> > On Wed, Mar 25, 2026 at 11:19:20AM +0100, Olaf Klinke via Haskell-Cafe wrote:
> > > For (Bounded a, Ord a) one should replace maximum by an ordinary fold,
> > > given a suitable newtype wrapper with a Monoid instance, e.g. 
> > > 
> > > (Ord a, Bounded a) => Monoid (Data.Semigroup.Max a)
> > 
> > For a Semigroup surely it doesn't need Bounded?  (A Monoid would
> > need Bounded).
> 
> What Olaf seems to have in mind does neet a Monoid, for example:

Yes, I misunderstood the type `Data.Semigroup.Max` (which just happens
to live in `Data.Semigroup`) for the `Semigroup` class. I missed that
the class is actually `Monoid`.

Tom
_______________________________________________
Haskell-Cafe mailing list -- [email protected]
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.