Questions regarding Bounded

Simon Jakobi simon.jakobi at googlemail.com
Mon May 4 11:54:58 UTC 2020


Hi!

I was surprised not to find any documentation regarding interactions of Ord
and Bounded. Are there any instances where

minBound <= x == True

and

maxBound >= x == True

don't hold for every x?


Possibly relatedly, I was looking for Bounded instances for Maybe and
Either. To me the following instances seem sensible:

instance Bounded a => Bounded (Maybe a) where
   minBound = Nothing
   maxBound = Just maxBound

instance (Bounded a, Bounded b) => Bounded (Either a b) where
  minBound = Left minBound
  maxBound = Right maxBound

Are these instances omitted for a reason? Interestingly, both types do have
corresponding Ord instances.


Lastly, I noticed that Natural has a lower bound (0) but not an upper one,
and therefore cannot have a Bounded instance. Is anyone aware of some prior
art regarding a LowerBounded class or similar?

Cheers,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200504/391a557b/attachment.html>


More information about the Libraries mailing list