{-# LANGUAGE DeriveDataTypeable #-}

{-|
Module: Data.Neither
Description: The Neither datatype and instances

In this module, instances have been annotated with the interpretation of the Neither type that they use.
-}
module Data.Neither where

import Control.Applicative
import Control.Monad
import Control.Monad.Zip
import Control.Monad.Fix
import Control.Monad.IO.Class
import Control.Arrow
import Control.Category
import Data.Data
import Data.Functor.Contravariant
import Data.Functor.Classes
import Data.Bifunctor
import Data.Bifoldable
import Data.Bitraversable
import Data.String
import Data.Ix
import Data.Fixed
import Data.Bits

data Neither a b = Neither deriving (ReadPrec [Neither a b]
ReadPrec (Neither a b)
Int -> ReadS (Neither a b)
ReadS [Neither a b]
(Int -> ReadS (Neither a b))
-> ReadS [Neither a b]
-> ReadPrec (Neither a b)
-> ReadPrec [Neither a b]
-> Read (Neither a b)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall a b. ReadPrec [Neither a b]
forall a b. ReadPrec (Neither a b)
forall a b. Int -> ReadS (Neither a b)
forall a b. ReadS [Neither a b]
readListPrec :: ReadPrec [Neither a b]
$creadListPrec :: forall a b. ReadPrec [Neither a b]
readPrec :: ReadPrec (Neither a b)
$creadPrec :: forall a b. ReadPrec (Neither a b)
readList :: ReadS [Neither a b]
$creadList :: forall a b. ReadS [Neither a b]
readsPrec :: Int -> ReadS (Neither a b)
$creadsPrec :: forall a b. Int -> ReadS (Neither a b)
Read, Int -> Neither a b -> ShowS
[Neither a b] -> ShowS
Neither a b -> String
(Int -> Neither a b -> ShowS)
-> (Neither a b -> String)
-> ([Neither a b] -> ShowS)
-> Show (Neither a b)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b. Int -> Neither a b -> ShowS
forall a b. [Neither a b] -> ShowS
forall a b. Neither a b -> String
showList :: [Neither a b] -> ShowS
$cshowList :: forall a b. [Neither a b] -> ShowS
show :: Neither a b -> String
$cshow :: forall a b. Neither a b -> String
showsPrec :: Int -> Neither a b -> ShowS
$cshowsPrec :: forall a b. Int -> Neither a b -> ShowS
Show, Neither a b -> Neither a b -> Bool
(Neither a b -> Neither a b -> Bool)
-> (Neither a b -> Neither a b -> Bool) -> Eq (Neither a b)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall a b. Neither a b -> Neither a b -> Bool
/= :: Neither a b -> Neither a b -> Bool
$c/= :: forall a b. Neither a b -> Neither a b -> Bool
== :: Neither a b -> Neither a b -> Bool
$c== :: forall a b. Neither a b -> Neither a b -> Bool
Eq, Eq (Neither a b)
Eq (Neither a b)
-> (Neither a b -> Neither a b -> Ordering)
-> (Neither a b -> Neither a b -> Bool)
-> (Neither a b -> Neither a b -> Bool)
-> (Neither a b -> Neither a b -> Bool)
-> (Neither a b -> Neither a b -> Bool)
-> (Neither a b -> Neither a b -> Neither a b)
-> (Neither a b -> Neither a b -> Neither a b)
-> Ord (Neither a b)
Neither a b -> Neither a b -> Bool
Neither a b -> Neither a b -> Ordering
Neither a b -> Neither a b -> Neither a b
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 b. Eq (Neither a b)
forall a b. Neither a b -> Neither a b -> Bool
forall a b. Neither a b -> Neither a b -> Ordering
forall a b. Neither a b -> Neither a b -> Neither a b
min :: Neither a b -> Neither a b -> Neither a b
$cmin :: forall a b. Neither a b -> Neither a b -> Neither a b
max :: Neither a b -> Neither a b -> Neither a b
$cmax :: forall a b. Neither a b -> Neither a b -> Neither a b
>= :: Neither a b -> Neither a b -> Bool
$c>= :: forall a b. Neither a b -> Neither a b -> Bool
> :: Neither a b -> Neither a b -> Bool
$c> :: forall a b. Neither a b -> Neither a b -> Bool
<= :: Neither a b -> Neither a b -> Bool
$c<= :: forall a b. Neither a b -> Neither a b -> Bool
< :: Neither a b -> Neither a b -> Bool
$c< :: forall a b. Neither a b -> Neither a b -> Bool
compare :: Neither a b -> Neither a b -> Ordering
$ccompare :: forall a b. Neither a b -> Neither a b -> Ordering
$cp1Ord :: forall a b. Eq (Neither a b)
Ord, Int -> Neither a b
Neither a b -> Int
Neither a b -> [Neither a b]
Neither a b -> Neither a b
Neither a b -> Neither a b -> [Neither a b]
Neither a b -> Neither a b -> Neither a b -> [Neither a b]
(Neither a b -> Neither a b)
-> (Neither a b -> Neither a b)
-> (Int -> Neither a b)
-> (Neither a b -> Int)
-> (Neither a b -> [Neither a b])
-> (Neither a b -> Neither a b -> [Neither a b])
-> (Neither a b -> Neither a b -> [Neither a b])
-> (Neither a b -> Neither a b -> Neither a b -> [Neither a b])
-> Enum (Neither a b)
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
forall a b. Int -> Neither a b
forall a b. Neither a b -> Int
forall a b. Neither a b -> [Neither a b]
forall a b. Neither a b -> Neither a b
forall a b. Neither a b -> Neither a b -> [Neither a b]
forall a b.
Neither a b -> Neither a b -> Neither a b -> [Neither a b]
enumFromThenTo :: Neither a b -> Neither a b -> Neither a b -> [Neither a b]
$cenumFromThenTo :: forall a b.
Neither a b -> Neither a b -> Neither a b -> [Neither a b]
enumFromTo :: Neither a b -> Neither a b -> [Neither a b]
$cenumFromTo :: forall a b. Neither a b -> Neither a b -> [Neither a b]
enumFromThen :: Neither a b -> Neither a b -> [Neither a b]
$cenumFromThen :: forall a b. Neither a b -> Neither a b -> [Neither a b]
enumFrom :: Neither a b -> [Neither a b]
$cenumFrom :: forall a b. Neither a b -> [Neither a b]
fromEnum :: Neither a b -> Int
$cfromEnum :: forall a b. Neither a b -> Int
toEnum :: Int -> Neither a b
$ctoEnum :: forall a b. Int -> Neither a b
pred :: Neither a b -> Neither a b
$cpred :: forall a b. Neither a b -> Neither a b
succ :: Neither a b -> Neither a b
$csucc :: forall a b. Neither a b -> Neither a b
Enum, Neither a b
Neither a b -> Neither a b -> Bounded (Neither a b)
forall a. a -> a -> Bounded a
forall a b. Neither a b
maxBound :: Neither a b
$cmaxBound :: forall a b. Neither a b
minBound :: Neither a b
$cminBound :: forall a b. Neither a b
Bounded, Typeable (Neither a b)
DataType
Constr
Typeable (Neither a b)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Neither a b -> c (Neither a b))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Neither a b))
-> (Neither a b -> Constr)
-> (Neither a b -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Neither a b)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Neither a b)))
-> ((forall b. Data b => b -> b) -> Neither a b -> Neither a b)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Neither a b -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Neither a b -> r)
-> (forall u. (forall d. Data d => d -> u) -> Neither a b -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Neither a b -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b))
-> Data (Neither a b)
Neither a b -> DataType
Neither a b -> Constr
(forall b. Data b => b -> b) -> Neither a b -> Neither a b
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Neither a b -> c (Neither a b)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Neither a b)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Neither a b))
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Neither a b -> u
forall u. (forall d. Data d => d -> u) -> Neither a b -> [u]
forall a b. (Data a, Data b) => Typeable (Neither a b)
forall a b. (Data a, Data b) => Neither a b -> DataType
forall a b. (Data a, Data b) => Neither a b -> Constr
forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> Neither a b -> Neither a b
forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> Neither a b -> u
forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> Neither a b -> [u]
forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
forall a b (c :: * -> *).
(Data a, Data b) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Neither a b)
forall a b (c :: * -> *).
(Data a, Data b) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Neither a b -> c (Neither a b)
forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Neither a b))
forall a b (t :: * -> * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Neither a b))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Neither a b)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Neither a b -> c (Neither a b)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Neither a b))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Neither a b))
$cNeither :: Constr
$tNeither :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
$cgmapMo :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
gmapMp :: (forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
$cgmapMp :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
gmapM :: (forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
$cgmapM :: forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Neither a b -> m (Neither a b)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Neither a b -> u
$cgmapQi :: forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> Neither a b -> u
gmapQ :: (forall d. Data d => d -> u) -> Neither a b -> [u]
$cgmapQ :: forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> Neither a b -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
$cgmapQr :: forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
$cgmapQl :: forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Neither a b -> r
gmapT :: (forall b. Data b => b -> b) -> Neither a b -> Neither a b
$cgmapT :: forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> Neither a b -> Neither a b
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Neither a b))
$cdataCast2 :: forall a b (t :: * -> * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Neither a b))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Neither a b))
$cdataCast1 :: forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Neither a b))
dataTypeOf :: Neither a b -> DataType
$cdataTypeOf :: forall a b. (Data a, Data b) => Neither a b -> DataType
toConstr :: Neither a b -> Constr
$ctoConstr :: forall a b. (Data a, Data b) => Neither a b -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Neither a b)
$cgunfold :: forall a b (c :: * -> *).
(Data a, Data b) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Neither a b)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Neither a b -> c (Neither a b)
$cgfoldl :: forall a b (c :: * -> *).
(Data a, Data b) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Neither a b -> c (Neither a b)
$cp1Data :: forall a b. (Data a, Data b) => Typeable (Neither a b)
Data)

-- | Produces a Neither value whose types match the arguments, discarding the arguments
neither :: a -> b -> Neither a b
neither :: a -> b -> Neither a b
neither a
_ b
_ = Neither a b
forall a b. Neither a b
Neither

-- | An empty container
instance Functor (Neither a) where
    fmap :: (a -> b) -> Neither a a -> Neither a b
fmap a -> b
_ Neither a a
_ = Neither a b
forall a b. Neither a b
Neither
    a
_ <$ :: a -> Neither a b -> Neither a a
<$ Neither a b
_ = Neither a a
forall a b. Neither a b
Neither

-- | An empty container
instance Applicative (Neither a) where
    pure :: a -> Neither a a
pure a
_ = Neither a a
forall a b. Neither a b
Neither
    Neither a (a -> b)
_ <*> :: Neither a (a -> b) -> Neither a a -> Neither a b
<*> Neither a a
_ = Neither a b
forall a b. Neither a b
Neither
    Neither a a
_ *> :: Neither a a -> Neither a b -> Neither a b
*> Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    Neither a a
_ <* :: Neither a a -> Neither a b -> Neither a a
<* Neither a b
_ = Neither a a
forall a b. Neither a b
Neither

-- | An empty container
instance Monad (Neither a) where
    Neither a a
_ >>= :: Neither a a -> (a -> Neither a b) -> Neither a b
>>= a -> Neither a b
_ = Neither a b
forall a b. Neither a b
Neither

-- | An empty container
instance MonadFail (Neither a) where
    fail :: String -> Neither a a
fail String
_ = Neither a a
forall a b. Neither a b
Neither

-- | An empty container
instance MonadIO (Neither a) where
    liftIO :: IO a -> Neither a a
liftIO IO a
_ = Neither a a
forall a b. Neither a b
Neither

-- | The trivial single element semigroup
instance Semigroup (Neither a b) where
    Neither a b
_ <> :: Neither a b -> Neither a b -> Neither a b
<> Neither a b
_ = Neither a b
forall a b. Neither a b
Neither

-- | The trivial single element monoid
instance Monoid (Neither a b) where
    mempty :: Neither a b
mempty = Neither a b
forall a b. Neither a b
Neither

-- | A trivial single element group with no-ops, where every integer is Neither
instance Num (Neither a b) where
    Neither a b
_ + :: Neither a b -> Neither a b -> Neither a b
+ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    Neither a b
_ - :: Neither a b -> Neither a b -> Neither a b
- Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    Neither a b
_ * :: Neither a b -> Neither a b -> Neither a b
* Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    negate :: Neither a b -> Neither a b
negate Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    abs :: Neither a b -> Neither a b
abs Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    signum :: Neither a b -> Neither a b
signum Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    fromInteger :: Integer -> Neither a b
fromInteger Integer
_ = Neither a b
forall a b. Neither a b
Neither

-- | A number type that only contains zero
instance Real (Neither a b) where
    toRational :: Neither a b -> Rational
toRational Neither a b
_ = Rational
0

-- | A number type that only contains zero, or a trivial single element euclidean domain
instance Integral (Neither a b) where
    quot :: Neither a b -> Neither a b -> Neither a b
quot Neither a b
_ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    rem :: Neither a b -> Neither a b -> Neither a b
rem Neither a b
_ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    div :: Neither a b -> Neither a b -> Neither a b
div Neither a b
_ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    mod :: Neither a b -> Neither a b -> Neither a b
mod Neither a b
_ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    quotRem :: Neither a b -> Neither a b -> (Neither a b, Neither a b)
quotRem Neither a b
_ Neither a b
_ = (Neither a b
forall a b. Neither a b
Neither, Neither a b
forall a b. Neither a b
Neither)
    divMod :: Neither a b -> Neither a b -> (Neither a b, Neither a b)
divMod Neither a b
_ Neither a b
_ = (Neither a b
forall a b. Neither a b
Neither, Neither a b
forall a b. Neither a b
Neither)
    toInteger :: Neither a b -> Integer
toInteger Neither a b
_ = Integer
0

-- | A trivial single element field where every ratio is Neither
instance Fractional (Neither a b) where
    Neither a b
_ / :: Neither a b -> Neither a b -> Neither a b
/ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    recip :: Neither a b -> Neither a b
recip Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    fromRational :: Rational -> Neither a b
fromRational Rational
_ = Neither a b
forall a b. Neither a b
Neither

-- | A trivial single element exponential field, where every number is Neither
instance Floating (Neither a b) where
    pi :: Neither a b
pi = Neither a b
forall a b. Neither a b
Neither
    exp :: Neither a b -> Neither a b
exp Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    log :: Neither a b -> Neither a b
log Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    sqrt :: Neither a b -> Neither a b
sqrt Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    Neither a b
_ ** :: Neither a b -> Neither a b -> Neither a b
** Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    logBase :: Neither a b -> Neither a b -> Neither a b
logBase Neither a b
_ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    sin :: Neither a b -> Neither a b
sin Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    cos :: Neither a b -> Neither a b
cos Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    tan :: Neither a b -> Neither a b
tan Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    asin :: Neither a b -> Neither a b
asin Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    acos :: Neither a b -> Neither a b
acos Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    atan :: Neither a b -> Neither a b
atan Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    sinh :: Neither a b -> Neither a b
sinh Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    cosh :: Neither a b -> Neither a b
cosh Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    tanh :: Neither a b -> Neither a b
tanh Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    asinh :: Neither a b -> Neither a b
asinh Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    acosh :: Neither a b -> Neither a b
acosh Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    atanh :: Neither a b -> Neither a b
atanh Neither a b
_ = Neither a b
forall a b. Neither a b
Neither

-- | A number type that only contains zero
instance RealFrac (Neither a b) where
    properFraction :: Neither a b -> (b, Neither a b)
properFraction Neither a b
_ = (b
0, Neither a b
forall a b. Neither a b
Neither)
    truncate :: Neither a b -> b
truncate Neither a b
_ = b
0
    round :: Neither a b -> b
round Neither a b
_ = b
0
    ceiling :: Neither a b -> b
ceiling Neither a b
_ = b
0
    floor :: Neither a b -> b
floor Neither a b
_ = b
0

-- | A bitstring with zero length
instance Bits (Neither a b) where
    Neither a b
_ .&. :: Neither a b -> Neither a b -> Neither a b
.&. Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    Neither a b
_ .|. :: Neither a b -> Neither a b -> Neither a b
.|. Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    xor :: Neither a b -> Neither a b -> Neither a b
xor Neither a b
_ Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    complement :: Neither a b -> Neither a b
complement Neither a b
_ = Neither a b
forall a b. Neither a b
Neither
    shift :: Neither a b -> Int -> Neither a b
shift Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    rotate :: Neither a b -> Int -> Neither a b
rotate Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    zeroBits :: Neither a b
zeroBits = Neither a b
forall a b. Neither a b
Neither
    bit :: Int -> Neither a b
bit Int
_ = Neither a b
forall a b. Neither a b
Neither
    setBit :: Neither a b -> Int -> Neither a b
setBit Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    clearBit :: Neither a b -> Int -> Neither a b
clearBit Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    complementBit :: Neither a b -> Int -> Neither a b
complementBit Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    testBit :: Neither a b -> Int -> Bool
testBit Neither a b
_ Int
_ = Bool
False
    bitSizeMaybe :: Neither a b -> Maybe Int
bitSizeMaybe Neither a b
_ = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
0
    bitSize :: Neither a b -> Int
bitSize Neither a b
_ = Int
0
    isSigned :: Neither a b -> Bool
isSigned Neither a b
_ = Bool
False
    shiftL :: Neither a b -> Int -> Neither a b
shiftL Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    shiftR :: Neither a b -> Int -> Neither a b
shiftR Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    rotateL :: Neither a b -> Int -> Neither a b
rotateL Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    rotateR :: Neither a b -> Int -> Neither a b
rotateR Neither a b
_ Int
_ = Neither a b
forall a b. Neither a b
Neither
    popCount :: Neither a b -> Int
popCount Neither a b
_ = Int
0

-- | A bitstring with zero length
instance FiniteBits (Neither a b) where
    finiteBitSize :: Neither a b -> Int
finiteBitSize Neither a b
_ = Int
0
    countLeadingZeros :: Neither a b -> Int
countLeadingZeros Neither a b
_ = Int
0
    countTrailingZeros :: Neither a b -> Int
countTrailingZeros Neither a b
_ = Int
0

-- | An empty container with no-ops
instance Alternative (Neither a) where
    empty :: Neither a a
empty = Neither a a
forall a b. Neither a b
Neither
    Neither a a
_ <|> :: Neither a a -> Neither a a -> Neither a a
<|> Neither a a
_ = Neither a a
forall a b. Neither a b
Neither
    some :: Neither a a -> Neither a [a]
some Neither a a
_ = Neither a [a]
forall a b. Neither a b
Neither
    many :: Neither a a -> Neither a [a]
many Neither a a
_ = Neither a [a]
forall a b. Neither a b
Neither

-- | An empty container with no-ops
instance MonadPlus (Neither a) where
    mzero :: Neither a a
mzero = Neither a a
forall a b. Neither a b
Neither
    mplus :: Neither a a -> Neither a a -> Neither a a
mplus Neither a a
_ Neither a a
_ = Neither a a
forall a b. Neither a b
Neither

-- | An empty container or an uncallable or no-op function representation
instance Contravariant (Neither a) where
    contramap :: (a -> b) -> Neither a b -> Neither a a
contramap a -> b
_ Neither a b
_ = Neither a a
forall a b. Neither a b
Neither
    b
_ >$ :: b -> Neither a b -> Neither a a
>$ Neither a b
_ = Neither a a
forall a b. Neither a b
Neither

-- | An empty container
instance Bifunctor Neither where
    bimap :: (a -> b) -> (c -> d) -> Neither a c -> Neither b d
bimap a -> b
_ c -> d
_ Neither a c
_ = Neither b d
forall a b. Neither a b
Neither
    first :: (a -> b) -> Neither a c -> Neither b c
first a -> b
_ Neither a c
_ = Neither b c
forall a b. Neither a b
Neither
    second :: (b -> c) -> Neither a b -> Neither a c
second b -> c
_ Neither a b
_ = Neither a c
forall a b. Neither a b
Neither

-- | An empty container
instance MonadZip (Neither a) where
    mzip :: Neither a a -> Neither a b -> Neither a (a, b)
mzip Neither a a
_ Neither a b
_ = Neither a (a, b)
forall a b. Neither a b
Neither
    mzipWith :: (a -> b -> c) -> Neither a a -> Neither a b -> Neither a c
mzipWith a -> b -> c
_ Neither a a
_ Neither a b
_ = Neither a c
forall a b. Neither a b
Neither
    munzip :: Neither a (a, b) -> (Neither a a, Neither a b)
munzip Neither a (a, b)
_ = (Neither a a
forall a b. Neither a b
Neither, Neither a b
forall a b. Neither a b
Neither)

-- | All functions from Neither to Neither must have Neither as a fixed point (if you ignore types)
instance MonadFix (Neither a) where
    mfix :: (a -> Neither a a) -> Neither a a
mfix a -> Neither a a
_ = Neither a a
forall a b. Neither a b
Neither

-- | An empty container which folds to the starting value or the identity
instance Foldable (Neither a) where
    foldMap :: (a -> m) -> Neither a a -> m
foldMap a -> m
_ Neither a a
_ = m
forall a. Monoid a => a
mempty
    foldr :: (a -> b -> b) -> b -> Neither a a -> b
foldr a -> b -> b
_ b
x Neither a a
_ = b
x
    foldl :: (b -> a -> b) -> b -> Neither a a -> b
foldl b -> a -> b
_ b
x Neither a a
_ = b
x
    elem :: a -> Neither a a -> Bool
elem a
_ Neither a a
_ = Bool
False
    sum :: Neither a a -> a
sum Neither a a
_ = a
0
    product :: Neither a a -> a
product Neither a a
_ = a
1

-- | An empty container, that, when in an applicative, must always be a minimally wrapped constant value
instance Traversable (Neither a) where
    traverse :: (a -> f b) -> Neither a a -> f (Neither a b)
traverse a -> f b
_ Neither a a
_ = Neither a b -> f (Neither a b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Neither a b
forall a b. Neither a b
Neither
    sequenceA :: Neither a (f a) -> f (Neither a a)
sequenceA Neither a (f a)
_ = Neither a a -> f (Neither a a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Neither a a
forall a b. Neither a b
Neither
    mapM :: (a -> m b) -> Neither a a -> m (Neither a b)
mapM a -> m b
_ Neither a a
_ = Neither a b -> m (Neither a b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Neither a b
forall a b. Neither a b
Neither
    sequence :: Neither a (m a) -> m (Neither a a)
sequence Neither a (m a)
_ = Neither a a -> m (Neither a a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Neither a a
forall a b. Neither a b
Neither

-- | An empty container which folds to the starting value or the identity
instance Bifoldable Neither where
    bifold :: Neither m m -> m
bifold Neither m m
_ = m
forall a. Monoid a => a
mempty
    bifoldMap :: (a -> m) -> (b -> m) -> Neither a b -> m
bifoldMap a -> m
_ b -> m
_ Neither a b
_ = m
forall a. Monoid a => a
mempty
    bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Neither a b -> c
bifoldr a -> c -> c
_ b -> c -> c
_ c
x Neither a b
_ = c
x
    bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Neither a b -> c
bifoldl c -> a -> c
_ c -> b -> c
_ c
x Neither a b
_ = c
x

-- | An empty container, that, when in an applicative, must always be a minimally wrapped constant value
instance Bitraversable Neither where
    bitraverse :: (a -> f c) -> (b -> f d) -> Neither a b -> f (Neither c d)
bitraverse a -> f c
_ b -> f d
_ Neither a b
_ = Neither c d -> f (Neither c d)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Neither c d
forall a b. Neither a b
Neither

-- | The constant functor from Set to 1
instance Category Neither where
    id :: Neither a a
id = Neither a a
forall a b. Neither a b
Neither
    Neither b c
_ . :: Neither b c -> Neither a b -> Neither a c
. Neither a b
_ = Neither a c
forall a b. Neither a b
Neither

-- | A dummy function representation
instance Arrow Neither where
    arr :: (b -> c) -> Neither b c
arr b -> c
_ = Neither b c
forall a b. Neither a b
Neither
    first :: Neither b c -> Neither (b, d) (c, d)
first Neither b c
_ = Neither (b, d) (c, d)
forall a b. Neither a b
Neither
    second :: Neither b c -> Neither (d, b) (d, c)
second Neither b c
_ = Neither (d, b) (d, c)
forall a b. Neither a b
Neither
    Neither b c
_ *** :: Neither b c -> Neither b' c' -> Neither (b, b') (c, c')
*** Neither b' c'
_ = Neither (b, b') (c, c')
forall a b. Neither a b
Neither
    Neither b c
_ &&& :: Neither b c -> Neither b c' -> Neither b (c, c')
&&& Neither b c'
_ = Neither b (c, c')
forall a b. Neither a b
Neither

-- | A dummy function representation, so the zero arrow is merely unique by its type parameters
instance ArrowZero Neither where
    zeroArrow :: Neither b c
zeroArrow = Neither b c
forall a b. Neither a b
Neither

-- |     The trivial single element monoid on a dummy function representation
instance ArrowPlus Neither where
    Neither b c
_ <+> :: Neither b c -> Neither b c -> Neither b c
<+> Neither b c
_ = Neither b c
forall a b. Neither a b
Neither

-- | A dummy function representation, where all choices are the same
instance ArrowChoice Neither where
    left :: Neither b c -> Neither (Either b d) (Either c d)
left Neither b c
_ = Neither (Either b d) (Either c d)
forall a b. Neither a b
Neither
    right :: Neither b c -> Neither (Either d b) (Either d c)
right Neither b c
_ = Neither (Either d b) (Either d c)
forall a b. Neither a b
Neither
    Neither b c
_ +++ :: Neither b c -> Neither b' c' -> Neither (Either b b') (Either c c')
+++ Neither b' c'
_ = Neither (Either b b') (Either c c')
forall a b. Neither a b
Neither
    Neither b d
_ ||| :: Neither b d -> Neither c d -> Neither (Either b c) d
||| Neither c d
_ = Neither (Either b c) d
forall a b. Neither a b
Neither

-- | A dummy function representation, where application returns another dummy
instance ArrowApply Neither where
    app :: Neither (Neither b c, b) c
app = Neither (Neither b c, b) c
forall a b. Neither a b
Neither

-- | A dummy function representation, where recursion creation returns another dummy
instance ArrowLoop Neither where
    loop :: Neither (b, d) (c, d) -> Neither b c
loop Neither (b, d) (c, d)
_ = Neither b c
forall a b. Neither a b
Neither

-- | Every string is Neither
instance IsString (Neither a b) where
    fromString :: String -> Neither a b
fromString String
_ = Neither a b
forall a b. Neither a b
Neither

-- | There is only one Neither value
instance Ix (Neither a b) where
    range :: (Neither a b, Neither a b) -> [Neither a b]
range (Neither a b, Neither a b)
_ = [Neither a b
forall a b. Neither a b
Neither]
    index :: (Neither a b, Neither a b) -> Neither a b -> Int
index (Neither a b, Neither a b)
_ Neither a b
_ = Int
0
    inRange :: (Neither a b, Neither a b) -> Neither a b -> Bool
inRange (Neither a b, Neither a b)
_ Neither a b
_ = Bool
True
    rangeSize :: (Neither a b, Neither a b) -> Int
rangeSize (Neither a b, Neither a b)
_ = Int
1

-- | Empty container that is equal to itself (with no values to compare)
instance Eq1 (Neither a) where
    liftEq :: (a -> b -> Bool) -> Neither a a -> Neither a b -> Bool
liftEq a -> b -> Bool
_ Neither a a
_ Neither a b
_ = Bool
True

-- | Empty container that is equal to itself (with no values to compare)
instance Ord1 (Neither a) where
    liftCompare :: (a -> b -> Ordering) -> Neither a a -> Neither a b -> Ordering
liftCompare a -> b -> Ordering
_ Neither a a
_ Neither a b
_ = Ordering
EQ

-- | Empty container that is equal to itself (with no values to compare)
instance Eq2 Neither where
    liftEq2 :: (a -> b -> Bool)
-> (c -> d -> Bool) -> Neither a c -> Neither b d -> Bool
liftEq2 a -> b -> Bool
_ c -> d -> Bool
_ Neither a c
_ Neither b d
_ = Bool
True

-- | Empty container that is equal to itself (with no values to compare)
instance Ord2 Neither where
    liftCompare2 :: (a -> b -> Ordering)
-> (c -> d -> Ordering) -> Neither a c -> Neither b d -> Ordering
liftCompare2 a -> b -> Ordering
_ c -> d -> Ordering
_ Neither a c
_ Neither b d
_ = Ordering
EQ