-- Strict counterparts to common data structures,
-- e.g. tuples, lists, maybes, etc.
--
-- Import this module qualified as Strict.

{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveTraversable #-}

module GHC.Data.Strict (
    Maybe(Nothing, Just),
    fromMaybe,
    Pair(And),

    -- Not used at the moment:
    --
    -- Either(Left, Right),
    -- List(Nil, Cons),
  ) where

import GHC.Prelude hiding (Maybe(..), Either(..))
import Control.Applicative
import Data.Semigroup
import Data.Data

data Maybe a = Nothing | Just !a
  deriving (Maybe a -> Maybe a -> Bool
forall a. Eq a => Maybe a -> Maybe a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Maybe a -> Maybe a -> Bool
$c/= :: forall a. Eq a => Maybe a -> Maybe a -> Bool
== :: Maybe a -> Maybe a -> Bool
$c== :: forall a. Eq a => Maybe a -> Maybe a -> Bool
Eq, Maybe a -> Maybe a -> Bool
Maybe a -> Maybe a -> Ordering
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 (Maybe a)
forall a. Ord a => Maybe a -> Maybe a -> Bool
forall a. Ord a => Maybe a -> Maybe a -> Ordering
forall a. Ord a => Maybe a -> Maybe a -> Maybe a
min :: Maybe a -> Maybe a -> Maybe a
$cmin :: forall a. Ord a => Maybe a -> Maybe a -> Maybe a
max :: Maybe a -> Maybe a -> Maybe a
$cmax :: forall a. Ord a => Maybe a -> Maybe a -> Maybe a
>= :: Maybe a -> Maybe a -> Bool
$c>= :: forall a. Ord a => Maybe a -> Maybe a -> Bool
> :: Maybe a -> Maybe a -> Bool
$c> :: forall a. Ord a => Maybe a -> Maybe a -> Bool
<= :: Maybe a -> Maybe a -> Bool
$c<= :: forall a. Ord a => Maybe a -> Maybe a -> Bool
< :: Maybe a -> Maybe a -> Bool
$c< :: forall a. Ord a => Maybe a -> Maybe a -> Bool
compare :: Maybe a -> Maybe a -> Ordering
$ccompare :: forall a. Ord a => Maybe a -> Maybe a -> Ordering
Ord, Int -> Maybe a -> ShowS
forall a. Show a => Int -> Maybe a -> ShowS
forall a. Show a => [Maybe a] -> ShowS
forall a. Show a => Maybe a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Maybe a] -> ShowS
$cshowList :: forall a. Show a => [Maybe a] -> ShowS
show :: Maybe a -> String
$cshow :: forall a. Show a => Maybe a -> String
showsPrec :: Int -> Maybe a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Maybe a -> ShowS
Show, forall a b. a -> Maybe b -> Maybe a
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Maybe b -> Maybe a
$c<$ :: forall a b. a -> Maybe b -> Maybe a
fmap :: forall a b. (a -> b) -> Maybe a -> Maybe b
$cfmap :: forall a b. (a -> b) -> Maybe a -> Maybe b
Functor, forall a. Eq a => a -> Maybe a -> Bool
forall a. Num a => Maybe a -> a
forall a. Ord a => Maybe a -> a
forall m. Monoid m => Maybe m -> m
forall a. Maybe a -> Bool
forall a. Maybe a -> Int
forall a. Maybe a -> [a]
forall a. (a -> a -> a) -> Maybe a -> a
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall b a. (b -> a -> b) -> b -> Maybe a -> b
forall a b. (a -> b -> b) -> b -> Maybe 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 :: forall a. Num a => Maybe a -> a
$cproduct :: forall a. Num a => Maybe a -> a
sum :: forall a. Num a => Maybe a -> a
$csum :: forall a. Num a => Maybe a -> a
minimum :: forall a. Ord a => Maybe a -> a
$cminimum :: forall a. Ord a => Maybe a -> a
maximum :: forall a. Ord a => Maybe a -> a
$cmaximum :: forall a. Ord a => Maybe a -> a
elem :: forall a. Eq a => a -> Maybe a -> Bool
$celem :: forall a. Eq a => a -> Maybe a -> Bool
length :: forall a. Maybe a -> Int
$clength :: forall a. Maybe a -> Int
null :: forall a. Maybe a -> Bool
$cnull :: forall a. Maybe a -> Bool
toList :: forall a. Maybe a -> [a]
$ctoList :: forall a. Maybe a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Maybe a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Maybe a -> a
foldr1 :: forall a. (a -> a -> a) -> Maybe a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Maybe a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Maybe a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Maybe a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Maybe a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Maybe a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Maybe a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Maybe a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Maybe a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Maybe a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Maybe a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Maybe a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Maybe a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Maybe a -> m
fold :: forall m. Monoid m => Maybe m -> m
$cfold :: forall m. Monoid m => Maybe m -> m
Foldable, Functor Maybe
Foldable Maybe
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 => Maybe (m a) -> m (Maybe a)
forall (f :: * -> *) a. Applicative f => Maybe (f a) -> f (Maybe a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Maybe a -> m (Maybe b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
sequence :: forall (m :: * -> *) a. Monad m => Maybe (m a) -> m (Maybe a)
$csequence :: forall (m :: * -> *) a. Monad m => Maybe (m a) -> m (Maybe a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Maybe a -> m (Maybe b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Maybe a -> m (Maybe b)
sequenceA :: forall (f :: * -> *) a. Applicative f => Maybe (f a) -> f (Maybe a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Maybe (f a) -> f (Maybe a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
Traversable, Maybe a -> DataType
Maybe a -> Constr
forall {a}. Data a => Typeable (Maybe a)
forall a. Data a => Maybe a -> DataType
forall a. Data a => Maybe a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Maybe a -> Maybe a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Maybe a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Maybe a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Maybe a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Maybe a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Maybe a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Maybe a -> c (Maybe a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Maybe a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Maybe a))
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 (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Maybe a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Maybe a -> c (Maybe a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Maybe a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Maybe a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Maybe a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Maybe a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Maybe a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Maybe a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Maybe a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Maybe a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Maybe a -> r
gmapT :: (forall b. Data b => b -> b) -> Maybe a -> Maybe a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Maybe a -> Maybe a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Maybe a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Maybe a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Maybe a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Maybe a))
dataTypeOf :: Maybe a -> DataType
$cdataTypeOf :: forall a. Data a => Maybe a -> DataType
toConstr :: Maybe a -> Constr
$ctoConstr :: forall a. Data a => Maybe a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Maybe a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Maybe a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Maybe a -> c (Maybe a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Maybe a -> c (Maybe a)
Data)

fromMaybe :: a -> Maybe a -> a
fromMaybe :: forall a. a -> Maybe a -> a
fromMaybe a
d Maybe a
Nothing = a
d
fromMaybe a
_ (Just a
x) = a
x

apMaybe :: Maybe (a -> b) -> Maybe a -> Maybe b
apMaybe :: forall a b. Maybe (a -> b) -> Maybe a -> Maybe b
apMaybe (Just a -> b
f) (Just a
x) = forall a. a -> Maybe a
Just (a -> b
f a
x)
apMaybe Maybe (a -> b)
_ Maybe a
_ = forall a. Maybe a
Nothing

altMaybe :: Maybe a -> Maybe a -> Maybe a
altMaybe :: forall a. Maybe a -> Maybe a -> Maybe a
altMaybe Maybe a
Nothing Maybe a
r = Maybe a
r
altMaybe Maybe a
l Maybe a
_ = Maybe a
l

instance Semigroup a => Semigroup (Maybe a) where
  Maybe a
Nothing <> :: Maybe a -> Maybe a -> Maybe a
<> Maybe a
b       = Maybe a
b
  Maybe a
a       <> Maybe a
Nothing = Maybe a
a
  Just a
a  <> Just a
b  = forall a. a -> Maybe a
Just (a
a forall a. Semigroup a => a -> a -> a
<> a
b)

instance Semigroup a => Monoid (Maybe a) where
  mempty :: Maybe a
mempty = forall a. Maybe a
Nothing

instance Applicative Maybe where
  pure :: forall a. a -> Maybe a
pure = forall a. a -> Maybe a
Just
  <*> :: forall a b. Maybe (a -> b) -> Maybe a -> Maybe b
(<*>) = forall a b. Maybe (a -> b) -> Maybe a -> Maybe b
apMaybe

instance Alternative Maybe where
  empty :: forall a. Maybe a
empty = forall a. Maybe a
Nothing
  <|> :: forall a. Maybe a -> Maybe a -> Maybe a
(<|>) = forall a. Maybe a -> Maybe a -> Maybe a
altMaybe

data Pair a b = !a `And` !b
  deriving (Pair a b -> Pair a b -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall a b. (Eq a, Eq b) => Pair a b -> Pair a b -> Bool
/= :: Pair a b -> Pair a b -> Bool
$c/= :: forall a b. (Eq a, Eq b) => Pair a b -> Pair a b -> Bool
== :: Pair a b -> Pair a b -> Bool
$c== :: forall a b. (Eq a, Eq b) => Pair a b -> Pair a b -> Bool
Eq, Pair a b -> Pair a b -> Bool
Pair a b -> Pair a b -> Ordering
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}. (Ord a, Ord b) => Eq (Pair a b)
forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Bool
forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Ordering
forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Pair a b
min :: Pair a b -> Pair a b -> Pair a b
$cmin :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Pair a b
max :: Pair a b -> Pair a b -> Pair a b
$cmax :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Pair a b
>= :: Pair a b -> Pair a b -> Bool
$c>= :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Bool
> :: Pair a b -> Pair a b -> Bool
$c> :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Bool
<= :: Pair a b -> Pair a b -> Bool
$c<= :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Bool
< :: Pair a b -> Pair a b -> Bool
$c< :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Bool
compare :: Pair a b -> Pair a b -> Ordering
$ccompare :: forall a b. (Ord a, Ord b) => Pair a b -> Pair a b -> Ordering
Ord, Int -> Pair a b -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b. (Show a, Show b) => Int -> Pair a b -> ShowS
forall a b. (Show a, Show b) => [Pair a b] -> ShowS
forall a b. (Show a, Show b) => Pair a b -> String
showList :: [Pair a b] -> ShowS
$cshowList :: forall a b. (Show a, Show b) => [Pair a b] -> ShowS
show :: Pair a b -> String
$cshow :: forall a b. (Show a, Show b) => Pair a b -> String
showsPrec :: Int -> Pair a b -> ShowS
$cshowsPrec :: forall a b. (Show a, Show b) => Int -> Pair a b -> ShowS
Show, forall a b. a -> Pair a b -> Pair a a
forall a b. (a -> b) -> Pair a a -> Pair a b
forall a a b. a -> Pair a b -> Pair a a
forall a a b. (a -> b) -> Pair a a -> Pair a b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Pair a b -> Pair a a
$c<$ :: forall a a b. a -> Pair a b -> Pair a a
fmap :: forall a b. (a -> b) -> Pair a a -> Pair a b
$cfmap :: forall a a b. (a -> b) -> Pair a a -> Pair a b
Functor, forall a. Pair a a -> Bool
forall a a. Eq a => a -> Pair a a -> Bool
forall a a. Num a => Pair a a -> a
forall a a. Ord a => Pair a a -> a
forall m a. Monoid m => (a -> m) -> Pair a a -> m
forall a m. Monoid m => Pair a m -> m
forall a a. Pair a a -> Bool
forall a a. Pair a a -> Int
forall a a. Pair a a -> [a]
forall a b. (a -> b -> b) -> b -> Pair a a -> b
forall a a. (a -> a -> a) -> Pair a a -> a
forall a m a. Monoid m => (a -> m) -> Pair a a -> m
forall a b a. (b -> a -> b) -> b -> Pair a a -> b
forall a a b. (a -> b -> b) -> b -> Pair a 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 :: forall a. Num a => Pair a a -> a
$cproduct :: forall a a. Num a => Pair a a -> a
sum :: forall a. Num a => Pair a a -> a
$csum :: forall a a. Num a => Pair a a -> a
minimum :: forall a. Ord a => Pair a a -> a
$cminimum :: forall a a. Ord a => Pair a a -> a
maximum :: forall a. Ord a => Pair a a -> a
$cmaximum :: forall a a. Ord a => Pair a a -> a
elem :: forall a. Eq a => a -> Pair a a -> Bool
$celem :: forall a a. Eq a => a -> Pair a a -> Bool
length :: forall a. Pair a a -> Int
$clength :: forall a a. Pair a a -> Int
null :: forall a. Pair a a -> Bool
$cnull :: forall a a. Pair a a -> Bool
toList :: forall a. Pair a a -> [a]
$ctoList :: forall a a. Pair a a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Pair a a -> a
$cfoldl1 :: forall a a. (a -> a -> a) -> Pair a a -> a
foldr1 :: forall a. (a -> a -> a) -> Pair a a -> a
$cfoldr1 :: forall a a. (a -> a -> a) -> Pair a a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Pair a a -> b
$cfoldl' :: forall a b a. (b -> a -> b) -> b -> Pair a a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Pair a a -> b
$cfoldl :: forall a b a. (b -> a -> b) -> b -> Pair a a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Pair a a -> b
$cfoldr' :: forall a a b. (a -> b -> b) -> b -> Pair a a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Pair a a -> b
$cfoldr :: forall a a b. (a -> b -> b) -> b -> Pair a a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Pair a a -> m
$cfoldMap' :: forall a m a. Monoid m => (a -> m) -> Pair a a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Pair a a -> m
$cfoldMap :: forall a m a. Monoid m => (a -> m) -> Pair a a -> m
fold :: forall m. Monoid m => Pair a m -> m
$cfold :: forall a m. Monoid m => Pair a m -> m
Foldable, forall a. Functor (Pair a)
forall a. Foldable (Pair a)
forall a (m :: * -> *) a. Monad m => Pair a (m a) -> m (Pair a a)
forall a (f :: * -> *) a.
Applicative f =>
Pair a (f a) -> f (Pair a a)
forall a (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Pair a a -> m (Pair a b)
forall a (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pair a a -> f (Pair a 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 (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pair a a -> f (Pair a b)
sequence :: forall (m :: * -> *) a. Monad m => Pair a (m a) -> m (Pair a a)
$csequence :: forall a (m :: * -> *) a. Monad m => Pair a (m a) -> m (Pair a a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Pair a a -> m (Pair a b)
$cmapM :: forall a (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Pair a a -> m (Pair a b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Pair a (f a) -> f (Pair a a)
$csequenceA :: forall a (f :: * -> *) a.
Applicative f =>
Pair a (f a) -> f (Pair a a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pair a a -> f (Pair a b)
$ctraverse :: forall a (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pair a a -> f (Pair a b)
Traversable, Pair a b -> DataType
Pair a b -> Constr
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 {a} {b}. (Data a, Data b) => Typeable (Pair a b)
forall a b. (Data a, Data b) => Pair a b -> DataType
forall a b. (Data a, Data b) => Pair a b -> Constr
forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> Pair a b -> Pair a b
forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> Pair a b -> u
forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> Pair a b -> [u]
forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pair a b -> r
forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pair a b -> r
forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair 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 (Pair 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) -> Pair a b -> c (Pair a b)
forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Pair 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 (Pair a b))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pair a b)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pair a b -> c (Pair a b)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Pair a b))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
$cgmapMo :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
$cgmapMp :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
$cgmapM :: forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Pair a b -> m (Pair a b)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Pair a b -> u
$cgmapQi :: forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> Pair a b -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Pair a b -> [u]
$cgmapQ :: forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> Pair a b -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pair a b -> r
$cgmapQr :: forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pair a b -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pair a b -> r
$cgmapQl :: forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pair a b -> r
gmapT :: (forall b. Data b => b -> b) -> Pair a b -> Pair a b
$cgmapT :: forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> Pair a b -> Pair a b
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Pair 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 (Pair a b))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Pair a b))
$cdataCast1 :: forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Pair a b))
dataTypeOf :: Pair a b -> DataType
$cdataTypeOf :: forall a b. (Data a, Data b) => Pair a b -> DataType
toConstr :: Pair a b -> Constr
$ctoConstr :: forall a b. (Data a, Data b) => Pair a b -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pair 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 (Pair a b)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pair a b -> c (Pair 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) -> Pair a b -> c (Pair a b)
Data)

-- The definitions below are commented out because they are
-- not used anywhere in the compiler, but are useful to showcase
-- the intent behind this module (i.e. how it may evolve).
--
-- data Either a b = Left !a | Right !b
--   deriving (Eq, Ord, Show, Functor, Foldable, Traversable, Data)
--
-- data List a = Nil | !a `Cons` !(List a)
--   deriving (Eq, Ord, Show, Functor, Foldable, Traversable, Data)