{-# language FlexibleContexts #-}
{-# language FlexibleInstances #-}
{-# language MultiParamTypeClasses #-}
{-# language TypeFamilies #-}
{-# language UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- |
-- Module       : Data.Tuple.Strict.Lens.Each
-- Copyright 	: (c) 2020-2021 Emily Pillmore
-- License	: BSD-style
--
-- Maintainer	: Emily Pillmore <emilypi@cohomolo.gy>
-- Stability	: Experimental
-- Portability	: TypeFamilies, UndecidableInstances, MPTC, FlexibleContexts
--
-- 'Control.Lens.Each.Each' instances for 'T1' through 'T9'
--
module Data.Tuple.Strict.Lens.Each
( Each(..)
) where


import Control.Lens

import Data.Tuple.Strict


instance (a~a') => Each (T1 a) (T1 a') a a' where
  each :: (a -> f a') -> T1 a -> f (T1 a')
each a -> f a'
f ~(T1 a
a) = a' -> T1 a'
forall a. a -> T1 a
T1 (a' -> T1 a') -> f a' -> f (T1 a')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a'
f a
a

instance (a~a', b~b') => Each (T2 a a') (T2 b b') a b where
  each :: (a -> f b) -> T2 a a' -> f (T2 b b')
each a -> f b
f ~(T2 a
a a'
b) = b -> b -> T2 b b
forall a b. a -> b -> T2 a b
T2 (b -> b -> T2 b b) -> f b -> f (b -> T2 b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> T2 b b) -> f b -> f (T2 b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a'
b
  {-# inline each #-}

instance (a~a2, a~a3, b~b2, b~b3) => Each (T3 a a2 a3) (T3 b b2 b3) a b where
  each :: (a -> f b) -> T3 a a2 a3 -> f (T3 b b2 b3)
each a -> f b
f ~(T3 a
a a2
b a3
c) = b -> b -> b -> T3 b b b
forall a b c. a -> b -> c -> T3 a b c
T3 (b -> b -> b -> T3 b b b) -> f b -> f (b -> b -> T3 b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> T3 b b b) -> f b -> f (b -> T3 b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> T3 b b b) -> f b -> f (T3 b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c
  {-# inline each #-}

instance (a~a2, a~a3, a~a4, b~b2, b~b3, b~b4) => Each (T4 a a2 a3 a4) (T4 b b2 b3 b4) a b where
  each :: (a -> f b) -> T4 a a2 a3 a4 -> f (T4 b b2 b3 b4)
each a -> f b
f ~(T4 a
a a2
b a3
c a4
d) = b -> b -> b -> b -> T4 b b b b
forall a b c d. a -> b -> c -> d -> T4 a b c d
T4 (b -> b -> b -> b -> T4 b b b b)
-> f b -> f (b -> b -> b -> T4 b b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> T4 b b b b) -> f b -> f (b -> b -> T4 b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> b -> T4 b b b b) -> f b -> f (b -> T4 b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c f (b -> T4 b b b b) -> f b -> f (T4 b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a4
d
  {-# inline each #-}

instance (a~a2, a~a3, a~a4, a~a5, b~b2, b~b3, b~b4, b~b5) => Each (T5 a a2 a3 a4 a5) (T5 b b2 b3 b4 b5) a b where
  each :: (a -> f b) -> T5 a a2 a3 a4 a5 -> f (T5 b b2 b3 b4 b5)
each a -> f b
f ~(T5 a
a a2
b a3
c a4
d a5
e) = b -> b -> b -> b -> b -> T5 b b b b b
forall a b c d e. a -> b -> c -> d -> e -> T5 a b c d e
T5 (b -> b -> b -> b -> b -> T5 b b b b b)
-> f b -> f (b -> b -> b -> b -> T5 b b b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> b -> T5 b b b b b)
-> f b -> f (b -> b -> b -> T5 b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> b -> b -> T5 b b b b b)
-> f b -> f (b -> b -> T5 b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c f (b -> b -> T5 b b b b b) -> f b -> f (b -> T5 b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a4
d f (b -> T5 b b b b b) -> f b -> f (T5 b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a5
e
  {-# inline each #-}

instance (a~a2, a~a3, a~a4, a~a5, a~a6, b~b2, b~b3, b~b4, b~b5, b~b6) => Each (T6 a a2 a3 a4 a5 a6) (T6 b b2 b3 b4 b5 b6) a b where
  each :: (a -> f b) -> T6 a a2 a3 a4 a5 a6 -> f (T6 b b2 b3 b4 b5 b6)
each a -> f b
f ~(T6 a
a a2
b a3
c a4
d a5
e a6
g) = b -> b -> b -> b -> b -> b -> T6 b b b b b b
forall a b c d e f. a -> b -> c -> d -> e -> f -> T6 a b c d e f
T6 (b -> b -> b -> b -> b -> b -> T6 b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> T6 b b b b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> b -> b -> T6 b b b b b b)
-> f b -> f (b -> b -> b -> b -> T6 b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> b -> b -> b -> T6 b b b b b b)
-> f b -> f (b -> b -> b -> T6 b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c f (b -> b -> b -> T6 b b b b b b)
-> f b -> f (b -> b -> T6 b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a4
d f (b -> b -> T6 b b b b b b) -> f b -> f (b -> T6 b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a5
e f (b -> T6 b b b b b b) -> f b -> f (T6 b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a6
g
  {-# inline each #-}

instance (a~a2, a~a3, a~a4, a~a5, a~a6, a~a7, b~b2, b~b3, b~b4, b~b5, b~b6, b~b7) => Each (T7 a a2 a3 a4 a5 a6 a7) (T7 b b2 b3 b4 b5 b6 b7) a b where
  each :: (a -> f b) -> T7 a a2 a3 a4 a5 a6 a7 -> f (T7 b b2 b3 b4 b5 b6 b7)
each a -> f b
f ~(T7 a
a a2
b a3
c a4
d a5
e a6
g a7
h) = b -> b -> b -> b -> b -> b -> b -> T7 b b b b b b b
forall a b c d e f g.
a -> b -> c -> d -> e -> f -> g -> T7 a b c d e f g
T7 (b -> b -> b -> b -> b -> b -> b -> T7 b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> b -> T7 b b b b b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> b -> b -> b -> T7 b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> T7 b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> b -> b -> b -> b -> T7 b b b b b b b)
-> f b -> f (b -> b -> b -> b -> T7 b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c f (b -> b -> b -> b -> T7 b b b b b b b)
-> f b -> f (b -> b -> b -> T7 b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a4
d f (b -> b -> b -> T7 b b b b b b b)
-> f b -> f (b -> b -> T7 b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a5
e f (b -> b -> T7 b b b b b b b) -> f b -> f (b -> T7 b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a6
g f (b -> T7 b b b b b b b) -> f b -> f (T7 b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a7
h
  {-# inline each #-}

instance (a~a2, a~a3, a~a4, a~a5, a~a6, a~a7, a~a8, b~b2, b~b3, b~b4, b~b5, b~b6, b~b7, b~b8) => Each (T8 a a2 a3 a4 a5 a6 a7 a8) (T8 b b2 b3 b4 b5 b6 b7 b8) a b where
  each :: (a -> f b)
-> T8 a a2 a3 a4 a5 a6 a7 a8 -> f (T8 b b2 b3 b4 b5 b6 b7 b8)
each a -> f b
f ~(T8 a
a a2
b a3
c a4
d a5
e a6
g a7
h a8
i) = b -> b -> b -> b -> b -> b -> b -> b -> T8 b b b b b b b b
forall a b c d e f g h.
a -> b -> c -> d -> e -> f -> g -> h -> T8 a b c d e f g h
T8 (b -> b -> b -> b -> b -> b -> b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> b -> b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> b -> b -> b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> b -> b -> b -> b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c f (b -> b -> b -> b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a4
d f (b -> b -> b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> b -> b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a5
e f (b -> b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a6
g f (b -> b -> T8 b b b b b b b b)
-> f b -> f (b -> T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a7
h f (b -> T8 b b b b b b b b) -> f b -> f (T8 b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a8
i
  {-# inline each #-}

instance (a~a2, a~a3, a~a4, a~a5, a~a6, a~a7, a~a8, a~a9, b~b2, b~b3, b~b4, b~b5, b~b6, b~b7, b~b8, b~b9) => Each (T9 a a2 a3 a4 a5 a6 a7 a8 a9) (T9 b b2 b3 b4 b5 b6 b7 b8 b9) a b where
  each :: (a -> f b)
-> T9 a a2 a3 a4 a5 a6 a7 a8 a9 -> f (T9 b b2 b3 b4 b5 b6 b7 b8 b9)
each a -> f b
f ~(T9 a
a a2
b a3
c a4
d a5
e a6
g a7
h a8
i a9
j) = b -> b -> b -> b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b
forall a b c d e f g h i.
a -> b -> c -> d -> e -> f -> g -> h -> i -> T9 a b c d e f g h i
T9 (b -> b -> b -> b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
-> f b
-> f (b -> b -> b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
-> f b
-> f (b -> b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a2
b f (b -> b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a3
c f (b -> b -> b -> b -> b -> b -> T9 b b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a4
d f (b -> b -> b -> b -> b -> T9 b b b b b b b b b)
-> f b -> f (b -> b -> b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a5
e f (b -> b -> b -> b -> T9 b b b b b b b b b)
-> f b -> f (b -> b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a6
g f (b -> b -> b -> T9 b b b b b b b b b)
-> f b -> f (b -> b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a7
h f (b -> b -> T9 b b b b b b b b b)
-> f b -> f (b -> T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a8
i f (b -> T9 b b b b b b b b b) -> f b -> f (T9 b b b b b b b b b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
a9
j
  {-# inline each #-}