Questions regarding Bounded
Sven Panne
svenpanne at gmail.com
Thu May 7 17:45:09 UTC 2020
Am Mi., 6. Mai 2020 um 21:13 Uhr schrieb David Feuer <david.feuer at gmail.com
>:
> The Bounded class is broken because it combines two distinct concepts:
> BoundedAbove and BoundedBelow.
Indeed, having that distinction would be useful. Just to add some
bikeshedding regarding the names:
* HasInfimum / HasSupremum or
* HasInitialObject / HasTerminalObject or shorter
* HasInitial / HasTerminal (maybe a bit too short)
I wouldn't be too surprised if Edward K. already has something like this on
Hackage. :-)
> If Maybe is to have instances similar
> to what it has now, they should surely look like
>
> instance BoundedBelow (Maybe a) where
> minBound = Nothing
> instance BoundedAbove a => BoundedAbove (Maybe a) where
> maxBound = Just maxBound
>
Well, choosing Nothing to be the infimum is rather arbitrary, you could as
well define:
instance BoundedBelow a => BoundedBelow (Maybe a) where
minBound = Just minBound
instance BoundedAbove (Maybe a) where
maxBound = Nothing
But the previous definition is probably a better fit given the Ord
instance, nevertheless. the choice *is* arbitrary. Perhaps Maybe should not
be an instance of either class?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200507/0e4858cd/attachment.html>
More information about the Libraries
mailing list