
Am Mi., 6. Mai 2020 um 21:13 Uhr schrieb David Feuer : 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?