Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | GHC2021 |
Synopsis
- data Top a where
- topToMaybe :: Top a -> Maybe a
- _ValT :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Top a) (f (Top b))
- _Top :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Top a) (f (Top a))
- _TopMaybe :: forall a p f. (Profunctor p, Functor f) => p (Maybe a) (f (Maybe a)) -> p (Top a) (f (Top a))
- data Bottom a where
- bottomToMaybe :: Bottom a -> Maybe a
- _ValB :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Bottom a) (f (Bottom b))
- _Bottom :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Bottom a) (f (Bottom a))
- _BottomMaybe :: forall a p f. (Profunctor p, Functor f) => p (Maybe a) (f (Maybe a)) -> p (Bottom a) (f (Bottom a))
- data UnBounded a
- = MinInfinity
- | Val {
- _unUnBounded :: a
- | MaxInfinity
- _Val :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (UnBounded a) (f (UnBounded b))
- unBoundedToMaybe :: UnBounded a -> Maybe a
Documentation
Top a
represents the type a, together with a Top
element, i.e. an element
that is greater than any other element. We can think of `Top a` being defined as:
>>>
data Top a = ValT a | Top
Instances
Eq1 Top Source # | |
Ord1 Top Source # | |
Defined in HGeometry.Unbounded | |
Applicative Top Source # | |
Functor Top Source # | |
Monad Top Source # | |
Foldable Top Source # | |
Defined in HGeometry.Unbounded fold :: Monoid m => Top m -> m # foldMap :: Monoid m => (a -> m) -> Top a -> m # foldMap' :: Monoid m => (a -> m) -> Top a -> m # foldr :: (a -> b -> b) -> b -> Top a -> b # foldr' :: (a -> b -> b) -> b -> Top a -> b # foldl :: (b -> a -> b) -> b -> Top a -> b # foldl' :: (b -> a -> b) -> b -> Top a -> b # foldr1 :: (a -> a -> a) -> Top a -> a # foldl1 :: (a -> a -> a) -> Top a -> a # elem :: Eq a => a -> Top a -> Bool # maximum :: Ord a => Top a -> a # | |
Traversable Top Source # | |
Semigroup a => Monoid (Top a) Source # | |
Semigroup a => Semigroup (Top a) Source # | |
Show a => Show (Top a) Source # | |
Eq a => Eq (Top a) Source # | |
Ord a => Ord (Top a) Source # | |
topToMaybe :: Top a -> Maybe a Source #
Top a
values are isomorphing to Maybe a
values.
_ValT :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Top a) (f (Top b)) Source #
ValT
prism. Can be used to access the non-bottom element if it exists:
>>>
ValT True & _ValT %~ not
ValT False
>>>
Top & _ValT %~ not
Top
_Top :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Top a) (f (Top a)) Source #
Top
prism.
_TopMaybe :: forall a p f. (Profunctor p, Functor f) => p (Maybe a) (f (Maybe a)) -> p (Top a) (f (Top a)) Source #
`Bottom a`
represents the type a, together with a Bottom
element,
i.e. an element that is smaller than any other element. We can think of
`Bottom a`
being defined as:
>>>
data Bottom a = Bottom | ValB a
Instances
Eq1 Bottom Source # | |
Ord1 Bottom Source # | |
Defined in HGeometry.Unbounded | |
Applicative Bottom Source # | |
Functor Bottom Source # | |
Monad Bottom Source # | |
Foldable Bottom Source # | |
Defined in HGeometry.Unbounded fold :: Monoid m => Bottom m -> m # foldMap :: Monoid m => (a -> m) -> Bottom a -> m # foldMap' :: Monoid m => (a -> m) -> Bottom a -> m # foldr :: (a -> b -> b) -> b -> Bottom a -> b # foldr' :: (a -> b -> b) -> b -> Bottom a -> b # foldl :: (b -> a -> b) -> b -> Bottom a -> b # foldl' :: (b -> a -> b) -> b -> Bottom a -> b # foldr1 :: (a -> a -> a) -> Bottom a -> a # foldl1 :: (a -> a -> a) -> Bottom a -> a # elem :: Eq a => a -> Bottom a -> Bool # maximum :: Ord a => Bottom a -> a # minimum :: Ord a => Bottom a -> a # | |
Traversable Bottom Source # | |
Semigroup a => Monoid (Bottom a) Source # | |
Semigroup a => Semigroup (Bottom a) Source # | |
Show a => Show (Bottom a) Source # | |
Eq a => Eq (Bottom a) Source # | |
Ord a => Ord (Bottom a) Source # | |
Defined in HGeometry.Unbounded |
bottomToMaybe :: Bottom a -> Maybe a Source #
`Bottom a` values are isomorphing to `Maybe a` values.
_ValB :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Bottom a) (f (Bottom b)) Source #
ValB
prism. Can be used to access the non-bottom element if it exists:
>>>
ValB True & _ValB %~ not
ValB False
>>>
Bottom & _ValB %~ not
Bottom
_Bottom :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Bottom a) (f (Bottom a)) Source #
Bottom
prism.
_BottomMaybe :: forall a p f. (Profunctor p, Functor f) => p (Maybe a) (f (Maybe a)) -> p (Bottom a) (f (Bottom a)) Source #
Iso between a 'Bottom a' and a 'Maybe a', interpreting a Bottom as a Nothing and vice versa.
>>>
ValB 5 ^. _BottomMaybe
Just 5>>>
Just 5 ^.re _BottomMaybe
ValB 5>>>
Bottom ^. _BottomMaybe
Nothing>>>
Nothing ^.re _BottomMaybe
Bottom
`UnBounded a` represents the type a, together with an element
MaxInfinity
larger than any other element, and an element MinInfinity
,
smaller than any other element.
Instances
_Val :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (UnBounded a) (f (UnBounded b)) Source #
Prism to access unbounded value if it exists.
>>>
Val True ^? _Val
Just True
>>>
MinInfinity ^? _Val :: Maybe Bool
Nothing
>>>
Val True & _Val %~ not
Val False
>>>
MaxInfinity & _Val %~ not
MaxInfinity
unBoundedToMaybe :: UnBounded a -> Maybe a Source #
Test if an Unbounded is actually bounded.
>>>
unBoundedToMaybe (Val 5)
Just 5>>>
unBoundedToMaybe MinInfinity
Nothing>>>
unBoundedToMaybe MaxInfinity
Nothing