{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TemplateHaskell #-}
module Data.UnBounded( Top( ValT, Top), topToMaybe
, _ValT, _Top, _TopMaybe
, Bottom(Bottom, ValB), bottomToMaybe
, _ValB, _Bottom, _BottomMaybe
, UnBounded(..)
, _Val
, unBoundedToMaybe
) where
import Control.Lens
import qualified Data.Foldable as F
import Data.Functor.Classes
import qualified Data.Traversable as T
newtype Top a = GTop (Maybe a)
deriving (Top a -> Top a -> Bool
(Top a -> Top a -> Bool) -> (Top a -> Top a -> Bool) -> Eq (Top a)
forall a. Eq a => Top a -> Top a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Top a -> Top a -> Bool
$c/= :: forall a. Eq a => Top a -> Top a -> Bool
== :: Top a -> Top a -> Bool
$c== :: forall a. Eq a => Top a -> Top a -> Bool
Eq,a -> Top b -> Top a
(a -> b) -> Top a -> Top b
(forall a b. (a -> b) -> Top a -> Top b)
-> (forall a b. a -> Top b -> Top a) -> Functor Top
forall a b. a -> Top b -> Top a
forall a b. (a -> b) -> Top a -> Top b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Top b -> Top a
$c<$ :: forall a b. a -> Top b -> Top a
fmap :: (a -> b) -> Top a -> Top b
$cfmap :: forall a b. (a -> b) -> Top a -> Top b
Functor,a -> Top a -> Bool
Top m -> m
Top a -> [a]
Top a -> Bool
Top a -> Int
Top a -> a
Top a -> a
Top a -> a
Top a -> a
(a -> m) -> Top a -> m
(a -> m) -> Top a -> m
(a -> b -> b) -> b -> Top a -> b
(a -> b -> b) -> b -> Top a -> b
(b -> a -> b) -> b -> Top a -> b
(b -> a -> b) -> b -> Top a -> b
(a -> a -> a) -> Top a -> a
(a -> a -> a) -> Top a -> a
(forall m. Monoid m => Top m -> m)
-> (forall m a. Monoid m => (a -> m) -> Top a -> m)
-> (forall m a. Monoid m => (a -> m) -> Top a -> m)
-> (forall a b. (a -> b -> b) -> b -> Top a -> b)
-> (forall a b. (a -> b -> b) -> b -> Top a -> b)
-> (forall b a. (b -> a -> b) -> b -> Top a -> b)
-> (forall b a. (b -> a -> b) -> b -> Top a -> b)
-> (forall a. (a -> a -> a) -> Top a -> a)
-> (forall a. (a -> a -> a) -> Top a -> a)
-> (forall a. Top a -> [a])
-> (forall a. Top a -> Bool)
-> (forall a. Top a -> Int)
-> (forall a. Eq a => a -> Top a -> Bool)
-> (forall a. Ord a => Top a -> a)
-> (forall a. Ord a => Top a -> a)
-> (forall a. Num a => Top a -> a)
-> (forall a. Num a => Top a -> a)
-> Foldable Top
forall a. Eq a => a -> Top a -> Bool
forall a. Num a => Top a -> a
forall a. Ord a => Top a -> a
forall m. Monoid m => Top m -> m
forall a. Top a -> Bool
forall a. Top a -> Int
forall a. Top a -> [a]
forall a. (a -> a -> a) -> Top a -> a
forall m a. Monoid m => (a -> m) -> Top a -> m
forall b a. (b -> a -> b) -> b -> Top a -> b
forall a b. (a -> b -> b) -> b -> Top a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Top a -> a
$cproduct :: forall a. Num a => Top a -> a
sum :: Top a -> a
$csum :: forall a. Num a => Top a -> a
minimum :: Top a -> a
$cminimum :: forall a. Ord a => Top a -> a
maximum :: Top a -> a
$cmaximum :: forall a. Ord a => Top a -> a
elem :: a -> Top a -> Bool
$celem :: forall a. Eq a => a -> Top a -> Bool
length :: Top a -> Int
$clength :: forall a. Top a -> Int
null :: Top a -> Bool
$cnull :: forall a. Top a -> Bool
toList :: Top a -> [a]
$ctoList :: forall a. Top a -> [a]
foldl1 :: (a -> a -> a) -> Top a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Top a -> a
foldr1 :: (a -> a -> a) -> Top a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Top a -> a
foldl' :: (b -> a -> b) -> b -> Top a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Top a -> b
foldl :: (b -> a -> b) -> b -> Top a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Top a -> b
foldr' :: (a -> b -> b) -> b -> Top a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Top a -> b
foldr :: (a -> b -> b) -> b -> Top a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Top a -> b
foldMap' :: (a -> m) -> Top a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Top a -> m
foldMap :: (a -> m) -> Top a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Top a -> m
fold :: Top m -> m
$cfold :: forall m. Monoid m => Top m -> m
F.Foldable,Functor Top
Foldable Top
Functor Top
-> Foldable Top
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Top a -> f (Top b))
-> (forall (f :: * -> *) a.
Applicative f =>
Top (f a) -> f (Top a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Top a -> m (Top b))
-> (forall (m :: * -> *) a. Monad m => Top (m a) -> m (Top a))
-> Traversable Top
(a -> f b) -> Top a -> f (Top b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Top (m a) -> m (Top a)
forall (f :: * -> *) a. Applicative f => Top (f a) -> f (Top a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Top a -> m (Top b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Top a -> f (Top b)
sequence :: Top (m a) -> m (Top a)
$csequence :: forall (m :: * -> *) a. Monad m => Top (m a) -> m (Top a)
mapM :: (a -> m b) -> Top a -> m (Top b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Top a -> m (Top b)
sequenceA :: Top (f a) -> f (Top a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Top (f a) -> f (Top a)
traverse :: (a -> f b) -> Top a -> f (Top b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Top a -> f (Top b)
$cp2Traversable :: Foldable Top
$cp1Traversable :: Functor Top
T.Traversable,Functor Top
a -> Top a
Functor Top
-> (forall a. a -> Top a)
-> (forall a b. Top (a -> b) -> Top a -> Top b)
-> (forall a b c. (a -> b -> c) -> Top a -> Top b -> Top c)
-> (forall a b. Top a -> Top b -> Top b)
-> (forall a b. Top a -> Top b -> Top a)
-> Applicative Top
Top a -> Top b -> Top b
Top a -> Top b -> Top a
Top (a -> b) -> Top a -> Top b
(a -> b -> c) -> Top a -> Top b -> Top c
forall a. a -> Top a
forall a b. Top a -> Top b -> Top a
forall a b. Top a -> Top b -> Top b
forall a b. Top (a -> b) -> Top a -> Top b
forall a b c. (a -> b -> c) -> Top a -> Top b -> Top c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Top a -> Top b -> Top a
$c<* :: forall a b. Top a -> Top b -> Top a
*> :: Top a -> Top b -> Top b
$c*> :: forall a b. Top a -> Top b -> Top b
liftA2 :: (a -> b -> c) -> Top a -> Top b -> Top c
$cliftA2 :: forall a b c. (a -> b -> c) -> Top a -> Top b -> Top c
<*> :: Top (a -> b) -> Top a -> Top b
$c<*> :: forall a b. Top (a -> b) -> Top a -> Top b
pure :: a -> Top a
$cpure :: forall a. a -> Top a
$cp1Applicative :: Functor Top
Applicative,Applicative Top
a -> Top a
Applicative Top
-> (forall a b. Top a -> (a -> Top b) -> Top b)
-> (forall a b. Top a -> Top b -> Top b)
-> (forall a. a -> Top a)
-> Monad Top
Top a -> (a -> Top b) -> Top b
Top a -> Top b -> Top b
forall a. a -> Top a
forall a b. Top a -> Top b -> Top b
forall a b. Top a -> (a -> Top b) -> Top b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Top a
$creturn :: forall a. a -> Top a
>> :: Top a -> Top b -> Top b
$c>> :: forall a b. Top a -> Top b -> Top b
>>= :: Top a -> (a -> Top b) -> Top b
$c>>= :: forall a b. Top a -> (a -> Top b) -> Top b
$cp1Monad :: Applicative Top
Monad,(a -> b -> Bool) -> Top a -> Top b -> Bool
(forall a b. (a -> b -> Bool) -> Top a -> Top b -> Bool) -> Eq1 Top
forall a b. (a -> b -> Bool) -> Top a -> Top b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
liftEq :: (a -> b -> Bool) -> Top a -> Top b -> Bool
$cliftEq :: forall a b. (a -> b -> Bool) -> Top a -> Top b -> Bool
Eq1)
topToMaybe :: Top a -> Maybe a
topToMaybe :: Top a -> Maybe a
topToMaybe (GTop Maybe a
mb) = Maybe a
mb
pattern ValT :: a -> Top a
pattern $bValT :: a -> Top a
$mValT :: forall r a. Top a -> (a -> r) -> (Void# -> r) -> r
ValT x = GTop (Just x)
pattern Top :: Top a
pattern $bTop :: Top a
$mTop :: forall r a. Top a -> (Void# -> r) -> (Void# -> r) -> r
Top = GTop Nothing
{-# COMPLETE ValT, Top #-}
instance Ord1 Top where
liftCompare :: (a -> b -> Ordering) -> Top a -> Top b -> Ordering
liftCompare a -> b -> Ordering
_ Top a
Top Top b
Top = Ordering
EQ
liftCompare a -> b -> Ordering
_ Top a
_ Top b
Top = Ordering
LT
liftCompare a -> b -> Ordering
_ Top a
Top Top b
_ = Ordering
GT
liftCompare a -> b -> Ordering
cmp ~(ValT a
x) ~(ValT b
y) = a
x a -> b -> Ordering
`cmp` b
y
instance Ord a => Ord (Top a) where
compare :: Top a -> Top a -> Ordering
compare = Top a -> Top a -> Ordering
forall (f :: * -> *) a. (Ord1 f, Ord a) => f a -> f a -> Ordering
compare1
instance Show a => Show (Top a) where
show :: Top a -> String
show Top a
Top = String
"Top"
show ~(ValT a
x) = String
"ValT " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
x
_ValT :: Prism (Top a) (Top b) a b
_ValT :: p a (f b) -> p (Top a) (f (Top b))
_ValT = (b -> Top b)
-> (Top a -> Either (Top b) a) -> Prism (Top a) (Top b) a b
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism b -> Top b
forall a. a -> Top a
ValT (\case Top a
Top -> Top b -> Either (Top b) a
forall a b. a -> Either a b
Left Top b
forall a. Top a
Top ; ValT a
x -> a -> Either (Top b) a
forall a b. b -> Either a b
Right a
x)
_Top :: Prism' (Top a) ()
_Top :: p () (f ()) -> p (Top a) (f (Top a))
_Top = (() -> Top a) -> (Top a -> Maybe ()) -> Prism (Top a) (Top a) () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Top a -> () -> Top a
forall a b. a -> b -> a
const Top a
forall a. Top a
Top) (\case Top a
Top -> () -> Maybe ()
forall a. a -> Maybe a
Just () ; ValT a
_ -> Maybe ()
forall a. Maybe a
Nothing)
_TopMaybe :: Iso' (Top a) (Maybe a)
_TopMaybe :: p (Maybe a) (f (Maybe a)) -> p (Top a) (f (Top a))
_TopMaybe = (Top a -> Maybe a)
-> (Maybe a -> Top a) -> Iso (Top a) (Top a) (Maybe a) (Maybe a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Top a -> Maybe a
forall a. Top a -> Maybe a
topToMaybe Maybe a -> Top a
forall a. Maybe a -> Top a
GTop
newtype Bottom a = GBottom (Maybe a)
deriving (Bottom a -> Bottom a -> Bool
(Bottom a -> Bottom a -> Bool)
-> (Bottom a -> Bottom a -> Bool) -> Eq (Bottom a)
forall a. Eq a => Bottom a -> Bottom a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bottom a -> Bottom a -> Bool
$c/= :: forall a. Eq a => Bottom a -> Bottom a -> Bool
== :: Bottom a -> Bottom a -> Bool
$c== :: forall a. Eq a => Bottom a -> Bottom a -> Bool
Eq,Eq (Bottom a)
Eq (Bottom a)
-> (Bottom a -> Bottom a -> Ordering)
-> (Bottom a -> Bottom a -> Bool)
-> (Bottom a -> Bottom a -> Bool)
-> (Bottom a -> Bottom a -> Bool)
-> (Bottom a -> Bottom a -> Bool)
-> (Bottom a -> Bottom a -> Bottom a)
-> (Bottom a -> Bottom a -> Bottom a)
-> Ord (Bottom a)
Bottom a -> Bottom a -> Bool
Bottom a -> Bottom a -> Ordering
Bottom a -> Bottom a -> Bottom a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (Bottom a)
forall a. Ord a => Bottom a -> Bottom a -> Bool
forall a. Ord a => Bottom a -> Bottom a -> Ordering
forall a. Ord a => Bottom a -> Bottom a -> Bottom a
min :: Bottom a -> Bottom a -> Bottom a
$cmin :: forall a. Ord a => Bottom a -> Bottom a -> Bottom a
max :: Bottom a -> Bottom a -> Bottom a
$cmax :: forall a. Ord a => Bottom a -> Bottom a -> Bottom a
>= :: Bottom a -> Bottom a -> Bool
$c>= :: forall a. Ord a => Bottom a -> Bottom a -> Bool
> :: Bottom a -> Bottom a -> Bool
$c> :: forall a. Ord a => Bottom a -> Bottom a -> Bool
<= :: Bottom a -> Bottom a -> Bool
$c<= :: forall a. Ord a => Bottom a -> Bottom a -> Bool
< :: Bottom a -> Bottom a -> Bool
$c< :: forall a. Ord a => Bottom a -> Bottom a -> Bool
compare :: Bottom a -> Bottom a -> Ordering
$ccompare :: forall a. Ord a => Bottom a -> Bottom a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Bottom a)
Ord,a -> Bottom b -> Bottom a
(a -> b) -> Bottom a -> Bottom b
(forall a b. (a -> b) -> Bottom a -> Bottom b)
-> (forall a b. a -> Bottom b -> Bottom a) -> Functor Bottom
forall a b. a -> Bottom b -> Bottom a
forall a b. (a -> b) -> Bottom a -> Bottom b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Bottom b -> Bottom a
$c<$ :: forall a b. a -> Bottom b -> Bottom a
fmap :: (a -> b) -> Bottom a -> Bottom b
$cfmap :: forall a b. (a -> b) -> Bottom a -> Bottom b
Functor,a -> Bottom a -> Bool
Bottom m -> m
Bottom a -> [a]
Bottom a -> Bool
Bottom a -> Int
Bottom a -> a
Bottom a -> a
Bottom a -> a
Bottom a -> a
(a -> m) -> Bottom a -> m
(a -> m) -> Bottom a -> m
(a -> b -> b) -> b -> Bottom a -> b
(a -> b -> b) -> b -> Bottom a -> b
(b -> a -> b) -> b -> Bottom a -> b
(b -> a -> b) -> b -> Bottom a -> b
(a -> a -> a) -> Bottom a -> a
(a -> a -> a) -> Bottom a -> a
(forall m. Monoid m => Bottom m -> m)
-> (forall m a. Monoid m => (a -> m) -> Bottom a -> m)
-> (forall m a. Monoid m => (a -> m) -> Bottom a -> m)
-> (forall a b. (a -> b -> b) -> b -> Bottom a -> b)
-> (forall a b. (a -> b -> b) -> b -> Bottom a -> b)
-> (forall b a. (b -> a -> b) -> b -> Bottom a -> b)
-> (forall b a. (b -> a -> b) -> b -> Bottom a -> b)
-> (forall a. (a -> a -> a) -> Bottom a -> a)
-> (forall a. (a -> a -> a) -> Bottom a -> a)
-> (forall a. Bottom a -> [a])
-> (forall a. Bottom a -> Bool)
-> (forall a. Bottom a -> Int)
-> (forall a. Eq a => a -> Bottom a -> Bool)
-> (forall a. Ord a => Bottom a -> a)
-> (forall a. Ord a => Bottom a -> a)
-> (forall a. Num a => Bottom a -> a)
-> (forall a. Num a => Bottom a -> a)
-> Foldable Bottom
forall a. Eq a => a -> Bottom a -> Bool
forall a. Num a => Bottom a -> a
forall a. Ord a => Bottom a -> a
forall m. Monoid m => Bottom m -> m
forall a. Bottom a -> Bool
forall a. Bottom a -> Int
forall a. Bottom a -> [a]
forall a. (a -> a -> a) -> Bottom a -> a
forall m a. Monoid m => (a -> m) -> Bottom a -> m
forall b a. (b -> a -> b) -> b -> Bottom a -> b
forall a b. (a -> b -> b) -> b -> Bottom a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Bottom a -> a
$cproduct :: forall a. Num a => Bottom a -> a
sum :: Bottom a -> a
$csum :: forall a. Num a => Bottom a -> a
minimum :: Bottom a -> a
$cminimum :: forall a. Ord a => Bottom a -> a
maximum :: Bottom a -> a
$cmaximum :: forall a. Ord a => Bottom a -> a
elem :: a -> Bottom a -> Bool
$celem :: forall a. Eq a => a -> Bottom a -> Bool
length :: Bottom a -> Int
$clength :: forall a. Bottom a -> Int
null :: Bottom a -> Bool
$cnull :: forall a. Bottom a -> Bool
toList :: Bottom a -> [a]
$ctoList :: forall a. Bottom a -> [a]
foldl1 :: (a -> a -> a) -> Bottom a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Bottom a -> a
foldr1 :: (a -> a -> a) -> Bottom a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Bottom a -> a
foldl' :: (b -> a -> b) -> b -> Bottom a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Bottom a -> b
foldl :: (b -> a -> b) -> b -> Bottom a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Bottom a -> b
foldr' :: (a -> b -> b) -> b -> Bottom a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Bottom a -> b
foldr :: (a -> b -> b) -> b -> Bottom a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Bottom a -> b
foldMap' :: (a -> m) -> Bottom a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Bottom a -> m
foldMap :: (a -> m) -> Bottom a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Bottom a -> m
fold :: Bottom m -> m
$cfold :: forall m. Monoid m => Bottom m -> m
F.Foldable,Functor Bottom
Foldable Bottom
Functor Bottom
-> Foldable Bottom
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bottom a -> f (Bottom b))
-> (forall (f :: * -> *) a.
Applicative f =>
Bottom (f a) -> f (Bottom a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bottom a -> m (Bottom b))
-> (forall (m :: * -> *) a.
Monad m =>
Bottom (m a) -> m (Bottom a))
-> Traversable Bottom
(a -> f b) -> Bottom a -> f (Bottom b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Bottom (m a) -> m (Bottom a)
forall (f :: * -> *) a.
Applicative f =>
Bottom (f a) -> f (Bottom a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bottom a -> m (Bottom b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bottom a -> f (Bottom b)
sequence :: Bottom (m a) -> m (Bottom a)
$csequence :: forall (m :: * -> *) a. Monad m => Bottom (m a) -> m (Bottom a)
mapM :: (a -> m b) -> Bottom a -> m (Bottom b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Bottom a -> m (Bottom b)
sequenceA :: Bottom (f a) -> f (Bottom a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Bottom (f a) -> f (Bottom a)
traverse :: (a -> f b) -> Bottom a -> f (Bottom b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Bottom a -> f (Bottom b)
$cp2Traversable :: Foldable Bottom
$cp1Traversable :: Functor Bottom
T.Traversable,Functor Bottom
a -> Bottom a
Functor Bottom
-> (forall a. a -> Bottom a)
-> (forall a b. Bottom (a -> b) -> Bottom a -> Bottom b)
-> (forall a b c.
(a -> b -> c) -> Bottom a -> Bottom b -> Bottom c)
-> (forall a b. Bottom a -> Bottom b -> Bottom b)
-> (forall a b. Bottom a -> Bottom b -> Bottom a)
-> Applicative Bottom
Bottom a -> Bottom b -> Bottom b
Bottom a -> Bottom b -> Bottom a
Bottom (a -> b) -> Bottom a -> Bottom b
(a -> b -> c) -> Bottom a -> Bottom b -> Bottom c
forall a. a -> Bottom a
forall a b. Bottom a -> Bottom b -> Bottom a
forall a b. Bottom a -> Bottom b -> Bottom b
forall a b. Bottom (a -> b) -> Bottom a -> Bottom b
forall a b c. (a -> b -> c) -> Bottom a -> Bottom b -> Bottom c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Bottom a -> Bottom b -> Bottom a
$c<* :: forall a b. Bottom a -> Bottom b -> Bottom a
*> :: Bottom a -> Bottom b -> Bottom b
$c*> :: forall a b. Bottom a -> Bottom b -> Bottom b
liftA2 :: (a -> b -> c) -> Bottom a -> Bottom b -> Bottom c
$cliftA2 :: forall a b c. (a -> b -> c) -> Bottom a -> Bottom b -> Bottom c
<*> :: Bottom (a -> b) -> Bottom a -> Bottom b
$c<*> :: forall a b. Bottom (a -> b) -> Bottom a -> Bottom b
pure :: a -> Bottom a
$cpure :: forall a. a -> Bottom a
$cp1Applicative :: Functor Bottom
Applicative,Applicative Bottom
a -> Bottom a
Applicative Bottom
-> (forall a b. Bottom a -> (a -> Bottom b) -> Bottom b)
-> (forall a b. Bottom a -> Bottom b -> Bottom b)
-> (forall a. a -> Bottom a)
-> Monad Bottom
Bottom a -> (a -> Bottom b) -> Bottom b
Bottom a -> Bottom b -> Bottom b
forall a. a -> Bottom a
forall a b. Bottom a -> Bottom b -> Bottom b
forall a b. Bottom a -> (a -> Bottom b) -> Bottom b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Bottom a
$creturn :: forall a. a -> Bottom a
>> :: Bottom a -> Bottom b -> Bottom b
$c>> :: forall a b. Bottom a -> Bottom b -> Bottom b
>>= :: Bottom a -> (a -> Bottom b) -> Bottom b
$c>>= :: forall a b. Bottom a -> (a -> Bottom b) -> Bottom b
$cp1Monad :: Applicative Bottom
Monad,(a -> b -> Bool) -> Bottom a -> Bottom b -> Bool
(forall a b. (a -> b -> Bool) -> Bottom a -> Bottom b -> Bool)
-> Eq1 Bottom
forall a b. (a -> b -> Bool) -> Bottom a -> Bottom b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
liftEq :: (a -> b -> Bool) -> Bottom a -> Bottom b -> Bool
$cliftEq :: forall a b. (a -> b -> Bool) -> Bottom a -> Bottom b -> Bool
Eq1,Eq1 Bottom
Eq1 Bottom
-> (forall a b.
(a -> b -> Ordering) -> Bottom a -> Bottom b -> Ordering)
-> Ord1 Bottom
(a -> b -> Ordering) -> Bottom a -> Bottom b -> Ordering
forall a b.
(a -> b -> Ordering) -> Bottom a -> Bottom b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
liftCompare :: (a -> b -> Ordering) -> Bottom a -> Bottom b -> Ordering
$cliftCompare :: forall a b.
(a -> b -> Ordering) -> Bottom a -> Bottom b -> Ordering
$cp1Ord1 :: Eq1 Bottom
Ord1)
bottomToMaybe :: Bottom a -> Maybe a
bottomToMaybe :: Bottom a -> Maybe a
bottomToMaybe (GBottom Maybe a
mb) = Maybe a
mb
pattern Bottom :: Bottom a
pattern $bBottom :: Bottom a
$mBottom :: forall r a. Bottom a -> (Void# -> r) -> (Void# -> r) -> r
Bottom = GBottom Nothing
pattern ValB :: a -> Bottom a
pattern $bValB :: a -> Bottom a
$mValB :: forall r a. Bottom a -> (a -> r) -> (Void# -> r) -> r
ValB x = GBottom (Just x)
{-# COMPLETE Bottom, ValB #-}
instance Show a => Show (Bottom a) where
show :: Bottom a -> String
show Bottom a
Bottom = String
"Bottom"
show ~(ValB a
x) = String
"ValB " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
x
_ValB :: Prism (Bottom a) (Bottom b) a b
_ValB :: p a (f b) -> p (Bottom a) (f (Bottom b))
_ValB = (b -> Bottom b)
-> (Bottom a -> Either (Bottom b) a)
-> Prism (Bottom a) (Bottom b) a b
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism b -> Bottom b
forall a. a -> Bottom a
ValB (\case Bottom a
Bottom -> Bottom b -> Either (Bottom b) a
forall a b. a -> Either a b
Left Bottom b
forall a. Bottom a
Bottom ; ValB a
x -> a -> Either (Bottom b) a
forall a b. b -> Either a b
Right a
x)
_Bottom :: Prism' (Bottom a) ()
_Bottom :: p () (f ()) -> p (Bottom a) (f (Bottom a))
_Bottom = (() -> Bottom a)
-> (Bottom a -> Maybe ()) -> Prism (Bottom a) (Bottom a) () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Bottom a -> () -> Bottom a
forall a b. a -> b -> a
const Bottom a
forall a. Bottom a
Bottom) (\case Bottom a
Bottom -> () -> Maybe ()
forall a. a -> Maybe a
Just () ; ValB a
_ -> Maybe ()
forall a. Maybe a
Nothing)
_BottomMaybe :: Iso' (Bottom a) (Maybe a)
_BottomMaybe :: p (Maybe a) (f (Maybe a)) -> p (Bottom a) (f (Bottom a))
_BottomMaybe = (Bottom a -> Maybe a)
-> (Maybe a -> Bottom a)
-> Iso (Bottom a) (Bottom a) (Maybe a) (Maybe a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Bottom a -> Maybe a
forall a. Bottom a -> Maybe a
bottomToMaybe Maybe a -> Bottom a
forall a. Maybe a -> Bottom a
GBottom
data UnBounded a = MinInfinity | Val { UnBounded a -> a
_unUnBounded :: a } | MaxInfinity
deriving (UnBounded a -> UnBounded a -> Bool
(UnBounded a -> UnBounded a -> Bool)
-> (UnBounded a -> UnBounded a -> Bool) -> Eq (UnBounded a)
forall a. Eq a => UnBounded a -> UnBounded a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnBounded a -> UnBounded a -> Bool
$c/= :: forall a. Eq a => UnBounded a -> UnBounded a -> Bool
== :: UnBounded a -> UnBounded a -> Bool
$c== :: forall a. Eq a => UnBounded a -> UnBounded a -> Bool
Eq,Eq (UnBounded a)
Eq (UnBounded a)
-> (UnBounded a -> UnBounded a -> Ordering)
-> (UnBounded a -> UnBounded a -> Bool)
-> (UnBounded a -> UnBounded a -> Bool)
-> (UnBounded a -> UnBounded a -> Bool)
-> (UnBounded a -> UnBounded a -> Bool)
-> (UnBounded a -> UnBounded a -> UnBounded a)
-> (UnBounded a -> UnBounded a -> UnBounded a)
-> Ord (UnBounded a)
UnBounded a -> UnBounded a -> Bool
UnBounded a -> UnBounded a -> Ordering
UnBounded a -> UnBounded a -> UnBounded a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (UnBounded a)
forall a. Ord a => UnBounded a -> UnBounded a -> Bool
forall a. Ord a => UnBounded a -> UnBounded a -> Ordering
forall a. Ord a => UnBounded a -> UnBounded a -> UnBounded a
min :: UnBounded a -> UnBounded a -> UnBounded a
$cmin :: forall a. Ord a => UnBounded a -> UnBounded a -> UnBounded a
max :: UnBounded a -> UnBounded a -> UnBounded a
$cmax :: forall a. Ord a => UnBounded a -> UnBounded a -> UnBounded a
>= :: UnBounded a -> UnBounded a -> Bool
$c>= :: forall a. Ord a => UnBounded a -> UnBounded a -> Bool
> :: UnBounded a -> UnBounded a -> Bool
$c> :: forall a. Ord a => UnBounded a -> UnBounded a -> Bool
<= :: UnBounded a -> UnBounded a -> Bool
$c<= :: forall a. Ord a => UnBounded a -> UnBounded a -> Bool
< :: UnBounded a -> UnBounded a -> Bool
$c< :: forall a. Ord a => UnBounded a -> UnBounded a -> Bool
compare :: UnBounded a -> UnBounded a -> Ordering
$ccompare :: forall a. Ord a => UnBounded a -> UnBounded a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (UnBounded a)
Ord,a -> UnBounded b -> UnBounded a
(a -> b) -> UnBounded a -> UnBounded b
(forall a b. (a -> b) -> UnBounded a -> UnBounded b)
-> (forall a b. a -> UnBounded b -> UnBounded a)
-> Functor UnBounded
forall a b. a -> UnBounded b -> UnBounded a
forall a b. (a -> b) -> UnBounded a -> UnBounded b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> UnBounded b -> UnBounded a
$c<$ :: forall a b. a -> UnBounded b -> UnBounded a
fmap :: (a -> b) -> UnBounded a -> UnBounded b
$cfmap :: forall a b. (a -> b) -> UnBounded a -> UnBounded b
Functor,UnBounded a -> Bool
(a -> m) -> UnBounded a -> m
(a -> b -> b) -> b -> UnBounded a -> b
(forall m. Monoid m => UnBounded m -> m)
-> (forall m a. Monoid m => (a -> m) -> UnBounded a -> m)
-> (forall m a. Monoid m => (a -> m) -> UnBounded a -> m)
-> (forall a b. (a -> b -> b) -> b -> UnBounded a -> b)
-> (forall a b. (a -> b -> b) -> b -> UnBounded a -> b)
-> (forall b a. (b -> a -> b) -> b -> UnBounded a -> b)
-> (forall b a. (b -> a -> b) -> b -> UnBounded a -> b)
-> (forall a. (a -> a -> a) -> UnBounded a -> a)
-> (forall a. (a -> a -> a) -> UnBounded a -> a)
-> (forall a. UnBounded a -> [a])
-> (forall a. UnBounded a -> Bool)
-> (forall a. UnBounded a -> Int)
-> (forall a. Eq a => a -> UnBounded a -> Bool)
-> (forall a. Ord a => UnBounded a -> a)
-> (forall a. Ord a => UnBounded a -> a)
-> (forall a. Num a => UnBounded a -> a)
-> (forall a. Num a => UnBounded a -> a)
-> Foldable UnBounded
forall a. Eq a => a -> UnBounded a -> Bool
forall a. Num a => UnBounded a -> a
forall a. Ord a => UnBounded a -> a
forall m. Monoid m => UnBounded m -> m
forall a. UnBounded a -> Bool
forall a. UnBounded a -> Int
forall a. UnBounded a -> [a]
forall a. (a -> a -> a) -> UnBounded a -> a
forall m a. Monoid m => (a -> m) -> UnBounded a -> m
forall b a. (b -> a -> b) -> b -> UnBounded a -> b
forall a b. (a -> b -> b) -> b -> UnBounded a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: UnBounded a -> a
$cproduct :: forall a. Num a => UnBounded a -> a
sum :: UnBounded a -> a
$csum :: forall a. Num a => UnBounded a -> a
minimum :: UnBounded a -> a
$cminimum :: forall a. Ord a => UnBounded a -> a
maximum :: UnBounded a -> a
$cmaximum :: forall a. Ord a => UnBounded a -> a
elem :: a -> UnBounded a -> Bool
$celem :: forall a. Eq a => a -> UnBounded a -> Bool
length :: UnBounded a -> Int
$clength :: forall a. UnBounded a -> Int
null :: UnBounded a -> Bool
$cnull :: forall a. UnBounded a -> Bool
toList :: UnBounded a -> [a]
$ctoList :: forall a. UnBounded a -> [a]
foldl1 :: (a -> a -> a) -> UnBounded a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> UnBounded a -> a
foldr1 :: (a -> a -> a) -> UnBounded a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> UnBounded a -> a
foldl' :: (b -> a -> b) -> b -> UnBounded a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> UnBounded a -> b
foldl :: (b -> a -> b) -> b -> UnBounded a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> UnBounded a -> b
foldr' :: (a -> b -> b) -> b -> UnBounded a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> UnBounded a -> b
foldr :: (a -> b -> b) -> b -> UnBounded a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> UnBounded a -> b
foldMap' :: (a -> m) -> UnBounded a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> UnBounded a -> m
foldMap :: (a -> m) -> UnBounded a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> UnBounded a -> m
fold :: UnBounded m -> m
$cfold :: forall m. Monoid m => UnBounded m -> m
F.Foldable,Functor UnBounded
Foldable UnBounded
Functor UnBounded
-> Foldable UnBounded
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> UnBounded a -> f (UnBounded b))
-> (forall (f :: * -> *) a.
Applicative f =>
UnBounded (f a) -> f (UnBounded a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> UnBounded a -> m (UnBounded b))
-> (forall (m :: * -> *) a.
Monad m =>
UnBounded (m a) -> m (UnBounded a))
-> Traversable UnBounded
(a -> f b) -> UnBounded a -> f (UnBounded b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
UnBounded (m a) -> m (UnBounded a)
forall (f :: * -> *) a.
Applicative f =>
UnBounded (f a) -> f (UnBounded a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> UnBounded a -> m (UnBounded b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> UnBounded a -> f (UnBounded b)
sequence :: UnBounded (m a) -> m (UnBounded a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
UnBounded (m a) -> m (UnBounded a)
mapM :: (a -> m b) -> UnBounded a -> m (UnBounded b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> UnBounded a -> m (UnBounded b)
sequenceA :: UnBounded (f a) -> f (UnBounded a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
UnBounded (f a) -> f (UnBounded a)
traverse :: (a -> f b) -> UnBounded a -> f (UnBounded b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> UnBounded a -> f (UnBounded b)
$cp2Traversable :: Foldable UnBounded
$cp1Traversable :: Functor UnBounded
T.Traversable)
_Val :: Prism (UnBounded a) (UnBounded b) a b
_Val :: p a (f b) -> p (UnBounded a) (f (UnBounded b))
_Val = (b -> UnBounded b)
-> (UnBounded a -> Either (UnBounded b) a)
-> Prism (UnBounded a) (UnBounded b) a b
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism b -> UnBounded b
forall a. a -> UnBounded a
Val UnBounded a -> Either (UnBounded b) a
forall b a. UnBounded b -> Either (UnBounded a) b
fromUnBounded
where
fromUnBounded :: UnBounded b -> Either (UnBounded a) b
fromUnBounded UnBounded b
MinInfinity = UnBounded a -> Either (UnBounded a) b
forall a b. a -> Either a b
Left UnBounded a
forall a. UnBounded a
MinInfinity
fromUnBounded UnBounded b
MaxInfinity = UnBounded a -> Either (UnBounded a) b
forall a b. a -> Either a b
Left UnBounded a
forall a. UnBounded a
MaxInfinity
fromUnBounded (Val b
v) = b -> Either (UnBounded a) b
forall a b. b -> Either a b
Right b
v
instance Show a => Show (UnBounded a) where
show :: UnBounded a -> String
show UnBounded a
MinInfinity = String
"MinInfinity"
show (Val a
x) = String
"Val " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
x
show UnBounded a
MaxInfinity = String
"MaxInfinity"
instance Num a => Num (UnBounded a) where
UnBounded a
MinInfinity + :: UnBounded a -> UnBounded a -> UnBounded a
+ UnBounded a
_ = UnBounded a
forall a. UnBounded a
MinInfinity
UnBounded a
_ + UnBounded a
MinInfinity = UnBounded a
forall a. UnBounded a
MinInfinity
(Val a
x) + (Val a
y) = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> a -> UnBounded a
forall a b. (a -> b) -> a -> b
$ a
x a -> a -> a
forall a. Num a => a -> a -> a
+ a
y
UnBounded a
_ + UnBounded a
MaxInfinity = UnBounded a
forall a. UnBounded a
MaxInfinity
UnBounded a
MaxInfinity + UnBounded a
_ = UnBounded a
forall a. UnBounded a
MaxInfinity
UnBounded a
MinInfinity * :: UnBounded a -> UnBounded a -> UnBounded a
* UnBounded a
_ = UnBounded a
forall a. UnBounded a
MinInfinity
UnBounded a
_ * UnBounded a
MinInfinity = UnBounded a
forall a. UnBounded a
MinInfinity
(Val a
x) * (Val a
y) = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> a -> UnBounded a
forall a b. (a -> b) -> a -> b
$ a
x a -> a -> a
forall a. Num a => a -> a -> a
* a
y
UnBounded a
_ * UnBounded a
MaxInfinity = UnBounded a
forall a. UnBounded a
MaxInfinity
UnBounded a
MaxInfinity * UnBounded a
_ = UnBounded a
forall a. UnBounded a
MaxInfinity
abs :: UnBounded a -> UnBounded a
abs UnBounded a
MinInfinity = UnBounded a
forall a. UnBounded a
MinInfinity
abs (Val a
x) = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> a -> UnBounded a
forall a b. (a -> b) -> a -> b
$ a -> a
forall a. Num a => a -> a
abs a
x
abs UnBounded a
MaxInfinity = UnBounded a
forall a. UnBounded a
MaxInfinity
signum :: UnBounded a -> UnBounded a
signum UnBounded a
MinInfinity = -UnBounded a
1
signum (Val a
x) = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> a -> UnBounded a
forall a b. (a -> b) -> a -> b
$ a -> a
forall a. Num a => a -> a
signum a
x
signum UnBounded a
MaxInfinity = UnBounded a
1
fromInteger :: Integer -> UnBounded a
fromInteger = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> (Integer -> a) -> Integer -> UnBounded a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> a
forall a. Num a => Integer -> a
fromInteger
negate :: UnBounded a -> UnBounded a
negate UnBounded a
MinInfinity = UnBounded a
forall a. UnBounded a
MaxInfinity
negate (Val a
x) = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> a -> UnBounded a
forall a b. (a -> b) -> a -> b
$ a -> a
forall a. Num a => a -> a
negate a
x
negate UnBounded a
MaxInfinity = UnBounded a
forall a. UnBounded a
MinInfinity
instance Fractional a => Fractional (UnBounded a) where
UnBounded a
MinInfinity / :: UnBounded a -> UnBounded a -> UnBounded a
/ UnBounded a
_ = UnBounded a
forall a. UnBounded a
MinInfinity
(Val a
x) / (Val a
y) = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> a -> UnBounded a
forall a b. (a -> b) -> a -> b
$ a
x a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
y
(Val a
_) / UnBounded a
_ = UnBounded a
0
UnBounded a
MaxInfinity / UnBounded a
_ = UnBounded a
forall a. UnBounded a
MaxInfinity
fromRational :: Rational -> UnBounded a
fromRational = a -> UnBounded a
forall a. a -> UnBounded a
Val (a -> UnBounded a) -> (Rational -> a) -> Rational -> UnBounded a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> a
forall a. Fractional a => Rational -> a
fromRational
unBoundedToMaybe :: UnBounded a -> Maybe a
unBoundedToMaybe :: UnBounded a -> Maybe a
unBoundedToMaybe (Val a
x) = a -> Maybe a
forall a. a -> Maybe a
Just a
x
unBoundedToMaybe UnBounded a
_ = Maybe a
forall a. Maybe a
Nothing