{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-}
module Data.Tuple.Strict.T5
( T5 (..),
)
where
import Control.DeepSeq (NFData, rnf)
import Data.Biapplicative
import Data.Bifoldable
import Data.Bitraversable
import Data.Functor.Classes (Eq1 (liftEq), Eq2 (liftEq2))
import Data.Hashable (Hashable, hash, hashWithSalt)
import Data.Hashable.Lifted
( Hashable1,
Hashable2,
defaultLiftHashWithSalt,
hashWithSalt1,
liftHashWithSalt,
liftHashWithSalt2,
)
import Data.Semigroup
import GHC.Generics (Generic)
data T5 a b c d e
= T5 a b c d e
deriving stock (T5 a b c d e
T5 a b c d e -> T5 a b c d e -> Bounded (T5 a b c d e)
forall a. a -> a -> Bounded a
forall a b c d e.
(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) =>
T5 a b c d e
maxBound :: T5 a b c d e
$cmaxBound :: forall a b c d e.
(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) =>
T5 a b c d e
minBound :: T5 a b c d e
$cminBound :: forall a b c d e.
(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) =>
T5 a b c d e
Bounded, T5 a b c d e -> T5 a b c d e -> Bool
(T5 a b c d e -> T5 a b c d e -> Bool)
-> (T5 a b c d e -> T5 a b c d e -> Bool) -> Eq (T5 a b c d e)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall a b c d e.
(Eq a, Eq b, Eq c, Eq d, Eq e) =>
T5 a b c d e -> T5 a b c d e -> Bool
/= :: T5 a b c d e -> T5 a b c d e -> Bool
$c/= :: forall a b c d e.
(Eq a, Eq b, Eq c, Eq d, Eq e) =>
T5 a b c d e -> T5 a b c d e -> Bool
== :: T5 a b c d e -> T5 a b c d e -> Bool
$c== :: forall a b c d e.
(Eq a, Eq b, Eq c, Eq d, Eq e) =>
T5 a b c d e -> T5 a b c d e -> Bool
Eq, Eq (T5 a b c d e)
Eq (T5 a b c d e)
-> (T5 a b c d e -> T5 a b c d e -> Ordering)
-> (T5 a b c d e -> T5 a b c d e -> Bool)
-> (T5 a b c d e -> T5 a b c d e -> Bool)
-> (T5 a b c d e -> T5 a b c d e -> Bool)
-> (T5 a b c d e -> T5 a b c d e -> Bool)
-> (T5 a b c d e -> T5 a b c d e -> T5 a b c d e)
-> (T5 a b c d e -> T5 a b c d e -> T5 a b c d e)
-> Ord (T5 a b c d e)
T5 a b c d e -> T5 a b c d e -> Bool
T5 a b c d e -> T5 a b c d e -> Ordering
T5 a b c d e -> T5 a b c d e -> T5 a b c d e
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 c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
Eq (T5 a b c d e)
forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Bool
forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Ordering
forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> T5 a b c d e
min :: T5 a b c d e -> T5 a b c d e -> T5 a b c d e
$cmin :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> T5 a b c d e
max :: T5 a b c d e -> T5 a b c d e -> T5 a b c d e
$cmax :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> T5 a b c d e
>= :: T5 a b c d e -> T5 a b c d e -> Bool
$c>= :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Bool
> :: T5 a b c d e -> T5 a b c d e -> Bool
$c> :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Bool
<= :: T5 a b c d e -> T5 a b c d e -> Bool
$c<= :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Bool
< :: T5 a b c d e -> T5 a b c d e -> Bool
$c< :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Bool
compare :: T5 a b c d e -> T5 a b c d e -> Ordering
$ccompare :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
T5 a b c d e -> T5 a b c d e -> Ordering
$cp1Ord :: forall a b c d e.
(Ord a, Ord b, Ord c, Ord d, Ord e) =>
Eq (T5 a b c d e)
Ord, ReadPrec [T5 a b c d e]
ReadPrec (T5 a b c d e)
Int -> ReadS (T5 a b c d e)
ReadS [T5 a b c d e]
(Int -> ReadS (T5 a b c d e))
-> ReadS [T5 a b c d e]
-> ReadPrec (T5 a b c d e)
-> ReadPrec [T5 a b c d e]
-> Read (T5 a b c d e)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
ReadPrec [T5 a b c d e]
forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
ReadPrec (T5 a b c d e)
forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
Int -> ReadS (T5 a b c d e)
forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
ReadS [T5 a b c d e]
readListPrec :: ReadPrec [T5 a b c d e]
$creadListPrec :: forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
ReadPrec [T5 a b c d e]
readPrec :: ReadPrec (T5 a b c d e)
$creadPrec :: forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
ReadPrec (T5 a b c d e)
readList :: ReadS [T5 a b c d e]
$creadList :: forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
ReadS [T5 a b c d e]
readsPrec :: Int -> ReadS (T5 a b c d e)
$creadsPrec :: forall a b c d e.
(Read a, Read b, Read c, Read d, Read e) =>
Int -> ReadS (T5 a b c d e)
Read, Int -> T5 a b c d e -> ShowS
[T5 a b c d e] -> ShowS
T5 a b c d e -> String
(Int -> T5 a b c d e -> ShowS)
-> (T5 a b c d e -> String)
-> ([T5 a b c d e] -> ShowS)
-> Show (T5 a b c d e)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b c d e.
(Show a, Show b, Show c, Show d, Show e) =>
Int -> T5 a b c d e -> ShowS
forall a b c d e.
(Show a, Show b, Show c, Show d, Show e) =>
[T5 a b c d e] -> ShowS
forall a b c d e.
(Show a, Show b, Show c, Show d, Show e) =>
T5 a b c d e -> String
showList :: [T5 a b c d e] -> ShowS
$cshowList :: forall a b c d e.
(Show a, Show b, Show c, Show d, Show e) =>
[T5 a b c d e] -> ShowS
show :: T5 a b c d e -> String
$cshow :: forall a b c d e.
(Show a, Show b, Show c, Show d, Show e) =>
T5 a b c d e -> String
showsPrec :: Int -> T5 a b c d e -> ShowS
$cshowsPrec :: forall a b c d e.
(Show a, Show b, Show c, Show d, Show e) =>
Int -> T5 a b c d e -> ShowS
Show, (forall x. T5 a b c d e -> Rep (T5 a b c d e) x)
-> (forall x. Rep (T5 a b c d e) x -> T5 a b c d e)
-> Generic (T5 a b c d e)
forall x. Rep (T5 a b c d e) x -> T5 a b c d e
forall x. T5 a b c d e -> Rep (T5 a b c d e) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a b c d e x. Rep (T5 a b c d e) x -> T5 a b c d e
forall a b c d e x. T5 a b c d e -> Rep (T5 a b c d e) x
$cto :: forall a b c d e x. Rep (T5 a b c d e) x -> T5 a b c d e
$cfrom :: forall a b c d e x. T5 a b c d e -> Rep (T5 a b c d e) x
Generic)
deriving stock instance Foldable (T5 a b c d)
deriving stock instance Functor (T5 a b c d)
deriving stock instance Traversable (T5 a b c d)
instance (Eq a, Eq b, Eq c, Eq d) => Eq1 (T5 a b c d) where
liftEq :: (a -> b -> Bool) -> T5 a b c d a -> T5 a b c d b -> Bool
liftEq = (d -> d -> Bool)
-> (a -> b -> Bool) -> T5 a b c d a -> T5 a b c d b -> Bool
forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 d -> d -> Bool
forall a. Eq a => a -> a -> Bool
(==)
instance (Eq a, Eq b, Eq c) => Eq2 (T5 a b c) where
liftEq2 :: (a -> b -> Bool)
-> (c -> d -> Bool) -> T5 a b c a c -> T5 a b c b d -> Bool
liftEq2 a -> b -> Bool
e1 c -> d -> Bool
e2 (T5 a
a b
b c
c a
d c
e) (T5 a
a' b
b' c
c' b
d' d
e') =
a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a' Bool -> Bool -> Bool
&& b
b b -> b -> Bool
forall a. Eq a => a -> a -> Bool
== b
b' Bool -> Bool -> Bool
&& c
c c -> c -> Bool
forall a. Eq a => a -> a -> Bool
== c
c' Bool -> Bool -> Bool
&& a -> b -> Bool
e1 a
d b
d' Bool -> Bool -> Bool
&& c -> d -> Bool
e2 c
e d
e'
instance (Monoid a, Monoid b, Monoid c, Monoid d) => Applicative (T5 a b c d) where
pure :: a -> T5 a b c d a
pure a
e = a -> b -> c -> d -> a -> T5 a b c d a
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 a
forall a. Monoid a => a
mempty b
forall a. Monoid a => a
mempty c
forall a. Monoid a => a
mempty d
forall a. Monoid a => a
mempty a
e
T5 a
a b
b c
c d
d a -> b
f <*> :: T5 a b c d (a -> b) -> T5 a b c d a -> T5 a b c d b
<*> T5 a
a' b
b' c
c' d
d' a
e = a -> b -> c -> d -> b -> T5 a b c d b
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
a') (b
b b -> b -> b
forall a. Semigroup a => a -> a -> a
<> b
b') (c
c c -> c -> c
forall a. Semigroup a => a -> a -> a
<> c
c') (d
d d -> d -> d
forall a. Semigroup a => a -> a -> a
<> d
d') (a -> b
f a
e)
instance (Monoid a, Monoid b, Monoid c, Monoid d) => Monad (T5 a b c d) where
return :: a -> T5 a b c d a
return = a -> T5 a b c d a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
T5 a
a b
b c
c d
d a
e >>= :: T5 a b c d a -> (a -> T5 a b c d b) -> T5 a b c d b
>>= a -> T5 a b c d b
f = case a -> T5 a b c d b
f a
e of
T5 a
a' b
b' c
c' d
d' b
e' -> a -> b -> c -> d -> b -> T5 a b c d b
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
a') (b
b b -> b -> b
forall a. Semigroup a => a -> a -> a
<> b
b') (c
c c -> c -> c
forall a. Semigroup a => a -> a -> a
<> c
c') (d
d d -> d -> d
forall a. Semigroup a => a -> a -> a
<> d
d') b
e'
instance (Hashable a, Hashable b, Hashable c, Hashable d, Hashable e) => Hashable (T5 a b c d e) where
hash :: T5 a b c d e -> Int
hash (T5 a
a b
b c
c d
d e
e) = a -> Int
forall a. Hashable a => a -> Int
hash a
a Int -> b -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` b
b Int -> c -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` c
c Int -> d -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` d
d Int -> e -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` e
e
hashWithSalt :: Int -> T5 a b c d e -> Int
hashWithSalt = Int -> T5 a b c d e -> Int
forall (f :: * -> *) a.
(Hashable1 f, Hashable a) =>
Int -> f a -> Int
hashWithSalt1
instance (Hashable a, Hashable b, Hashable c, Hashable d) => Hashable1 (T5 a b c d) where
liftHashWithSalt :: (Int -> a -> Int) -> Int -> T5 a b c d a -> Int
liftHashWithSalt = (Int -> a -> Int) -> Int -> T5 a b c d a -> Int
forall (f :: * -> * -> *) a b.
(Hashable2 f, Hashable a) =>
(Int -> b -> Int) -> Int -> f a b -> Int
defaultLiftHashWithSalt
instance (Hashable a, Hashable b, Hashable c) => Hashable2 (T5 a b c) where
liftHashWithSalt2 :: (Int -> a -> Int)
-> (Int -> b -> Int) -> Int -> T5 a b c a b -> Int
liftHashWithSalt2 Int -> a -> Int
h1 Int -> b -> Int
h2 Int
slt (T5 a
a b
b c
c a
d b
e) =
(Int
slt Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
a Int -> b -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` b
b Int -> c -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` c
c) Int -> a -> Int
`h1` a
d Int -> b -> Int
`h2` b
e
instance (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (T5 a b c d e) where
mempty :: T5 a b c d e
mempty = a -> b -> c -> d -> e -> T5 a b c d e
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 a
forall a. Monoid a => a
mempty b
forall a. Monoid a => a
mempty c
forall a. Monoid a => a
mempty d
forall a. Monoid a => a
mempty e
forall a. Monoid a => a
mempty
instance (NFData a, NFData b, NFData c, NFData d, NFData e) => NFData (T5 a b c d e) where
rnf :: T5 a b c d e -> ()
rnf (T5 a
a b
b c
c d
d e
e) = a -> ()
forall a. NFData a => a -> ()
rnf a
a () -> () -> ()
`seq` b -> ()
forall a. NFData a => a -> ()
rnf b
b () -> () -> ()
`seq` c -> ()
forall a. NFData a => a -> ()
rnf c
c () -> () -> ()
`seq` d -> ()
forall a. NFData a => a -> ()
rnf d
d () -> () -> ()
`seq` e -> ()
forall a. NFData a => a -> ()
rnf e
e
instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (T5 a b c d e) where
T5 a
a1 b
b1 c
c1 d
d1 e
e1 <> :: T5 a b c d e -> T5 a b c d e -> T5 a b c d e
<> T5 a
a2 b
b2 c
c2 d
d2 e
e2 = a -> b -> c -> d -> e -> T5 a b c d e
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 (a
a1 a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
a2) (b
b1 b -> b -> b
forall a. Semigroup a => a -> a -> a
<> b
b2) (c
c1 c -> c -> c
forall a. Semigroup a => a -> a -> a
<> c
c2) (d
d1 d -> d -> d
forall a. Semigroup a => a -> a -> a
<> d
d2) (e
e1 e -> e -> e
forall a. Semigroup a => a -> a -> a
<> e
e2)
stimes :: b -> T5 a b c d e -> T5 a b c d e
stimes b
ii (T5 a
a b
b c
c d
d e
e) = a -> b -> c -> d -> e -> T5 a b c d e
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 (b -> a -> a
forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
ii a
a) (b -> b -> b
forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
ii b
b) (b -> c -> c
forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
ii c
c) (b -> d -> d
forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
ii d
d) (b -> e -> e
forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
ii e
e)
instance Bifunctor (T5 x y z) where
bimap :: (a -> b) -> (c -> d) -> T5 x y z a c -> T5 x y z b d
bimap a -> b
f c -> d
g (T5 x
x y
y z
z a
a c
b) = x -> y -> z -> b -> d -> T5 x y z b d
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 x
x y
y z
z (a -> b
f a
a) (c -> d
g c
b)
instance Bifoldable (T5 x y z) where
bifoldMap :: (a -> m) -> (b -> m) -> T5 x y z a b -> m
bifoldMap a -> m
f b -> m
g (T5 x
_ y
_ z
_ a
a b
b) = a -> m
f a
a m -> m -> m
forall a. Semigroup a => a -> a -> a
<> b -> m
g b
b
instance Bitraversable (T5 x y z) where
bitraverse :: (a -> f c) -> (b -> f d) -> T5 x y z a b -> f (T5 x y z c d)
bitraverse a -> f c
f b -> f d
g (T5 x
x y
y z
z a
a b
b) = x -> y -> z -> c -> d -> T5 x y z c d
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 x
x y
y z
z (c -> d -> T5 x y z c d) -> f c -> f (d -> T5 x y z c d)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f c
f a
a f (d -> T5 x y z c d) -> f d -> f (T5 x y z c d)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> b -> f d
g b
b