Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data Top a
- topToMaybe :: Top a -> Maybe a
- pattern ValT :: a -> Top a
- pattern Top :: Top a
- _ValT :: Prism (Top a) (Top b) a b
- _Top :: Prism' (Top a) ()
- _TopMaybe :: Iso' (Top a) (Maybe a)
- data Bottom a
- bottomToMaybe :: Bottom a -> Maybe a
- pattern Bottom :: Bottom a
- pattern ValB :: a -> Bottom a
- _ValB :: Prism (Bottom a) (Bottom b) a b
- _Bottom :: Prism' (Bottom a) ()
- _BottomMaybe :: Iso' (Bottom a) (Maybe a)
- data UnBounded a
- = MinInfinity
- | Val {
- _unUnBounded :: a
- | MaxInfinity
- unUnBounded :: forall a a. Traversal (UnBounded a) (UnBounded a) a a
- _MinInfinity :: forall a. Prism' (UnBounded a) ()
- _Val :: forall a a. Prism (UnBounded a) (UnBounded a) a a
- _MaxInfinity :: forall a. Prism' (UnBounded a) ()
- 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
Monad Top Source # | |
Functor Top Source # | |
Applicative Top Source # | |
Foldable Top Source # | |
Defined in Data.UnBounded fold :: Monoid m => Top m -> 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 # | |
Eq1 Top Source # | |
Ord1 Top Source # | |
Defined in Data.UnBounded | |
Eq a => Eq (Top a) Source # | |
Ord a => Ord (Top a) Source # | |
Show a => Show (Top a) Source # | |
topToMaybe :: Top a -> Maybe a Source #
_TopMaybe :: Iso' (Top a) (Maybe a) Source #
Iso between a 'Top a' and a 'Maybe a', interpreting a Top as a Nothing and vice versa. Note that this reverses the ordering of the elements.
>>>
ValT 5 ^. _TopMaybe
Just 5>>>
Just 5 ^.re _TopMaybe
ValT 5>>>
Top ^. _TopMaybe
Nothing>>>
Nothing ^.re _TopMaybe
Top
`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
Monad Bottom Source # | |
Functor Bottom Source # | |
Applicative Bottom Source # | |
Foldable Bottom Source # | |
Defined in Data.UnBounded fold :: Monoid m => Bottom m -> 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 # | |
Eq1 Bottom Source # | |
Ord1 Bottom Source # | |
Defined in Data.UnBounded | |
Eq a => Eq (Bottom a) Source # | |
Ord a => Ord (Bottom a) Source # | |
Defined in Data.UnBounded | |
Show a => Show (Bottom a) Source # | |
bottomToMaybe :: Bottom a -> Maybe a Source #
_BottomMaybe :: Iso' (Bottom a) (Maybe 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
_MinInfinity :: forall a. Prism' (UnBounded a) () Source #
_MaxInfinity :: forall a. Prism' (UnBounded a) () Source #
unBoundedToMaybe :: UnBounded a -> Maybe a Source #
Test if an Unbounded is actually bounded.
>>>
unBoundedToMaybe (Val 5)
Just 5>>>
unBoundedToMaybe MinInfinity
Nothing>>>
unBoundedToMaybe MaxInfinity
Nothing