{-# LANGUAGE DerivingVia #-}
module Data.HBifunctor.Associative (
  
    Associative(..)
  , assoc
  , disassoc
  
  , SemigroupIn(..)
  , matchingNE
  , retractNE
  , interpretNE
  
  , biget
  , biapply
  , (!*!)
  , (!$!)
  , (!+!)
  , WrapHBF(..)
  , WrapNE(..)
  ) where
import           Control.Applicative.ListF
import           Control.Applicative.Step
import           Control.Monad.Freer.Church
import           Control.Monad.Trans.Compose
import           Control.Monad.Trans.Identity
import           Control.Natural
import           Control.Natural.IsoF
import           Data.Bifunctor
import           Data.Bifunctor.Joker
import           Data.Coerce
import           Data.Constraint.Trivial
import           Data.Data
import           Data.Foldable
import           Data.Functor.Apply.Free
import           Data.Functor.Bind
import           Data.Functor.Classes
import           Data.Functor.Contravariant
import           Data.Functor.Contravariant.Decide
import           Data.Functor.Contravariant.Divise
import           Data.Functor.Contravariant.Divisible.Free
import           Data.Functor.Contravariant.Night          (Night(..))
import           Data.Functor.Day                          (Day(..))
import           Data.Functor.Identity
import           Data.Functor.Invariant
import           Data.Functor.Invariant.Inplicative
import           Data.Functor.Invariant.Internative
import           Data.Functor.Plus
import           Data.Functor.Product
import           Data.Functor.Sum
import           Data.Functor.These
import           Data.HBifunctor
import           Data.HFunctor
import           Data.HFunctor.Chain.Internal
import           Data.HFunctor.Internal
import           Data.HFunctor.Interpret
import           Data.Kind
import           Data.List.NonEmpty                        (NonEmpty(..))
import           Data.Void
import           GHC.Generics
import qualified Data.Bifunctor.Assoc                      as B
import qualified Data.Functor.Contravariant.Coyoneda       as CCY
import qualified Data.Functor.Contravariant.Day            as CD
import qualified Data.Functor.Contravariant.Night          as N
import qualified Data.Functor.Day                          as D
import qualified Data.Functor.Invariant.Day                as ID
import qualified Data.Functor.Invariant.Night              as IN
import qualified Data.Map.NonEmpty                         as NEM
class (HBifunctor t, Inject (NonEmptyBy t)) => Associative t where
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    type NonEmptyBy t :: (Type -> Type) -> Type -> Type
    
    
    
    
    
    type FunctorBy t :: (Type -> Type) -> Constraint
    type FunctorBy t = Unconstrained
    
    
    associating
        :: (FunctorBy t f, FunctorBy t g, FunctorBy t h)
        => t f (t g h) <~> t (t f g) h
    
    
    
    
    
    
    appendNE :: t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
    
    
    
    
    
    
    
    matchNE  :: FunctorBy t f => NonEmptyBy t f ~> f :+: t f (NonEmptyBy t f)
    
    consNE :: t f (NonEmptyBy t f) ~> NonEmptyBy t f
    consNE = t (NonEmptyBy t f) (NonEmptyBy t f) x -> NonEmptyBy t f x
forall (f :: * -> *).
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
appendNE (t (NonEmptyBy t f) (NonEmptyBy t f) x -> NonEmptyBy t f x)
-> (t f (NonEmptyBy t f) x
    -> t (NonEmptyBy t f) (NonEmptyBy t f) x)
-> t f (NonEmptyBy t f) x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> NonEmptyBy t f)
-> t f (NonEmptyBy t f) ~> t (NonEmptyBy t f) (NonEmptyBy t f)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> t f g ~> t j g
hleft f x -> NonEmptyBy t f x
f ~> NonEmptyBy t f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> NonEmptyBy t f
inject
    
    toNonEmptyBy :: t f f ~> NonEmptyBy t f
    toNonEmptyBy = t f (NonEmptyBy t f) x -> NonEmptyBy t f x
forall (f :: * -> *). t f (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE (t f (NonEmptyBy t f) x -> NonEmptyBy t f x)
-> (t f f x -> t f (NonEmptyBy t f) x)
-> t f f x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> NonEmptyBy t f) -> t f f ~> t f (NonEmptyBy t f)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> t f g ~> t f l
hright f x -> NonEmptyBy t f x
f ~> NonEmptyBy t f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> NonEmptyBy t f
inject
    {-# MINIMAL associating, appendNE, matchNE #-}
assoc
    :: (Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h)
    => t f (t g h)
    ~> t (t f g) h
assoc :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) ~> t (t f g) h
assoc = (t f (t g h) <~> t (t f g) h) -> t f (t g h) ~> t (t f g) h
forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> f ~> g
viewF p (t (t f g) h a) (t (t f g) h a)
-> p (t f (t g h) a) (t f (t g h) a)
forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) <~> t (t f g) h
t f (t g h) <~> t (t f g) h
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) <~> t (t f g) h
associating
disassoc
    :: (Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h)
    => t (t f g) h
    ~> t f (t g h)
disassoc :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t (t f g) h ~> t f (t g h)
disassoc = (t f (t g h) <~> t (t f g) h) -> t (t f g) h ~> t f (t g h)
forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> g ~> f
reviewF p (t (t f g) h a) (t (t f g) h a)
-> p (t f (t g h) a) (t f (t g h) a)
forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) <~> t (t f g) h
t f (t g h) <~> t (t f g) h
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) <~> t (t f g) h
associating
class (Associative t, FunctorBy t f) => SemigroupIn t f where
    
    
    
    
    
    biretract :: t f f ~> f
    default biretract :: Interpret (NonEmptyBy t) f => t f f ~> f
    biretract = NonEmptyBy t f x -> f x
NonEmptyBy t f ~> f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Interpret t f =>
t f ~> f
retract (NonEmptyBy t f x -> f x)
-> (t f f x -> NonEmptyBy t f x) -> t f f x -> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t f (NonEmptyBy t f) x -> NonEmptyBy t f x
forall (f :: * -> *). t f (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE (t f (NonEmptyBy t f) x -> NonEmptyBy t f x)
-> (t f f x -> t f (NonEmptyBy t f) x)
-> t f f x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> NonEmptyBy t f) -> t f f ~> t f (NonEmptyBy t f)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> t f g ~> t f l
hright f x -> NonEmptyBy t f x
f ~> NonEmptyBy t f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> NonEmptyBy t f
inject
    
    
    
    
    
    
    
    
    binterpret
        :: g ~> f
        -> h ~> f
        -> t g h ~> f
    default binterpret :: Interpret (NonEmptyBy t) f => (g ~> f) -> (h ~> f) -> t g h ~> f
    binterpret g ~> f
f h ~> f
g = NonEmptyBy t f x -> f x
NonEmptyBy t f ~> f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Interpret t f =>
t f ~> f
retract (NonEmptyBy t f x -> f x)
-> (t g h x -> NonEmptyBy t f x) -> t g h x -> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t f f x -> NonEmptyBy t f x
forall (f :: * -> *). t f f ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f f ~> NonEmptyBy t f
toNonEmptyBy (t f f x -> NonEmptyBy t f x)
-> (t g h x -> t f f x) -> t g h x -> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (g ~> f) -> (h ~> f) -> t g h ~> t f f
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> t f g ~> t j l
hbimap g x -> f x
g ~> f
f h x -> f x
h ~> f
g
retractNE :: forall t f. SemigroupIn t f => NonEmptyBy t f ~> f
retractNE :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
NonEmptyBy t f ~> f
retractNE = (f x -> f x
forall a. a -> a
forall {x}. f x -> f x
id (forall {x}. f x -> f x)
-> (t f (NonEmptyBy t f) ~> f) -> (f :+: t f (NonEmptyBy t f)) ~> f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (h :: * -> *)
       (f :: * -> *) (g :: * -> *).
SemigroupIn t h =>
(f ~> h) -> (g ~> h) -> t f g ~> h
!*! forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
t f f ~> f
biretract @t (t f f x -> f x)
-> (t f (NonEmptyBy t f) x -> t f f x)
-> t f (NonEmptyBy t f) x
-> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonEmptyBy t f ~> f) -> t f (NonEmptyBy t f) ~> t f f
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> t f g ~> t f l
hright (forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
NonEmptyBy t f ~> f
retractNE @t))
          ((:+:) f (t f (NonEmptyBy t f)) x -> f x)
-> (NonEmptyBy t f x -> (:+:) f (t f (NonEmptyBy t f)) x)
-> NonEmptyBy t f x
-> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
(Associative t, FunctorBy t f) =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
matchNE @t
interpretNE :: forall t g f. SemigroupIn t f => (g ~> f) -> NonEmptyBy t g ~> f
interpretNE :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (g :: * -> *)
       (f :: * -> *).
SemigroupIn t f =>
(g ~> f) -> NonEmptyBy t g ~> f
interpretNE g ~> f
f = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
NonEmptyBy t f ~> f
retractNE @t (NonEmptyBy t f x -> f x)
-> (NonEmptyBy t g x -> NonEmptyBy t f x)
-> NonEmptyBy t g x
-> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (g ~> f) -> NonEmptyBy t g ~> NonEmptyBy t f
forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
       (g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> NonEmptyBy t f ~> NonEmptyBy t g
hmap g x -> f x
g ~> f
f
matchingNE :: (Associative t, FunctorBy t f) => NonEmptyBy t f <~> f :+: t f (NonEmptyBy t f)
matchingNE :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
(Associative t, FunctorBy t f) =>
NonEmptyBy t f <~> (f :+: t f (NonEmptyBy t f))
matchingNE = (NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f)))
-> ((f :+: t f (NonEmptyBy t f)) ~> NonEmptyBy t f)
-> NonEmptyBy t f <~> (f :+: t f (NonEmptyBy t f))
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF NonEmptyBy t f x -> (:+:) f (t f (NonEmptyBy t f)) x
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
forall (f :: * -> *).
FunctorBy t f =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
(Associative t, FunctorBy t f) =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
matchNE (f x -> NonEmptyBy t f x
forall {x}. f x -> NonEmptyBy t f x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> NonEmptyBy t f
inject (forall {x}. f x -> NonEmptyBy t f x)
-> (t f (NonEmptyBy t f) ~> NonEmptyBy t f)
-> (f :+: t f (NonEmptyBy t f)) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (h :: * -> *)
       (f :: * -> *) (g :: * -> *).
SemigroupIn t h =>
(f ~> h) -> (g ~> h) -> t f g ~> h
!*! t f (NonEmptyBy t f) x -> NonEmptyBy t f x
t f (NonEmptyBy t f) ~> NonEmptyBy t f
forall (f :: * -> *). t f (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE)
biget
    :: SemigroupIn t (AltConst b)
    => (forall x. f x -> b)
    -> (forall x. g x -> b)
    -> t f g a
    -> b
biget :: forall (t :: (* -> *) -> (* -> *) -> * -> *) b (f :: * -> *)
       (g :: * -> *) a.
SemigroupIn t (AltConst b) =>
(forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b
biget forall x. f x -> b
f forall x. g x -> b
g = AltConst b a -> b
forall {k} w (a :: k). AltConst w a -> w
getAltConst (AltConst b a -> b) -> (t f g a -> AltConst b a) -> t f g a -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> AltConst b) -> (g ~> AltConst b) -> t f g ~> AltConst b
forall (g :: * -> *) (h :: * -> *).
(g ~> AltConst b) -> (h ~> AltConst b) -> t g h ~> AltConst b
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
SemigroupIn t f =>
(g ~> f) -> (h ~> f) -> t g h ~> f
binterpret (b -> AltConst b x
forall {k} w (a :: k). w -> AltConst w a
AltConst (b -> AltConst b x) -> (f x -> b) -> f x -> AltConst b x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> b
forall x. f x -> b
f) (b -> AltConst b x
forall {k} w (a :: k). w -> AltConst w a
AltConst (b -> AltConst b x) -> (g x -> b) -> g x -> AltConst b x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g x -> b
forall x. g x -> b
g)
(!$!)
    :: SemigroupIn t (AltConst b)
    => (forall x. f x -> b)
    -> (forall x. g x -> b)
    -> t f g a
    -> b
!$! :: forall (t :: (* -> *) -> (* -> *) -> * -> *) b (f :: * -> *)
       (g :: * -> *) a.
SemigroupIn t (AltConst b) =>
(forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b
(!$!) = (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b
forall (t :: (* -> *) -> (* -> *) -> * -> *) b (f :: * -> *)
       (g :: * -> *) a.
SemigroupIn t (AltConst b) =>
(forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b
biget
infixr 5 !$!
(!*!)
    :: SemigroupIn t h
    => (f ~> h)
    -> (g ~> h)
    -> t f g
    ~> h
!*! :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (h :: * -> *)
       (f :: * -> *) (g :: * -> *).
SemigroupIn t h =>
(f ~> h) -> (g ~> h) -> t f g ~> h
(!*!) = (f ~> h) -> (g ~> h) -> t f g x -> h x
(f ~> h) -> (g ~> h) -> t f g ~> h
forall (g :: * -> *) (h :: * -> *).
(g ~> h) -> (h ~> h) -> t g h ~> h
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
SemigroupIn t f =>
(g ~> f) -> (h ~> f) -> t g h ~> f
binterpret
infixr 5 !*!
(!+!)
    :: (f ~> h)
    -> (g ~> h)
    -> (f :+: g)
    ~> h
!+! :: forall {k} (f :: k -> *) (h :: k -> *) (g :: k -> *).
(f ~> h) -> (g ~> h) -> (f :+: g) ~> h
(!+!) f ~> h
f g ~> h
g = \case
    L1 f x
x -> f x -> h x
f ~> h
f f x
x
    R1 g x
y -> g x -> h x
g ~> h
g g x
y
infixr 5 !+!
biapply
    :: SemigroupIn t (Op b)
    => (forall x. f x -> x -> b)
    -> (forall x. g x -> x -> b)
    -> t f g a
    -> a
    -> b
biapply :: forall (t :: (* -> *) -> (* -> *) -> * -> *) b (f :: * -> *)
       (g :: * -> *) a.
SemigroupIn t (Op b) =>
(forall x. f x -> x -> b)
-> (forall x. g x -> x -> b) -> t f g a -> a -> b
biapply forall x. f x -> x -> b
f forall x. g x -> x -> b
g = Op b a -> a -> b
forall a b. Op a b -> b -> a
getOp (Op b a -> a -> b) -> (t f g a -> Op b a) -> t f g a -> a -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> Op b) -> (g ~> Op b) -> t f g ~> Op b
forall (g :: * -> *) (h :: * -> *).
(g ~> Op b) -> (h ~> Op b) -> t g h ~> Op b
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
SemigroupIn t f =>
(g ~> f) -> (h ~> f) -> t g h ~> f
binterpret ((x -> b) -> Op b x
forall a b. (b -> a) -> Op a b
Op ((x -> b) -> Op b x) -> (f x -> x -> b) -> f x -> Op b x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> x -> b
forall x. f x -> x -> b
f) ((x -> b) -> Op b x
forall a b. (b -> a) -> Op a b
Op ((x -> b) -> Op b x) -> (g x -> x -> b) -> g x -> Op b x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g x -> x -> b
forall x. g x -> x -> b
g)
instance Associative (:*:) where
    type NonEmptyBy (:*:) = NonEmptyF
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy (:*:) f, FunctorBy (:*:) g, FunctorBy (:*:) h) =>
(f :*: (g :*: h)) <~> ((f :*: g) :*: h)
associating = ((f :*: (g :*: h)) ~> ((f :*: g) :*: h))
-> (((f :*: g) :*: h) ~> (f :*: (g :*: h)))
-> (f :*: (g :*: h)) <~> ((f :*: g) :*: h)
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (:*:) f (g :*: h) x -> (:*:) (f :*: g) h x
(f :*: (g :*: h)) ~> ((f :*: g) :*: h)
forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {p :: k}.
(:*:) f (g :*: g) p -> (:*:) (f :*: g) g p
to_ (:*:) (f :*: g) h x -> (:*:) f (g :*: h) x
((f :*: g) :*: h) ~> (f :*: (g :*: h))
forall {k} {f :: k -> *} {f :: k -> *} {g :: k -> *} {p :: k}.
(:*:) (f :*: f) g p -> (:*:) f (f :*: g) p
from_
      where
        to_ :: (:*:) f (g :*: g) p -> (:*:) (f :*: g) g p
to_   (f p
x :*: (g p
y :*: g p
z)) = (f p
x f p -> g p -> (:*:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g p
y) (:*:) f g p -> g p -> (:*:) (f :*: g) g p
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g p
z
        from_ :: (:*:) (f :*: f) g p -> (:*:) f (f :*: g) p
from_ ((f p
x :*: f p
y) :*: g p
z) = f p
x f p -> (:*:) f g p -> (:*:) f (f :*: g) p
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (f p
y f p -> g p -> (:*:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g p
z)
    appendNE :: forall (f :: * -> *).
(NonEmptyBy (:*:) f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f
appendNE (NonEmptyF NonEmpty (f x)
xs :*: NonEmptyF NonEmpty (f x)
ys) = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x)
xs NonEmpty (f x) -> NonEmpty (f x) -> NonEmpty (f x)
forall a. Semigroup a => a -> a -> a
<> NonEmpty (f x)
ys)
    matchNE :: forall (f :: * -> *).
FunctorBy (:*:) f =>
NonEmptyBy (:*:) f ~> (f :+: (f :*: NonEmptyBy (:*:) f))
matchNE NonEmptyBy (:*:) f x
x = case (:+:) Proxy (NonEmptyF f) x
ys of
        L1 ~Proxy x
Proxy -> f x -> (:+:) f (f :*: NonEmptyF f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
y
        R1 NonEmptyF f x
zs     -> (:*:) f (NonEmptyBy (:*:) f) x
-> (:+:) f (f :*: NonEmptyBy (:*:) f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 ((:*:) f (NonEmptyBy (:*:) f) x
 -> (:+:) f (f :*: NonEmptyBy (:*:) f) x)
-> (:*:) f (NonEmptyBy (:*:) f) x
-> (:+:) f (f :*: NonEmptyBy (:*:) f) x
forall a b. (a -> b) -> a -> b
$ f x
y f x -> NonEmptyF f x -> (:*:) f (NonEmptyF f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: NonEmptyF f x
zs
      where
        f x
y :*: (:+:) Proxy (NonEmptyF f) x
ys = ListF f x -> (:+:) Proxy (NonEmptyF f) x
forall {x}. ListF f x -> (:+:) Proxy (NonEmptyF f) x
forall {k} (f :: k -> *) (x :: k).
ListF f x -> (:+:) Proxy (NonEmptyF f) x
fromListF (forall {x}. ListF f x -> (:+:) Proxy (NonEmptyF f) x)
-> (f :*: ListF f) ~> (f :*: (Proxy :+: NonEmptyF f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> (f :*: g) ~> (f :*: l)
`hright` NonEmptyF f x -> (:*:) f (ListF f) x
forall {k} (f :: k -> *) (a :: k).
NonEmptyF f a -> (:*:) f (ListF f) a
nonEmptyProd NonEmptyF f x
NonEmptyBy (:*:) f x
x
    consNE :: forall (f :: * -> *).
(f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f
consNE (f x
x :*: NonEmptyF NonEmpty (f x)
xs) = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x) -> NonEmptyF f x)
-> NonEmpty (f x) -> NonEmptyF f x
forall a b. (a -> b) -> a -> b
$ f x
x f x -> [f x] -> NonEmpty (f x)
forall a. a -> [a] -> NonEmpty a
:| NonEmpty (f x) -> [f x]
forall a. NonEmpty a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList NonEmpty (f x)
xs
    toNonEmptyBy :: forall (f :: * -> *). (f :*: f) ~> NonEmptyBy (:*:) f
toNonEmptyBy   (f x
x :*: f x
y           ) = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x) -> NonEmptyF f x)
-> NonEmpty (f x) -> NonEmptyF f x
forall a b. (a -> b) -> a -> b
$ f x
x f x -> [f x] -> NonEmpty (f x)
forall a. a -> [a] -> NonEmpty a
:| [f x
y]
instance Alt f => SemigroupIn (:*:) f where
    biretract :: (f :*: f) ~> f
biretract (f x
x :*: f x
y) = f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> (g :*: h) ~> f
binterpret g ~> f
f h ~> f
g (g x
x :*: h x
y) = g x -> f x
g ~> f
f g x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> h x -> f x
h ~> f
g h x
y
instance Associative Product where
    type NonEmptyBy Product = NonEmptyF
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Product f, FunctorBy Product g, FunctorBy Product h) =>
Product f (Product g h) <~> Product (Product f g) h
associating = (Product f (Product g h) ~> Product (Product f g) h)
-> (Product (Product f g) h ~> Product f (Product g h))
-> Product f (Product g h) <~> Product (Product f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Product f (Product g h) x -> Product (Product f g) h x
Product f (Product g h) ~> Product (Product f g) h
forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {a :: k}.
Product f (Product g g) a -> Product (Product f g) g a
to_ Product (Product f g) h x -> Product f (Product g h) x
Product (Product f g) h ~> Product f (Product g h)
forall {k} {f :: k -> *} {f :: k -> *} {g :: k -> *} {a :: k}.
Product (Product f f) g a -> Product f (Product f g) a
from_
      where
        to_ :: Product f (Product g g) a -> Product (Product f g) g a
to_   (Pair f a
x (Pair g a
y g a
z)) = Product f g a -> g a -> Product (Product f g) g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a -> g a -> Product f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f a
x g a
y) g a
z
        from_ :: Product (Product f f) g a -> Product f (Product f g) a
from_ (Pair (Pair f a
x f a
y) g a
z) = f a -> Product f g a -> Product f (Product f g) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f a
x (f a -> g a -> Product f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f a
y g a
z)
    appendNE :: forall (f :: * -> *).
Product (NonEmptyBy Product f) (NonEmptyBy Product f)
~> NonEmptyBy Product f
appendNE (NonEmptyF NonEmpty (f x)
xs `Pair` NonEmptyF NonEmpty (f x)
ys) = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x)
xs NonEmpty (f x) -> NonEmpty (f x) -> NonEmpty (f x)
forall a. Semigroup a => a -> a -> a
<> NonEmpty (f x)
ys)
    matchNE :: forall (f :: * -> *).
FunctorBy Product f =>
NonEmptyBy Product f ~> (f :+: Product f (NonEmptyBy Product f))
matchNE NonEmptyBy Product f x
x = case (:+:) Proxy (NonEmptyF f) x
ys of
        L1 ~Proxy x
Proxy -> f x -> (:+:) f (Product f (NonEmptyF f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
y
        R1 NonEmptyF f x
zs     -> Product f (NonEmptyBy Product f) x
-> (:+:) f (Product f (NonEmptyBy Product f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Product f (NonEmptyBy Product f) x
 -> (:+:) f (Product f (NonEmptyBy Product f)) x)
-> Product f (NonEmptyBy Product f) x
-> (:+:) f (Product f (NonEmptyBy Product f)) x
forall a b. (a -> b) -> a -> b
$ f x -> NonEmptyF f x -> Product f (NonEmptyF f) x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f x
y NonEmptyF f x
zs
      where
        f x
y :*: (:+:) Proxy (NonEmptyF f) x
ys = ListF f x -> (:+:) Proxy (NonEmptyF f) x
forall {x}. ListF f x -> (:+:) Proxy (NonEmptyF f) x
forall {k} (f :: k -> *) (x :: k).
ListF f x -> (:+:) Proxy (NonEmptyF f) x
fromListF (forall {x}. ListF f x -> (:+:) Proxy (NonEmptyF f) x)
-> (f :*: ListF f) ~> (f :*: (Proxy :+: NonEmptyF f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> (f :*: g) ~> (f :*: l)
`hright` NonEmptyF f x -> (:*:) f (ListF f) x
forall {k} (f :: k -> *) (a :: k).
NonEmptyF f a -> (:*:) f (ListF f) a
nonEmptyProd NonEmptyF f x
NonEmptyBy Product f x
x
    consNE :: forall (f :: * -> *).
Product f (NonEmptyBy Product f) ~> NonEmptyBy Product f
consNE (f x
x `Pair` NonEmptyF NonEmpty (f x)
xs) = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x) -> NonEmptyF f x)
-> NonEmpty (f x) -> NonEmptyF f x
forall a b. (a -> b) -> a -> b
$ f x
x f x -> [f x] -> NonEmpty (f x)
forall a. a -> [a] -> NonEmpty a
:| NonEmpty (f x) -> [f x]
forall a. NonEmpty a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList NonEmpty (f x)
xs
    toNonEmptyBy :: forall (f :: * -> *). Product f f ~> NonEmptyBy Product f
toNonEmptyBy   (f x
x `Pair` f x
y           ) = NonEmpty (f x) -> NonEmptyF f x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x) -> NonEmptyF f x)
-> NonEmpty (f x) -> NonEmptyF f x
forall a b. (a -> b) -> a -> b
$ f x
x f x -> [f x] -> NonEmpty (f x)
forall a. a -> [a] -> NonEmpty a
:| [f x
y]
instance Alt f => SemigroupIn Product f where
    biretract :: Product f f ~> f
biretract (Pair f x
x f x
y) = f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Product g h ~> f
binterpret g ~> f
f h ~> f
g (Pair g x
x h x
y) = g x -> f x
g ~> f
f g x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> h x -> f x
h ~> f
g h x
y
instance Associative Day where
    type NonEmptyBy Day = Ap1
    type FunctorBy Day = Functor
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Day f, FunctorBy Day g, FunctorBy Day h) =>
Day f (Day g h) <~> Day (Day f g) h
associating = (Day f (Day g h) ~> Day (Day f g) h)
-> (Day (Day f g) h ~> Day f (Day g h))
-> Day f (Day g h) <~> Day (Day f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Day f (Day g h) x -> Day (Day f g) h x
Day f (Day g h) ~> Day (Day f g) h
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
Day f (Day g h) a -> Day (Day f g) h a
D.assoc Day (Day f g) h x -> Day f (Day g h) x
Day (Day f g) h ~> Day f (Day g h)
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
Day (Day f g) h a -> Day f (Day g h) a
D.disassoc
    appendNE :: forall (f :: * -> *).
Day (NonEmptyBy Day f) (NonEmptyBy Day f) ~> NonEmptyBy Day f
appendNE (Day NonEmptyBy Day f b
x NonEmptyBy Day f c
y b -> c -> x
z) = b -> c -> x
z (b -> c -> x) -> Ap1 f b -> Ap1 f (c -> x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ap1 f b
NonEmptyBy Day f b
x Ap1 f (c -> x) -> Ap1 f c -> Ap1 f x
forall a b. Ap1 f (a -> b) -> Ap1 f a -> Ap1 f b
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> Ap1 f c
NonEmptyBy Day f c
y
    matchNE :: forall (f :: * -> *).
FunctorBy Day f =>
NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f))
matchNE NonEmptyBy Day f x
a = case Ap f x -> (:+:) Identity (Ap1 f) x
forall {x}. Ap f x -> (:+:) Identity (Ap1 f) x
forall (f :: * -> *) x. Ap f x -> (:+:) Identity (Ap1 f) x
fromAp (forall {x}. Ap f x -> (:+:) Identity (Ap1 f) x)
-> Day f (Ap f) ~> Day f (Identity :+: Ap1 f)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> Day f g ~> Day f l
`hright` Ap1 f x -> Day f (Ap f) x
forall (f :: * -> *) a. Ap1 f a -> Day f (Ap f) a
ap1Day Ap1 f x
NonEmptyBy Day f x
a of
      Day f b
x (:+:) Identity (Ap1 f) c
y b -> c -> x
z -> case (:+:) Identity (Ap1 f) c
y of
        L1 (Identity c
y') -> f x -> (:+:) f (Day f (NonEmptyBy Day f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (f x -> (:+:) f (Day f (NonEmptyBy Day f)) x)
-> f x -> (:+:) f (Day f (NonEmptyBy Day f)) x
forall a b. (a -> b) -> a -> b
$ (b -> c -> x
`z` c
y') (b -> x) -> f b -> f x
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f b
x
        R1 Ap1 f c
ys            -> Day f (NonEmptyBy Day f) x -> (:+:) f (Day f (NonEmptyBy Day f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Day f (NonEmptyBy Day f) x
 -> (:+:) f (Day f (NonEmptyBy Day f)) x)
-> Day f (NonEmptyBy Day f) x
-> (:+:) f (Day f (NonEmptyBy Day f)) x
forall a b. (a -> b) -> a -> b
$ f b -> Ap1 f c -> (b -> c -> x) -> Day f (Ap1 f) x
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (b -> c -> a) -> Day f g a
Day f b
x Ap1 f c
ys b -> c -> x
z
    consNE :: forall (f :: * -> *). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f
consNE (Day f b
x NonEmptyBy Day f c
y b -> c -> x
z) = f b -> Ap f (b -> x) -> Ap1 f x
forall (a :: * -> *) a1 b. a a1 -> Ap a (a1 -> b) -> Ap1 a b
Ap1 f b
x (Ap f (b -> x) -> Ap1 f x) -> Ap f (b -> x) -> Ap1 f x
forall a b. (a -> b) -> a -> b
$ (b -> c -> x) -> c -> b -> x
forall a b c. (a -> b -> c) -> b -> a -> c
flip b -> c -> x
z (c -> b -> x) -> Ap f c -> Ap f (b -> x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ap1 f c -> Ap f c
forall (f :: * -> *) x. Ap1 f x -> Ap f x
toAp Ap1 f c
NonEmptyBy Day f c
y
    toNonEmptyBy :: forall (f :: * -> *). Day f f ~> NonEmptyBy Day f
toNonEmptyBy   (Day f b
x f c
y b -> c -> x
z) = b -> c -> x
z (b -> c -> x) -> Ap1 f b -> Ap1 f (c -> x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f b -> Ap1 f b
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> Ap1 f
inject f b
x Ap1 f (c -> x) -> Ap1 f c -> Ap1 f x
forall a b. Ap1 f (a -> b) -> Ap1 f a -> Ap1 f b
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> f c -> Ap1 f c
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> Ap1 f
inject f c
y
instance Apply f => SemigroupIn Day f where
    biretract :: Day f f ~> f
biretract (Day f b
x f c
y b -> c -> x
z) = b -> c -> x
z (b -> c -> x) -> f b -> f (c -> x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f b
x f (c -> x) -> f c -> f x
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> f c
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Day g h ~> f
binterpret g ~> f
f h ~> f
g (Day g b
x h c
y b -> c -> x
z) = b -> c -> x
z (b -> c -> x) -> f b -> f (c -> x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g b -> f b
g ~> f
f g b
x f (c -> x) -> f c -> f x
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> h c -> f c
h ~> f
g h c
y
instance Associative CD.Day where
    type NonEmptyBy CD.Day = Div1
    type FunctorBy CD.Day = Contravariant
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Day f, FunctorBy Day g, FunctorBy Day h) =>
Day f (Day g h) <~> Day (Day f g) h
associating = (Day f (Day g h) ~> Day (Day f g) h)
-> (Day (Day f g) h ~> Day f (Day g h))
-> Day f (Day g h) <~> Day (Day f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Day f (Day g h) x -> Day (Day f g) h x
Day f (Day g h) ~> Day (Day f g) h
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
Day f (Day g h) a -> Day (Day f g) h a
CD.assoc Day (Day f g) h x -> Day f (Day g h) x
Day (Day f g) h ~> Day f (Day g h)
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
Day (Day f g) h a -> Day f (Day g h) a
CD.disassoc
    appendNE :: forall (f :: * -> *).
Day (NonEmptyBy Day f) (NonEmptyBy Day f) ~> NonEmptyBy Day f
appendNE (CD.Day NonEmptyBy Day f b
x NonEmptyBy Day f c
y x -> (b, c)
f) = (x -> (b, c)) -> Div1 f b -> Div1 f c -> Div1 f x
forall a b c. (a -> (b, c)) -> Div1 f b -> Div1 f c -> Div1 f a
forall (f :: * -> *) a b c.
Divise f =>
(a -> (b, c)) -> f b -> f c -> f a
divise x -> (b, c)
f Div1 f b
NonEmptyBy Day f b
x Div1 f c
NonEmptyBy Day f c
y
    matchNE :: forall (f :: * -> *).
FunctorBy Day f =>
NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f))
matchNE = (Coyoneda f ~> f)
-> ((Coyoneda f :*: NonEmptyF (Coyoneda f)) ~> Day f (Div1 f))
-> (Coyoneda f :+: (Coyoneda f :*: NonEmptyF (Coyoneda f)))
   ~> (f :+: Day f (Div1 f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> (f :+: g) ~> (j :+: l)
hbimap Coyoneda f x -> f x
Coyoneda f ~> f
forall (f :: * -> *) a. Contravariant f => Coyoneda f a -> f a
CCY.lowerCoyoneda (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x -> Day f (Div1 f) x
(Coyoneda f :*: NonEmptyF (Coyoneda f)) ~> Day f (Div1 f)
forall {f :: * -> *} {f :: * -> *} {p}.
(:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) p -> Day f (Div1 f) p
go ((:+:) (Coyoneda f) (Coyoneda f :*: NonEmptyF (Coyoneda f)) x
 -> (:+:) f (Day f (Div1 f)) x)
-> (Div1 f x
    -> (:+:) (Coyoneda f) (Coyoneda f :*: NonEmptyF (Coyoneda f)) x)
-> Div1 f x
-> (:+:) f (Day f (Div1 f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
(Associative t, FunctorBy t f) =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
matchNE @(:*:) (NonEmptyF (Coyoneda f) x
 -> (:+:) (Coyoneda f) (Coyoneda f :*: NonEmptyF (Coyoneda f)) x)
-> (Div1 f x -> NonEmptyF (Coyoneda f) x)
-> Div1 f x
-> (:+:) (Coyoneda f) (Coyoneda f :*: NonEmptyF (Coyoneda f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (Coyoneda f x) -> NonEmptyF (Coyoneda f) x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (Coyoneda f x) -> NonEmptyF (Coyoneda f) x)
-> (Div1 f x -> NonEmpty (Coyoneda f x))
-> Div1 f x
-> NonEmptyF (Coyoneda f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Div1 f x -> NonEmpty (Coyoneda f x)
forall (f :: * -> *) a. Div1 f a -> NonEmpty (Coyoneda f a)
unDiv1
      where
        go :: (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) p -> Day f (Div1 f) p
go (CCY.Coyoneda p -> b
f f b
x :*: NonEmptyF NonEmpty (Coyoneda f p)
xs) = f b -> Div1 f p -> (p -> (b, p)) -> Day f (Div1 f) p
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (a -> (b, c)) -> Day f g a
CD.Day f b
x (NonEmpty (Coyoneda f p) -> Div1 f p
forall (f :: * -> *) a. NonEmpty (Coyoneda f a) -> Div1 f a
Div1 NonEmpty (Coyoneda f p)
xs) (\p
y -> (p -> b
f p
y, p
y))
    consNE :: forall (f :: * -> *). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f
consNE (CD.Day f b
x (Div1 NonEmpty (Coyoneda f c)
xs) x -> (b, c)
f) = NonEmpty (Coyoneda f x) -> Div1 f x
NonEmpty (Coyoneda f x) -> NonEmptyBy Day f x
forall (f :: * -> *) a. NonEmpty (Coyoneda f a) -> Div1 f a
Div1 (NonEmpty (Coyoneda f x) -> NonEmptyBy Day f x)
-> ((:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
    -> NonEmpty (Coyoneda f x))
-> (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
-> NonEmptyBy Day f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyF (Coyoneda f) x -> NonEmpty (Coyoneda f x)
forall {k} (f :: k -> *) (a :: k). NonEmptyF f a -> NonEmpty (f a)
runNonEmptyF (NonEmptyF (Coyoneda f) x -> NonEmpty (Coyoneda f x))
-> ((:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
    -> NonEmptyF (Coyoneda f) x)
-> (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
-> NonEmpty (Coyoneda f x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
-> NonEmptyF (Coyoneda f) x
(:*:) (Coyoneda f) (NonEmptyBy (:*:) (Coyoneda f)) x
-> NonEmptyBy (:*:) (Coyoneda f) x
forall (f :: * -> *).
(f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE ((:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
 -> NonEmptyBy Day f x)
-> (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
-> NonEmptyBy Day f x
forall a b. (a -> b) -> a -> b
$
        (x -> b) -> f b -> Coyoneda f x
forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda ((b, c) -> b
forall a b. (a, b) -> a
fst ((b, c) -> b) -> (x -> (b, c)) -> x -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) f b
x Coyoneda f x
-> NonEmptyF (Coyoneda f) x
-> (:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (x -> c) -> NonEmptyF (Coyoneda f) c -> NonEmptyF (Coyoneda f) x
forall a' a.
(a' -> a) -> NonEmptyF (Coyoneda f) a -> NonEmptyF (Coyoneda f) a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap ((b, c) -> c
forall a b. (a, b) -> b
snd ((b, c) -> c) -> (x -> (b, c)) -> x -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) (NonEmpty (Coyoneda f c) -> NonEmptyF (Coyoneda f) c
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF NonEmpty (Coyoneda f c)
xs)
    toNonEmptyBy :: forall (f :: * -> *). Day f f ~> NonEmptyBy Day f
toNonEmptyBy (CD.Day f b
x f c
y x -> (b, c)
f) = NonEmpty (Coyoneda f x) -> Div1 f x
NonEmpty (Coyoneda f x) -> NonEmptyBy Day f x
forall (f :: * -> *) a. NonEmpty (Coyoneda f a) -> Div1 f a
Div1 (NonEmpty (Coyoneda f x) -> NonEmptyBy Day f x)
-> ((:*:) (Coyoneda f) (Coyoneda f) x -> NonEmpty (Coyoneda f x))
-> (:*:) (Coyoneda f) (Coyoneda f) x
-> NonEmptyBy Day f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyF (Coyoneda f) x -> NonEmpty (Coyoneda f x)
forall {k} (f :: k -> *) (a :: k). NonEmptyF f a -> NonEmpty (f a)
runNonEmptyF (NonEmptyF (Coyoneda f) x -> NonEmpty (Coyoneda f x))
-> ((:*:) (Coyoneda f) (Coyoneda f) x -> NonEmptyF (Coyoneda f) x)
-> (:*:) (Coyoneda f) (Coyoneda f) x
-> NonEmpty (Coyoneda f x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:*:) (Coyoneda f) (Coyoneda f) x -> NonEmptyF (Coyoneda f) x
(:*:) (Coyoneda f) (Coyoneda f) x
-> NonEmptyBy (:*:) (Coyoneda f) x
forall (f :: * -> *). (f :*: f) ~> NonEmptyBy (:*:) f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f f ~> NonEmptyBy t f
toNonEmptyBy ((:*:) (Coyoneda f) (Coyoneda f) x -> NonEmptyBy Day f x)
-> (:*:) (Coyoneda f) (Coyoneda f) x -> NonEmptyBy Day f x
forall a b. (a -> b) -> a -> b
$
        (x -> b) -> f b -> Coyoneda f x
forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda ((b, c) -> b
forall a b. (a, b) -> a
fst ((b, c) -> b) -> (x -> (b, c)) -> x -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) f b
x Coyoneda f x -> Coyoneda f x -> (:*:) (Coyoneda f) (Coyoneda f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (x -> c) -> f c -> Coyoneda f x
forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda ((b, c) -> c
forall a b. (a, b) -> b
snd ((b, c) -> c) -> (x -> (b, c)) -> x -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) f c
y
instance Divise f => SemigroupIn CD.Day f where
    biretract :: Day f f ~> f
biretract      (CD.Day f b
x f c
y x -> (b, c)
f) = (x -> (b, c)) -> f b -> f c -> f x
forall a b c. (a -> (b, c)) -> f b -> f c -> f a
forall (f :: * -> *) a b c.
Divise f =>
(a -> (b, c)) -> f b -> f c -> f a
divise x -> (b, c)
f f b
x f c
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Day g h ~> f
binterpret g ~> f
f h ~> f
g (CD.Day g b
x h c
y x -> (b, c)
h) = (x -> (b, c)) -> f b -> f c -> f x
forall a b c. (a -> (b, c)) -> f b -> f c -> f a
forall (f :: * -> *) a b c.
Divise f =>
(a -> (b, c)) -> f b -> f c -> f a
divise x -> (b, c)
h (g b -> f b
g ~> f
f g b
x) (h c -> f c
h ~> f
g h c
y)
instance Associative ID.Day where
    type NonEmptyBy ID.Day = DivAp1
    type FunctorBy ID.Day = Invariant
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Day f, FunctorBy Day g, FunctorBy Day h) =>
Day f (Day g h) <~> Day (Day f g) h
associating = (Day f (Day g h) ~> Day (Day f g) h)
-> (Day (Day f g) h ~> Day f (Day g h))
-> Day f (Day g h) <~> Day (Day f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Day f (Day g h) x -> Day (Day f g) h x
Day f (Day g h) ~> Day (Day f g) h
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) ~> t (t f g) h
assoc Day (Day f g) h x -> Day f (Day g h) x
Day (Day f g) h ~> Day f (Day g h)
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t (t f g) h ~> t f (t g h)
disassoc
    appendNE :: forall (f :: * -> *).
Day (NonEmptyBy Day f) (NonEmptyBy Day f) ~> NonEmptyBy Day f
appendNE = (Day (Chain1 Day f) (Chain1 Day f) x -> Chain1 Day f x)
-> Day (DivAp1 f) (DivAp1 f) x -> DivAp1 f x
forall a b. Coercible a b => a -> b
coerce Day (Chain1 Day f) (Chain1 Day f) x -> Chain1 Day f x
forall (f :: * -> *) x.
Day (Chain1 Day f) (Chain1 Day f) x -> Chain1 Day f x
appendNEIDay_
    matchNE :: forall (f :: * -> *).
FunctorBy Day f =>
NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f))
matchNE = (Chain1 Day f x -> (:+:) f (Day f (Chain1 Day f)) x)
-> DivAp1 f x -> (:+:) f (Day f (DivAp1 f)) x
forall a b. Coercible a b => a -> b
coerce Chain1 Day f x -> (:+:) f (Day f (Chain1 Day f)) x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (x :: k).
Chain1 t f x -> (:+:) f (t f (Chain1 t f)) x
matchChain1
    consNE :: forall (f :: * -> *). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f
consNE = (Day f (Chain1 Day f) x -> Chain1 Day f x)
-> Day f (DivAp1 f) x -> DivAp1 f x
forall a b. Coercible a b => a -> b
coerce Day f (Chain1 Day f) x -> Chain1 Day f x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1
    toNonEmptyBy :: forall (f :: * -> *). Day f f ~> NonEmptyBy Day f
toNonEmptyBy = (Day f f x -> Chain1 Day f x) -> Day f f x -> DivAp1 f x
forall a b. Coercible a b => a -> b
coerce Day f f x -> Chain1 Day f x
Day f f ~> Chain1 Day f
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *).
HBifunctor t =>
t f f ~> Chain1 t f
toChain1
appendNEIDay_ :: ID.Day (Chain1 ID.Day f) (Chain1 ID.Day f) ~> Chain1 ID.Day f
appendNEIDay_ :: forall (f :: * -> *) x.
Day (Chain1 Day f) (Chain1 Day f) x -> Chain1 Day f x
appendNEIDay_ (ID.Day Chain1 Day f b
xs Chain1 Day f c
ys b -> c -> x
g x -> (b, c)
f) = case Chain1 Day f b
xs of
  Done1 f b
x              -> Day f (Chain1 Day f) x -> Chain1 Day f x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 (f b
-> Chain1 Day f c
-> (b -> c -> x)
-> (x -> (b, c))
-> Day f (Chain1 Day f) x
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (b -> c -> a) -> (a -> (b, c)) -> Day f g a
ID.Day f b
x Chain1 Day f c
ys b -> c -> x
g x -> (b, c)
f)
  More1 (ID.Day f b
z Chain1 Day f c
zs b -> c -> b
j b -> (b, c)
h) -> Day f (Chain1 Day f) x -> Chain1 Day f x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 (Day f (Chain1 Day f) x -> Chain1 Day f x)
-> Day f (Chain1 Day f) x -> Chain1 Day f x
forall a b. (a -> b) -> a -> b
$
    f b
-> Chain1 Day f (c, c)
-> (b -> (c, c) -> x)
-> (x -> (b, (c, c)))
-> Day f (Chain1 Day f) x
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (b -> c -> a) -> (a -> (b, c)) -> Day f g a
ID.Day f b
z (Day (Chain1 Day f) (Chain1 Day f) (c, c) -> Chain1 Day f (c, c)
forall (f :: * -> *) x.
Day (Chain1 Day f) (Chain1 Day f) x -> Chain1 Day f x
appendNEIDay_ (Chain1 Day f c
-> Chain1 Day f c
-> (c -> c -> (c, c))
-> ((c, c) -> (c, c))
-> Day (Chain1 Day f) (Chain1 Day f) (c, c)
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (b -> c -> a) -> (a -> (b, c)) -> Day f g a
ID.Day Chain1 Day f c
zs Chain1 Day f c
ys (,) (c, c) -> (c, c)
forall a. a -> a
id))
      (\b
a (c
b, c
c) -> b -> c -> x
g (b -> c -> b
j b
a c
b) c
c)
      (((b, c), c) -> (b, (c, c))
forall a b c. ((a, b), c) -> (a, (b, c))
forall (p :: * -> * -> *) a b c.
Assoc p =>
p (p a b) c -> p a (p b c)
B.assoc (((b, c), c) -> (b, (c, c)))
-> (x -> ((b, c), c)) -> x -> (b, (c, c))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (b -> (b, c)) -> (b, c) -> ((b, c), c)
forall a b c. (a -> b) -> (a, c) -> (b, c)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first b -> (b, c)
h ((b, c) -> ((b, c), c)) -> (x -> (b, c)) -> x -> ((b, c), c)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f)
instance Inply f => SemigroupIn ID.Day f where
    biretract :: Day f f ~> f
biretract = Day f f x -> f x
Day f f ~> f
forall (f :: * -> *). Inply f => Day f f ~> f
dather
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Day g h ~> f
binterpret = (g ~> f) -> (h ~> f) -> Day g h x -> f x
(g ~> f) -> (h ~> f) -> Day g h ~> f
forall (h :: * -> *) (f :: * -> *) (g :: * -> *).
Inply h =>
(f ~> h) -> (g ~> h) -> Day f g ~> h
runDay
instance Associative IN.Night where
    type NonEmptyBy IN.Night = DecAlt1
    type FunctorBy IN.Night = Invariant
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Night f, FunctorBy Night g, FunctorBy Night h) =>
Night f (Night g h) <~> Night (Night f g) h
associating = (Night f (Night g h) ~> Night (Night f g) h)
-> (Night (Night f g) h ~> Night f (Night g h))
-> Night f (Night g h) <~> Night (Night f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Night f (Night g h) x -> Night (Night f g) h x
Night f (Night g h) ~> Night (Night f g) h
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) x.
Night f (Night g h) x -> Night (Night f g) h x
IN.assoc Night (Night f g) h x -> Night f (Night g h) x
Night (Night f g) h ~> Night f (Night g h)
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) x.
Night (Night f g) h x -> Night f (Night g h) x
IN.unassoc
    appendNE :: forall (f :: * -> *).
Night (NonEmptyBy Night f) (NonEmptyBy Night f)
~> NonEmptyBy Night f
appendNE = (Night (Chain1 Night f) (Chain1 Night f) x -> Chain1 Night f x)
-> Night (DecAlt1 f) (DecAlt1 f) x -> DecAlt1 f x
forall a b. Coercible a b => a -> b
coerce Night (Chain1 Night f) (Chain1 Night f) x -> Chain1 Night f x
forall (f :: * -> *) x.
Night (Chain1 Night f) (Chain1 Night f) x -> Chain1 Night f x
appendNEINight_
    matchNE :: forall (f :: * -> *).
FunctorBy Night f =>
NonEmptyBy Night f ~> (f :+: Night f (NonEmptyBy Night f))
matchNE = (Chain1 Night f x -> (:+:) f (Night f (Chain1 Night f)) x)
-> DecAlt1 f x -> (:+:) f (Night f (DecAlt1 f)) x
forall a b. Coercible a b => a -> b
coerce Chain1 Night f x -> (:+:) f (Night f (Chain1 Night f)) x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (x :: k).
Chain1 t f x -> (:+:) f (t f (Chain1 t f)) x
matchChain1
    consNE :: forall (f :: * -> *).
Night f (NonEmptyBy Night f) ~> NonEmptyBy Night f
consNE = (Night f (Chain1 Night f) x -> Chain1 Night f x)
-> Night f (DecAlt1 f) x -> DecAlt1 f x
forall a b. Coercible a b => a -> b
coerce Night f (Chain1 Night f) x -> Chain1 Night f x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1
    toNonEmptyBy :: forall (f :: * -> *). Night f f ~> NonEmptyBy Night f
toNonEmptyBy = (Night f f x -> Chain1 Night f x) -> Night f f x -> DecAlt1 f x
forall a b. Coercible a b => a -> b
coerce Night f f x -> Chain1 Night f x
Night f f ~> Chain1 Night f
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *).
HBifunctor t =>
t f f ~> Chain1 t f
toChain1
appendNEINight_ :: IN.Night (Chain1 IN.Night f) (Chain1 IN.Night f) ~> Chain1 IN.Night f
appendNEINight_ :: forall (f :: * -> *) x.
Night (Chain1 Night f) (Chain1 Night f) x -> Chain1 Night f x
appendNEINight_ (IN.Night Chain1 Night f b1
xs Chain1 Night f c1
ys b1 -> x
f c1 -> x
g x -> Either b1 c1
h) = case Chain1 Night f b1
xs of
  Done1 f b1
x                     -> Night f (Chain1 Night f) x -> Chain1 Night f x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 (f b1
-> Chain1 Night f c1
-> (b1 -> x)
-> (c1 -> x)
-> (x -> Either b1 c1)
-> Night f (Chain1 Night f) x
forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1
-> b c1
-> (b1 -> c)
-> (c1 -> c)
-> (c -> Either b1 c1)
-> Night a b c
IN.Night f b1
x Chain1 Night f c1
ys b1 -> x
f c1 -> x
g x -> Either b1 c1
h)
  More1 (IN.Night f b1
z Chain1 Night f c1
zs b1 -> b1
j c1 -> b1
k b1 -> Either b1 c1
l) -> Night f (Chain1 Night f) x -> Chain1 Night f x
forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 (Night f (Chain1 Night f) x -> Chain1 Night f x)
-> Night f (Chain1 Night f) x -> Chain1 Night f x
forall a b. (a -> b) -> a -> b
$
    f b1
-> Chain1 Night f (Either c1 c1)
-> (b1 -> x)
-> (Either c1 c1 -> x)
-> (x -> Either b1 (Either c1 c1))
-> Night f (Chain1 Night f) x
forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1
-> b c1
-> (b1 -> c)
-> (c1 -> c)
-> (c -> Either b1 c1)
-> Night a b c
IN.Night f b1
z (Night (Chain1 Night f) (Chain1 Night f) (Either c1 c1)
-> Chain1 Night f (Either c1 c1)
forall (f :: * -> *) x.
Night (Chain1 Night f) (Chain1 Night f) x -> Chain1 Night f x
appendNEINight_ (Chain1 Night f c1
-> Chain1 Night f c1
-> (c1 -> Either c1 c1)
-> (c1 -> Either c1 c1)
-> (Either c1 c1 -> Either c1 c1)
-> Night (Chain1 Night f) (Chain1 Night f) (Either c1 c1)
forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1
-> b c1
-> (b1 -> c)
-> (c1 -> c)
-> (c -> Either b1 c1)
-> Night a b c
IN.Night Chain1 Night f c1
zs Chain1 Night f c1
ys c1 -> Either c1 c1
forall a b. a -> Either a b
Left c1 -> Either c1 c1
forall a b. b -> Either a b
Right Either c1 c1 -> Either c1 c1
forall a. a -> a
id))
      (b1 -> x
f (b1 -> x) -> (b1 -> b1) -> b1 -> x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b1 -> b1
j)
      ((c1 -> x) -> (c1 -> x) -> Either c1 c1 -> x
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (b1 -> x
f (b1 -> x) -> (c1 -> b1) -> c1 -> x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c1 -> b1
k) c1 -> x
g)
      (Either (Either b1 c1) c1 -> Either b1 (Either c1 c1)
forall a b c. Either (Either a b) c -> Either a (Either b c)
forall (p :: * -> * -> *) a b c.
Assoc p =>
p (p a b) c -> p a (p b c)
B.assoc (Either (Either b1 c1) c1 -> Either b1 (Either c1 c1))
-> (x -> Either (Either b1 c1) c1) -> x -> Either b1 (Either c1 c1)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (b1 -> Either b1 c1) -> Either b1 c1 -> Either (Either b1 c1) c1
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first b1 -> Either b1 c1
l (Either b1 c1 -> Either (Either b1 c1) c1)
-> (x -> Either b1 c1) -> x -> Either (Either b1 c1) c1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> Either b1 c1
h)
instance Inalt f => SemigroupIn IN.Night f where
    biretract :: Night f f ~> f
biretract = Night f f x -> f x
Night f f ~> f
forall (f :: * -> *). Inalt f => Night f f ~> f
IN.nerve
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Night g h ~> f
binterpret = (g ~> f) -> (h ~> f) -> Night g h x -> f x
(g ~> f) -> (h ~> f) -> Night g h ~> f
forall (h :: * -> *) (f :: * -> *) (g :: * -> *).
Inalt h =>
(f ~> h) -> (g ~> h) -> Night f g ~> h
IN.runNight
instance Associative Night where
    type NonEmptyBy Night = Dec1
    type FunctorBy Night = Contravariant
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Night f, FunctorBy Night g, FunctorBy Night h) =>
Night f (Night g h) <~> Night (Night f g) h
associating = (Night f (Night g h) ~> Night (Night f g) h)
-> (Night (Night f g) h ~> Night f (Night g h))
-> Night f (Night g h) <~> Night (Night f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Night f (Night g h) x -> Night (Night f g) h x
Night f (Night g h) ~> Night (Night f g) h
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) x.
Night f (Night g h) x -> Night (Night f g) h x
N.assoc Night (Night f g) h x -> Night f (Night g h) x
Night (Night f g) h ~> Night f (Night g h)
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) x.
Night (Night f g) h x -> Night f (Night g h) x
N.unassoc
    appendNE :: forall (f :: * -> *).
Night (NonEmptyBy Night f) (NonEmptyBy Night f)
~> NonEmptyBy Night f
appendNE (Night NonEmptyBy Night f b1
x NonEmptyBy Night f c1
y x -> Either b1 c1
f) = (x -> Either b1 c1) -> Dec1 f b1 -> Dec1 f c1 -> Dec1 f x
forall a b c. (a -> Either b c) -> Dec1 f b -> Dec1 f c -> Dec1 f a
forall (f :: * -> *) a b c.
Decide f =>
(a -> Either b c) -> f b -> f c -> f a
decide x -> Either b1 c1
f Dec1 f b1
NonEmptyBy Night f b1
x Dec1 f c1
NonEmptyBy Night f c1
y
    matchNE :: forall (f :: * -> *).
FunctorBy Night f =>
NonEmptyBy Night f ~> (f :+: Night f (NonEmptyBy Night f))
matchNE (Dec1 x -> Either b1 c
f f b1
x Dec f c
xs) = case Dec f c
xs of
      Lose c -> Void
g -> f x -> (:+:) f (Night f (NonEmptyBy Night f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (f x -> (:+:) f (Night f (NonEmptyBy Night f)) x)
-> f x -> (:+:) f (Night f (NonEmptyBy Night f)) x
forall a b. (a -> b) -> a -> b
$ (x -> b1) -> f b1 -> f x
forall a' a. (a' -> a) -> f a -> f a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap ((b1 -> b1) -> (c -> b1) -> Either b1 c -> b1
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either b1 -> b1
forall a. a -> a
id (Void -> b1
forall a. Void -> a
absurd (Void -> b1) -> (c -> Void) -> c -> b1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> Void
g) (Either b1 c -> b1) -> (x -> Either b1 c) -> x -> b1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> Either b1 c
f) f b1
x
      Choose c -> Either b1 c
g f b1
y Dec f c
ys -> Night f (NonEmptyBy Night f) x
-> (:+:) f (Night f (NonEmptyBy Night f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Night f (NonEmptyBy Night f) x
 -> (:+:) f (Night f (NonEmptyBy Night f)) x)
-> Night f (NonEmptyBy Night f) x
-> (:+:) f (Night f (NonEmptyBy Night f)) x
forall a b. (a -> b) -> a -> b
$ f b1 -> Dec1 f c -> (x -> Either b1 c) -> Night f (Dec1 f) x
forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1 -> b c1 -> (c -> Either b1 c1) -> Night a b c
Night f b1
x ((c -> Either b1 c) -> f b1 -> Dec f c -> Dec1 f c
forall b b1 c (a :: * -> *).
(b -> Either b1 c) -> a b1 -> Dec a c -> Dec1 a b
Dec1 c -> Either b1 c
g f b1
y Dec f c
ys) x -> Either b1 c
f
    consNE :: forall (f :: * -> *).
Night f (NonEmptyBy Night f) ~> NonEmptyBy Night f
consNE (Night f b1
x NonEmptyBy Night f c1
y x -> Either b1 c1
f) = (x -> Either b1 c1) -> f b1 -> Dec f c1 -> Dec1 f x
forall b b1 c (a :: * -> *).
(b -> Either b1 c) -> a b1 -> Dec a c -> Dec1 a b
Dec1 x -> Either b1 c1
f f b1
x (Dec1 f c1 -> Dec f c1
forall (f :: * -> *) a. Dec1 f a -> Dec f a
toDec Dec1 f c1
NonEmptyBy Night f c1
y)
    toNonEmptyBy :: forall (f :: * -> *). Night f f ~> NonEmptyBy Night f
toNonEmptyBy (Night f b1
x f c1
y x -> Either b1 c1
f) = (x -> Either b1 c1) -> f b1 -> Dec f c1 -> Dec1 f x
forall b b1 c (a :: * -> *).
(b -> Either b1 c) -> a b1 -> Dec a c -> Dec1 a b
Dec1 x -> Either b1 c1
f f b1
x (f c1 -> Dec f c1
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> Dec f
inject f c1
y)
instance Decide f => SemigroupIn Night f where
    biretract :: Night f f ~> f
biretract      (Night f b1
x f c1
y x -> Either b1 c1
f) = (x -> Either b1 c1) -> f b1 -> f c1 -> f x
forall a b c. (a -> Either b c) -> f b -> f c -> f a
forall (f :: * -> *) a b c.
Decide f =>
(a -> Either b c) -> f b -> f c -> f a
decide x -> Either b1 c1
f f b1
x f c1
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Night g h ~> f
binterpret g ~> f
f h ~> f
g (Night g b1
x h c1
y x -> Either b1 c1
h) = (x -> Either b1 c1) -> f b1 -> f c1 -> f x
forall a b c. (a -> Either b c) -> f b -> f c -> f a
forall (f :: * -> *) a b c.
Decide f =>
(a -> Either b c) -> f b -> f c -> f a
decide x -> Either b1 c1
h (g b1 -> f b1
g ~> f
f g b1
x) (h c1 -> f c1
h ~> f
g h c1
y)
instance Associative (:+:) where
    type NonEmptyBy (:+:) = Step
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy (:+:) f, FunctorBy (:+:) g, FunctorBy (:+:) h) =>
(f :+: (g :+: h)) <~> ((f :+: g) :+: h)
associating = ((f :+: (g :+: h)) ~> ((f :+: g) :+: h))
-> (((f :+: g) :+: h) ~> (f :+: (g :+: h)))
-> (f :+: (g :+: h)) <~> ((f :+: g) :+: h)
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (:+:) f (g :+: h) x -> (:+:) (f :+: g) h x
(f :+: (g :+: h)) ~> ((f :+: g) :+: h)
forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {p :: k}.
(:+:) f (g :+: g) p -> (:+:) (f :+: g) g p
to_ (:+:) (f :+: g) h x -> (:+:) f (g :+: h) x
((f :+: g) :+: h) ~> (f :+: (g :+: h))
forall {k} {f :: k -> *} {f :: k -> *} {g :: k -> *} {p :: k}.
(:+:) (f :+: f) g p -> (:+:) f (f :+: g) p
from_
      where
        to_ :: (:+:) f (g :+: g) p -> (:+:) (f :+: g) g p
to_ = \case
          L1 f p
x      -> (:+:) f g p -> (:+:) (f :+: g) g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (f p -> (:+:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
x)
          R1 (L1 g p
y) -> (:+:) f g p -> (:+:) (f :+: g) g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (g p -> (:+:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 g p
y)
          R1 (R1 g p
z) -> g p -> (:+:) (f :+: g) g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 g p
z
        from_ :: (:+:) (f :+: f) g p -> (:+:) f (f :+: g) p
from_ = \case
          L1 (L1 f p
x) -> f p -> (:+:) f (f :+: g) p
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
x
          L1 (R1 f p
y) -> (:+:) f g p -> (:+:) f (f :+: g) p
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (f p -> (:+:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
y)
          R1 g p
z      -> (:+:) f g p -> (:+:) f (f :+: g) p
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (g p -> (:+:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 g p
z)
    appendNE :: forall (f :: * -> *).
(NonEmptyBy (:+:) f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f
appendNE = \case
      L1 (Step Natural
i f x
x) -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1) f x
x
      R1 (Step Natural
i f x
y) -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
2) f x
y
    matchNE :: forall (f :: * -> *).
FunctorBy (:+:) f =>
NonEmptyBy (:+:) f ~> (f :+: (f :+: NonEmptyBy (:+:) f))
matchNE = (Step f ~> (f :+: Step f))
-> (f :+: Step f) ~> (f :+: (f :+: Step f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> (f :+: g) ~> (f :+: l)
hright Step f x -> (:+:) f (Step f) x
Step f ~> (f :+: Step f)
forall {k} (f :: k -> *) (x :: k). Step f x -> (:+:) f (Step f) x
stepDown ((:+:) f (Step f) x -> (:+:) f (f :+: Step f) x)
-> (Step f x -> (:+:) f (Step f) x)
-> Step f x
-> (:+:) f (f :+: Step f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall {k} (f :: k -> *) (x :: k). Step f x -> (:+:) f (Step f) x
stepDown
    consNE :: forall (f :: * -> *).
(f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f
consNE = (:+:) f (Step f) x -> Step f x
forall {k} (f :: k -> *) (x :: k). (:+:) f (Step f) x -> Step f x
stepUp ((:+:) f (Step f) x -> Step f x)
-> ((:+:) f (Step f) x -> (:+:) f (Step f) x)
-> (:+:) f (Step f) x
-> Step f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Step f x -> (:+:) f (Step f) x)
-> ((:+:) f (Step f) x -> Step f x)
-> (:+:) f (Step f) x
-> (:+:) f (Step f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:+:) f (Step f) x -> Step f x
forall {k} (f :: k -> *) (x :: k). (:+:) f (Step f) x -> Step f x
stepUp
    toNonEmptyBy :: forall (f :: * -> *). (f :+: f) ~> NonEmptyBy (:+:) f
toNonEmptyBy = \case
      L1 f x
x -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
1 f x
x
      R1 f x
y -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
2 f x
y
instance SemigroupIn (:+:) f where
    biretract :: (f :+: f) ~> f
biretract = \case
      L1 f x
x -> f x
x
      R1 f x
y -> f x
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> (g :+: h) ~> f
binterpret g ~> f
f h ~> f
g = \case
      L1 g x
x -> g x -> f x
g ~> f
f g x
x
      R1 h x
y -> h x -> f x
h ~> f
g h x
y
instance Associative Sum where
    type NonEmptyBy Sum = Step
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Sum f, FunctorBy Sum g, FunctorBy Sum h) =>
Sum f (Sum g h) <~> Sum (Sum f g) h
associating = (Sum f (Sum g h) ~> Sum (Sum f g) h)
-> (Sum (Sum f g) h ~> Sum f (Sum g h))
-> Sum f (Sum g h) <~> Sum (Sum f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Sum f (Sum g h) x -> Sum (Sum f g) h x
Sum f (Sum g h) ~> Sum (Sum f g) h
forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {a :: k}.
Sum f (Sum g g) a -> Sum (Sum f g) g a
to_ Sum (Sum f g) h x -> Sum f (Sum g h) x
Sum (Sum f g) h ~> Sum f (Sum g h)
forall {k} {f :: k -> *} {f :: k -> *} {g :: k -> *} {a :: k}.
Sum (Sum f f) g a -> Sum f (Sum f g) a
from_
      where
        to_ :: Sum f (Sum g g) a -> Sum (Sum f g) g a
to_ = \case
          InL f a
x       -> Sum f g a -> Sum (Sum f g) g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (f a -> Sum f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
x)
          InR (InL g a
y) -> Sum f g a -> Sum (Sum f g) g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (g a -> Sum f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR g a
y)
          InR (InR g a
z) -> g a -> Sum (Sum f g) g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR g a
z
        from_ :: Sum (Sum f f) g a -> Sum f (Sum f g) a
from_ = \case
          InL (InL f a
x) -> f a -> Sum f (Sum f g) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
x
          InL (InR f a
y) -> Sum f g a -> Sum f (Sum f g) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (f a -> Sum f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
y)
          InR g a
z       -> Sum f g a -> Sum f (Sum f g) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (g a -> Sum f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR g a
z)
    appendNE :: forall (f :: * -> *).
Sum (NonEmptyBy Sum f) (NonEmptyBy Sum f) ~> NonEmptyBy Sum f
appendNE = \case
      InL (Step Natural
i f x
x) -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1) f x
x
      InR (Step Natural
i f x
y) -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
2) f x
y
    matchNE :: forall (f :: * -> *).
FunctorBy Sum f =>
NonEmptyBy Sum f ~> (f :+: Sum f (NonEmptyBy Sum f))
matchNE = (Step f ~> Sum f (Step f))
-> (f :+: Step f) ~> (f :+: Sum f (Step f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> (f :+: g) ~> (f :+: l)
hright (((f :+: Step f) <~> Sum f (Step f))
-> (f :+: Step f) ~> Sum f (Step f)
forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> f ~> g
viewF p (Sum f (Step f) a) (Sum f (Step f) a)
-> p ((:+:) f (Step f) a) ((:+:) f (Step f) a)
forall {k} (f :: k -> *) (g :: k -> *) (p :: * -> * -> *) (a :: k).
Profunctor p =>
p (Sum f g a) (Sum f g a) -> p ((:+:) f g a) ((:+:) f g a)
(f :+: Step f) <~> Sum f (Step f)
sumSum ((:+:) f (Step f) x -> Sum f (Step f) x)
-> (Step f x -> (:+:) f (Step f) x) -> Step f x -> Sum f (Step f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall {k} (f :: k -> *) (x :: k). Step f x -> (:+:) f (Step f) x
stepDown) ((:+:) f (Step f) x -> (:+:) f (Sum f (Step f)) x)
-> (Step f x -> (:+:) f (Step f) x)
-> Step f x
-> (:+:) f (Sum f (Step f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall {k} (f :: k -> *) (x :: k). Step f x -> (:+:) f (Step f) x
stepDown
    consNE :: forall (f :: * -> *). Sum f (NonEmptyBy Sum f) ~> NonEmptyBy Sum f
consNE = (:+:) f (Step f) x -> Step f x
forall {k} (f :: k -> *) (x :: k). (:+:) f (Step f) x -> Step f x
stepUp ((:+:) f (Step f) x -> Step f x)
-> (Sum f (Step f) x -> (:+:) f (Step f) x)
-> Sum f (Step f) x
-> Step f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Step f x -> (:+:) f (Step f) x)
-> (Sum f (Step f) x -> Step f x)
-> Sum f (Step f) x
-> (:+:) f (Step f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:+:) f (Step f) x -> Step f x
forall {k} (f :: k -> *) (x :: k). (:+:) f (Step f) x -> Step f x
stepUp ((:+:) f (Step f) x -> Step f x)
-> (Sum f (Step f) x -> (:+:) f (Step f) x)
-> Sum f (Step f) x
-> Step f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((f :+: Step f) <~> Sum f (Step f))
-> Sum f (Step f) ~> (f :+: Step f)
forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> g ~> f
reviewF p (Sum f (Step f) a) (Sum f (Step f) a)
-> p ((:+:) f (Step f) a) ((:+:) f (Step f) a)
forall {k} (f :: k -> *) (g :: k -> *) (p :: * -> * -> *) (a :: k).
Profunctor p =>
p (Sum f g a) (Sum f g a) -> p ((:+:) f g a) ((:+:) f g a)
(f :+: Step f) <~> Sum f (Step f)
sumSum
    toNonEmptyBy :: forall (f :: * -> *). Sum f f ~> NonEmptyBy Sum f
toNonEmptyBy = \case
      InL f x
x -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
1 f x
x
      InR f x
y -> Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
2 f x
y
instance SemigroupIn Sum f where
    biretract :: Sum f f ~> f
biretract = \case
      InR f x
x -> f x
x
      InL f x
y -> f x
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Sum g h ~> f
binterpret g ~> f
f h ~> f
g = \case
      InL g x
x -> g x -> f x
g ~> f
f g x
x
      InR h x
y -> h x -> f x
h ~> f
g h x
y
instance Associative These1 where
    type NonEmptyBy These1 = ComposeT Flagged Steps
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy These1 f, FunctorBy These1 g, FunctorBy These1 h) =>
These1 f (These1 g h) <~> These1 (These1 f g) h
associating = (These1 f (These1 g h) ~> These1 (These1 f g) h)
-> (These1 (These1 f g) h ~> These1 f (These1 g h))
-> These1 f (These1 g h) <~> These1 (These1 f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF These1 f (These1 g h) x -> These1 (These1 f g) h x
These1 f (These1 g h) ~> These1 (These1 f g) h
forall {f :: * -> *} {g :: * -> *} {g :: * -> *} {a}.
These1 f (These1 g g) a -> These1 (These1 f g) g a
to_ These1 (These1 f g) h x -> These1 f (These1 g h) x
These1 (These1 f g) h ~> These1 f (These1 g h)
forall {f :: * -> *} {f :: * -> *} {g :: * -> *} {a}.
These1 (These1 f f) g a -> These1 f (These1 f g) a
from_
      where
        to_ :: These1 f (These1 g g) a -> These1 (These1 f g) g a
to_ = \case
          This1  f a
x              -> These1 f g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  (f a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  f a
x  )
          That1    (This1  g a
y  ) -> These1 f g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  (g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    g a
y)
          That1    (That1    g a
z) -> g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1               g a
z
          That1    (These1 g a
y g a
z) -> These1 f g a -> g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    g a
y) g a
z
          These1 f a
x (This1  g a
y  ) -> These1 f g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  (f a -> g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x g a
y)
          These1 f a
x (That1    g a
z) -> These1 f g a -> g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (f a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  f a
x  ) g a
z
          These1 f a
x (These1 g a
y g a
z) -> These1 f g a -> g a -> These1 (These1 f g) g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (f a -> g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x g a
y) g a
z
        from_ :: These1 (These1 f f) g a -> These1 f (These1 f g) a
from_ = \case
          This1  (This1  f a
x  )   -> f a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  f a
x
          This1  (That1    f a
y)   -> These1 f g a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    (f a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  f a
y  )
          This1  (These1 f a
x f a
y)   -> f a -> These1 f g a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x (f a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  f a
y  )
          That1               g a
z -> These1 f g a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    (g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    g a
z)
          These1 (This1  f a
x  ) g a
z -> f a -> These1 f g a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x (g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    g a
z)
          These1 (That1    f a
y) g a
z -> These1 f g a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    (f a -> g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
y g a
z)
          These1 (These1 f a
x f a
y) g a
z -> f a -> These1 f g a -> These1 f (These1 f g) a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x (f a -> g a -> These1 f g a
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
y g a
z)
    appendNE :: forall (f :: * -> *).
These1 (NonEmptyBy These1 f) (NonEmptyBy These1 f)
~> NonEmptyBy These1 f
appendNE These1 (NonEmptyBy These1 f) (NonEmptyBy These1 f) x
s = Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (Flagged (Steps f) x -> ComposeT Flagged Steps f x)
-> Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall a b. (a -> b) -> a -> b
$ case These1 (NonEmptyBy These1 f) (NonEmptyBy These1 f) x
s of
        This1  (ComposeT (Flagged Bool
_ Steps f x
q))                       ->
          Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True Steps f x
q
        That1                           (ComposeT (Flagged Bool
b Steps f x
q)) ->
          Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b        (These1 f (Steps f) x -> Steps f x
forall (f :: * -> *) x. These1 f (Steps f) x -> Steps f x
stepsUp (Steps f x -> These1 f (Steps f) x
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 Steps f x
q))
        These1 (ComposeT (Flagged Bool
a Steps f x
q)) (ComposeT (Flagged Bool
b Steps f x
r)) ->
          Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged (Bool
a Bool -> Bool -> Bool
|| Bool
b) (Steps f x
q Steps f x -> Steps f x -> Steps f x
forall a. Semigroup a => a -> a -> a
<> Steps f x
r)
    matchNE :: forall (f :: * -> *).
FunctorBy These1 f =>
NonEmptyBy These1 f ~> (f :+: These1 f (NonEmptyBy These1 f))
matchNE (ComposeT (Flagged Bool
isImpure Steps f x
q)) = case Steps f x -> These1 f (Steps f) x
forall (f :: * -> *) x. Steps f x -> These1 f (Steps f) x
stepsDown Steps f x
q of
      This1  f x
x
        | Bool
isImpure  -> These1 f (NonEmptyBy These1 f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (These1 f (NonEmptyBy These1 f) x
 -> (:+:) f (These1 f (NonEmptyBy These1 f)) x)
-> These1 f (NonEmptyBy These1 f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall a b. (a -> b) -> a -> b
$ f x -> These1 f (ComposeT Flagged Steps f) x
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f x
x
        | Bool
otherwise -> f x -> (:+:) f (These1 f (ComposeT Flagged Steps f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
      That1    Steps f x
y    -> These1 f (ComposeT Flagged Steps f) x
-> (:+:) f (These1 f (ComposeT Flagged Steps f)) x
These1 f (ComposeT Flagged Steps f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (These1 f (ComposeT Flagged Steps f) x
 -> (:+:) f (These1 f (NonEmptyBy These1 f)) x)
-> (Flagged (Steps f) x -> These1 f (ComposeT Flagged Steps f) x)
-> Flagged (Steps f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComposeT Flagged Steps f x -> These1 f (ComposeT Flagged Steps f) x
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 (ComposeT Flagged Steps f x
 -> These1 f (ComposeT Flagged Steps f) x)
-> (Flagged (Steps f) x -> ComposeT Flagged Steps f x)
-> Flagged (Steps f) x
-> These1 f (ComposeT Flagged Steps f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (Flagged (Steps f) x -> (:+:) f (These1 f (NonEmptyBy These1 f)) x)
-> Flagged (Steps f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall a b. (a -> b) -> a -> b
$ Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
isImpure Steps f x
y
      These1 f x
x Steps f x
y    -> These1 f (ComposeT Flagged Steps f) x
-> (:+:) f (These1 f (ComposeT Flagged Steps f)) x
These1 f (ComposeT Flagged Steps f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (These1 f (ComposeT Flagged Steps f) x
 -> (:+:) f (These1 f (NonEmptyBy These1 f)) x)
-> (Flagged (Steps f) x -> These1 f (ComposeT Flagged Steps f) x)
-> Flagged (Steps f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x
-> ComposeT Flagged Steps f x
-> These1 f (ComposeT Flagged Steps f) x
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f x
x (ComposeT Flagged Steps f x
 -> These1 f (ComposeT Flagged Steps f) x)
-> (Flagged (Steps f) x -> ComposeT Flagged Steps f x)
-> Flagged (Steps f) x
-> These1 f (ComposeT Flagged Steps f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
.  Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (Flagged (Steps f) x -> (:+:) f (These1 f (NonEmptyBy These1 f)) x)
-> Flagged (Steps f) x
-> (:+:) f (These1 f (NonEmptyBy These1 f)) x
forall a b. (a -> b) -> a -> b
$ Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
isImpure Steps f x
y
    consNE :: forall (f :: * -> *).
These1 f (NonEmptyBy These1 f) ~> NonEmptyBy These1 f
consNE These1 f (NonEmptyBy These1 f) x
s = Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (Flagged (Steps f) x -> ComposeT Flagged Steps f x)
-> Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall a b. (a -> b) -> a -> b
$ case These1 f (NonEmptyBy These1 f) x
s of
      This1  f x
x                          -> Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True (f x -> Steps f x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *). f ~> Steps f
inject f x
x)
      That1    (ComposeT (Flagged Bool
b Steps f x
y)) -> Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b    (These1 f (Steps f) x -> Steps f x
forall (f :: * -> *) x. These1 f (Steps f) x -> Steps f x
stepsUp (Steps f x -> These1 f (Steps f) x
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1    Steps f x
y))
      These1 f x
x (ComposeT (Flagged Bool
b Steps f x
y)) -> Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b    (These1 f (Steps f) x -> Steps f x
forall (f :: * -> *) x. These1 f (Steps f) x -> Steps f x
stepsUp (f x -> Steps f x -> These1 f (Steps f) x
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f x
x Steps f x
y))
    toNonEmptyBy :: forall (f :: * -> *). These1 f f ~> NonEmptyBy These1 f
toNonEmptyBy  These1 f f x
s = Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (Flagged (Steps f) x -> ComposeT Flagged Steps f x)
-> Flagged (Steps f) x -> ComposeT Flagged Steps f x
forall a b. (a -> b) -> a -> b
$ case These1 f f x
s of
      This1  f x
x   -> Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True  (Steps f x -> Flagged (Steps f) x)
-> (NEMap Natural (f x) -> Steps f x)
-> NEMap Natural (f x)
-> Flagged (Steps f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NEMap Natural (f x) -> Steps f x
forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps (NEMap Natural (f x) -> Flagged (Steps f) x)
-> NEMap Natural (f x) -> Flagged (Steps f) x
forall a b. (a -> b) -> a -> b
$ Natural -> f x -> NEMap Natural (f x)
forall k a. k -> a -> NEMap k a
NEM.singleton Natural
0 f x
x
      That1    f x
y -> Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False (Steps f x -> Flagged (Steps f) x)
-> (NEMap Natural (f x) -> Steps f x)
-> NEMap Natural (f x)
-> Flagged (Steps f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NEMap Natural (f x) -> Steps f x
forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps (NEMap Natural (f x) -> Flagged (Steps f) x)
-> NEMap Natural (f x) -> Flagged (Steps f) x
forall a b. (a -> b) -> a -> b
$ Natural -> f x -> NEMap Natural (f x)
forall k a. k -> a -> NEMap k a
NEM.singleton Natural
1 f x
y
      These1 f x
x f x
y -> Bool -> Steps f x -> Flagged (Steps f) x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False (Steps f x -> Flagged (Steps f) x)
-> (NEMap Natural (f x) -> Steps f x)
-> NEMap Natural (f x)
-> Flagged (Steps f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NEMap Natural (f x) -> Steps f x
forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps (NEMap Natural (f x) -> Flagged (Steps f) x)
-> NEMap Natural (f x) -> Flagged (Steps f) x
forall a b. (a -> b) -> a -> b
$ NonEmpty (Natural, f x) -> NEMap Natural (f x)
forall k a. NonEmpty (k, a) -> NEMap k a
NEM.fromDistinctAscList (NonEmpty (Natural, f x) -> NEMap Natural (f x))
-> NonEmpty (Natural, f x) -> NEMap Natural (f x)
forall a b. (a -> b) -> a -> b
$ (Natural
0, f x
x) (Natural, f x) -> [(Natural, f x)] -> NonEmpty (Natural, f x)
forall a. a -> [a] -> NonEmpty a
:| [(Natural
1, f x
y)]
instance Alt f => SemigroupIn These1 f where
    biretract :: These1 f f ~> f
biretract = \case
      This1  f x
x   -> f x
x
      That1    f x
y -> f x
y
      These1 f x
x f x
y -> f x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> f x
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> These1 g h ~> f
binterpret g ~> f
f h ~> f
g = \case
      This1  g x
x   -> g x -> f x
g ~> f
f g x
x
      That1    h x
y -> h x -> f x
h ~> f
g h x
y
      These1 g x
x h x
y -> g x -> f x
g ~> f
f g x
x f x -> f x -> f x
forall a. f a -> f a -> f a
forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> h x -> f x
h ~> f
g h x
y
instance Associative Void3 where
    type NonEmptyBy Void3 = IdentityT
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Void3 f, FunctorBy Void3 g, FunctorBy Void3 h) =>
Void3 f (Void3 g h) <~> Void3 (Void3 f g) h
associating = (Void3 f (Void3 g h) ~> Void3 (Void3 f g) h)
-> (Void3 (Void3 f g) h ~> Void3 f (Void3 g h))
-> Void3 f (Void3 g h) <~> Void3 (Void3 f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Void3 f (Void3 g h) x -> Void3 (Void3 f g) h x
Void3 f (Void3 g h) ~> Void3 (Void3 f g) h
forall a b. Coercible a b => a -> b
coerce Void3 (Void3 f g) h x -> Void3 f (Void3 g h) x
Void3 (Void3 f g) h ~> Void3 f (Void3 g h)
forall a b. Coercible a b => a -> b
coerce
    appendNE :: forall (f :: * -> *).
Void3 (NonEmptyBy Void3 f) (NonEmptyBy Void3 f)
~> NonEmptyBy Void3 f
appendNE = \case {}
    matchNE :: forall (f :: * -> *).
FunctorBy Void3 f =>
NonEmptyBy Void3 f ~> (f :+: Void3 f (NonEmptyBy Void3 f))
matchNE  = f x -> (:+:) f (Void3 f (IdentityT f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (f x -> (:+:) f (Void3 f (IdentityT f)) x)
-> (IdentityT f x -> f x)
-> IdentityT f x
-> (:+:) f (Void3 f (IdentityT f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdentityT f x -> f x
forall {k} (f :: k -> *) (a :: k). IdentityT f a -> f a
runIdentityT
    consNE :: forall (f :: * -> *).
Void3 f (NonEmptyBy Void3 f) ~> NonEmptyBy Void3 f
consNE = \case {}
    toNonEmptyBy :: forall (f :: * -> *). Void3 f f ~> NonEmptyBy Void3 f
toNonEmptyBy   = \case {}
instance SemigroupIn Void3 f where
    biretract :: Void3 f f ~> f
biretract = \case {}
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Void3 g h ~> f
binterpret g ~> f
_ h ~> f
_ = \case {}
instance Associative Comp where
    type NonEmptyBy Comp = Free1
    type FunctorBy Comp = Functor
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Comp f, FunctorBy Comp g, FunctorBy Comp h) =>
Comp f (Comp g h) <~> Comp (Comp f g) h
associating = (Comp f (Comp g h) ~> Comp (Comp f g) h)
-> (Comp (Comp f g) h ~> Comp f (Comp g h))
-> Comp f (Comp g h) <~> Comp (Comp f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF Comp f (Comp g h) x -> Comp (Comp f g) h x
Comp f (Comp g h) ~> Comp (Comp f g) h
forall {k} {g :: * -> *} {f :: * -> *} {g :: k -> *} {a :: k}.
Functor g =>
Comp f (Comp g g) a -> Comp (Comp f g) g a
to_ Comp (Comp f g) h x -> Comp f (Comp g h) x
Comp (Comp f g) h ~> Comp f (Comp g h)
forall {k} {f :: * -> *} {g :: * -> *} {g :: k -> *} {a :: k}.
Comp (Comp f g) g a -> Comp f (Comp g g) a
from_
      where
        to_ :: Comp f (Comp g g) a -> Comp (Comp f g) g a
to_   (f x
x :>>= x -> Comp g g a
y) = (f x
x f x -> (x -> g (g a)) -> Comp f g (g a)
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= (Comp g g a -> g (g a)
forall {k} (f :: * -> *) (g :: k -> *) (a :: k).
Functor f =>
Comp f g a -> f (g a)
unComp (Comp g g a -> g (g a)) -> (x -> Comp g g a) -> x -> g (g a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> Comp g g a
y)) Comp f g (g a) -> (g a -> g a) -> Comp (Comp f g) g a
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= g a -> g a
forall a. a -> a
id
        from_ :: Comp (Comp f g) g a -> Comp f (Comp g g) a
from_ ((f x
x :>>= x -> g x
y) :>>= x -> g a
z) = f x
x f x -> (x -> Comp g g a) -> Comp f (Comp g g) a
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= ((g x -> (x -> g a) -> Comp g g a
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= x -> g a
z) (g x -> Comp g g a) -> (x -> g x) -> x -> Comp g g a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> g x
y)
    appendNE :: forall (f :: * -> *).
Comp (NonEmptyBy Comp f) (NonEmptyBy Comp f) ~> NonEmptyBy Comp f
appendNE (NonEmptyBy Comp f x
x :>>= x -> NonEmptyBy Comp f x
y) = Free1 f x
NonEmptyBy Comp f x
x Free1 f x -> (x -> Free1 f x) -> Free1 f x
forall a b. Free1 f a -> (a -> Free1 f b) -> Free1 f b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- x -> Free1 f x
x -> NonEmptyBy Comp f x
y
    matchNE :: forall (f :: * -> *).
FunctorBy Comp f =>
NonEmptyBy Comp f ~> (f :+: Comp f (NonEmptyBy Comp f))
matchNE = Free1 f x -> (:+:) f (Comp f (Free1 f)) x
NonEmptyBy Comp f x -> (:+:) f (Comp f (NonEmptyBy Comp f)) x
Free1 f ~> (f :+: Comp f (Free1 f))
forall (f :: * -> *).
Functor f =>
Free1 f ~> (f :+: Comp f (Free1 f))
matchFree1
    consNE :: forall (f :: * -> *).
Comp f (NonEmptyBy Comp f) ~> NonEmptyBy Comp f
consNE (f x
x :>>= x -> NonEmptyBy Comp f x
y) = f x -> Free1 f x
forall (f :: * -> *) x. f x -> Free1 f x
liftFree1 f x
x Free1 f x -> (x -> Free1 f x) -> Free1 f x
forall a b. Free1 f a -> (a -> Free1 f b) -> Free1 f b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- x -> Free1 f x
x -> NonEmptyBy Comp f x
y
    toNonEmptyBy :: forall (f :: * -> *). Comp f f ~> NonEmptyBy Comp f
toNonEmptyBy   (f x
x :>>= x -> f x
g) = f x -> Free1 f x
forall (f :: * -> *) x. f x -> Free1 f x
liftFree1 f x
x Free1 f x -> (x -> Free1 f x) -> Free1 f x
forall a b. Free1 f a -> (a -> Free1 f b) -> Free1 f b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- f x -> Free1 f x
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
forall (f :: * -> *) x. f x -> Free1 f x
inject (f x -> Free1 f x) -> (x -> f x) -> x -> Free1 f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> f x
g
instance Bind f => SemigroupIn Comp f where
    biretract :: Comp f f ~> f
biretract      (f x
x :>>= x -> f x
y) = f x
x f x -> (x -> f x) -> f x
forall a b. f a -> (a -> f b) -> f b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- x -> f x
y
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Comp g h ~> f
binterpret g ~> f
f h ~> f
g (g x
x :>>= x -> h x
y) = g x -> f x
g ~> f
f g x
x f x -> (x -> f x) -> f x
forall a b. f a -> (a -> f b) -> f b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- (h x -> f x
h ~> f
g (h x -> f x) -> (x -> h x) -> x -> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> h x
y)
instance Associative Joker where
    type NonEmptyBy Joker = Flagged
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy Joker f, FunctorBy Joker g, FunctorBy Joker h) =>
Joker f (Joker g h) <~> Joker (Joker f g) h
associating = (Joker f (Joker g h) ~> Joker (Joker f g) h)
-> (Joker (Joker f g) h ~> Joker f (Joker g h))
-> Joker f (Joker g h) <~> Joker (Joker f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (Joker f g x -> Joker (Joker f g) h x
forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker (Joker f g x -> Joker (Joker f g) h x)
-> (Joker f (Joker g h) x -> Joker f g x)
-> Joker f (Joker g h) x
-> Joker (Joker f g) h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> Joker f g x
forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker    (f x -> Joker f g x)
-> (Joker f (Joker g h) x -> f x)
-> Joker f (Joker g h) x
-> Joker f g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Joker f (Joker g h) x -> f x
forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker)
                       (f x -> Joker f (Joker g h) x
forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker (f x -> Joker f (Joker g h) x)
-> (Joker (Joker f g) h x -> f x)
-> Joker (Joker f g) h x
-> Joker f (Joker g h) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Joker f g x -> f x
forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker (Joker f g x -> f x)
-> (Joker (Joker f g) h x -> Joker f g x)
-> Joker (Joker f g) h x
-> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Joker (Joker f g) h x -> Joker f g x
forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker)
    appendNE :: forall (f :: * -> *).
Joker (NonEmptyBy Joker f) (NonEmptyBy Joker f)
~> NonEmptyBy Joker f
appendNE (Joker (Flagged Bool
_ f x
x)) = Bool -> f x -> Flagged f x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True f x
x
    matchNE :: forall (f :: * -> *).
FunctorBy Joker f =>
NonEmptyBy Joker f ~> (f :+: Joker f (NonEmptyBy Joker f))
matchNE (Flagged Bool
False f x
x) = f x -> (:+:) f (Joker f (Flagged f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
    matchNE (Flagged Bool
True  f x
x) = Joker f (NonEmptyBy Joker f) x
-> (:+:) f (Joker f (NonEmptyBy Joker f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Joker f (NonEmptyBy Joker f) x
 -> (:+:) f (Joker f (NonEmptyBy Joker f)) x)
-> Joker f (NonEmptyBy Joker f) x
-> (:+:) f (Joker f (NonEmptyBy Joker f)) x
forall a b. (a -> b) -> a -> b
$ f x -> Joker f (Flagged f) x
forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker f x
x
instance SemigroupIn Joker f where
    biretract :: Joker f f ~> f
biretract = Joker f f x -> f x
forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Joker g h ~> f
binterpret g ~> f
f h ~> f
_ = g x -> f x
g ~> f
f (g x -> f x) -> (Joker g h x -> g x) -> Joker g h x -> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Joker g h x -> g x
forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker
instance Associative LeftF where
    type NonEmptyBy LeftF = Flagged
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy LeftF f, FunctorBy LeftF g, FunctorBy LeftF h) =>
LeftF f (LeftF g h) <~> LeftF (LeftF f g) h
associating = (LeftF f (LeftF g h) ~> LeftF (LeftF f g) h)
-> (LeftF (LeftF f g) h ~> LeftF f (LeftF g h))
-> LeftF f (LeftF g h) <~> LeftF (LeftF f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (LeftF f g x -> LeftF (LeftF f g) h x
forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF (LeftF f g x -> LeftF (LeftF f g) h x)
-> (LeftF f (LeftF g h) x -> LeftF f g x)
-> LeftF f (LeftF g h) x
-> LeftF (LeftF f g) h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f x -> LeftF f g x
forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF    (f x -> LeftF f g x)
-> (LeftF f (LeftF g h) x -> f x)
-> LeftF f (LeftF g h) x
-> LeftF f g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF f (LeftF g h) x -> f x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF)
                       (f x -> LeftF f (LeftF g h) x
forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF (f x -> LeftF f (LeftF g h) x)
-> (LeftF (LeftF f g) h x -> f x)
-> LeftF (LeftF f g) h x
-> LeftF f (LeftF g h) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF f g x -> f x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF (LeftF f g x -> f x)
-> (LeftF (LeftF f g) h x -> LeftF f g x)
-> LeftF (LeftF f g) h x
-> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF (LeftF f g) h x -> LeftF f g x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF)
    appendNE :: forall (f :: * -> *).
LeftF (NonEmptyBy LeftF f) (NonEmptyBy LeftF f)
~> NonEmptyBy LeftF f
appendNE = (f ~> Flagged f) -> Flagged f ~> Flagged f
forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HBind t =>
(f ~> t g) -> t f ~> t g
forall (f :: * -> *) (g :: * -> *).
(f ~> Flagged g) -> Flagged f ~> Flagged g
hbind (Bool -> f x -> Flagged f x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True) (Flagged f x -> Flagged f x)
-> (LeftF (Flagged f) (Flagged f) x -> Flagged f x)
-> LeftF (Flagged f) (Flagged f) x
-> Flagged f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF (Flagged f) (Flagged f) x -> Flagged f x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF
    matchNE :: forall (f :: * -> *).
FunctorBy LeftF f =>
NonEmptyBy LeftF f ~> (f :+: LeftF f (NonEmptyBy LeftF f))
matchNE (Flagged Bool
False f x
x) = f x -> (:+:) f (LeftF f (Flagged f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
    matchNE (Flagged Bool
True  f x
x) = LeftF f (NonEmptyBy LeftF f) x
-> (:+:) f (LeftF f (NonEmptyBy LeftF f)) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (LeftF f (NonEmptyBy LeftF f) x
 -> (:+:) f (LeftF f (NonEmptyBy LeftF f)) x)
-> LeftF f (NonEmptyBy LeftF f) x
-> (:+:) f (LeftF f (NonEmptyBy LeftF f)) x
forall a b. (a -> b) -> a -> b
$ f x -> LeftF f (Flagged f) x
forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF f x
x
    consNE :: forall (f :: * -> *).
LeftF f (NonEmptyBy LeftF f) ~> NonEmptyBy LeftF f
consNE = Bool -> f x -> Flagged f x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True (f x -> Flagged f x)
-> (LeftF f (Flagged f) x -> f x)
-> LeftF f (Flagged f) x
-> Flagged f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF f (Flagged f) x -> f x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF
    toNonEmptyBy :: forall (f :: * -> *). LeftF f f ~> NonEmptyBy LeftF f
toNonEmptyBy   = Bool -> f x -> Flagged f x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True (f x -> Flagged f x)
-> (LeftF f f x -> f x) -> LeftF f f x -> Flagged f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF f f x -> f x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF
instance SemigroupIn LeftF f where
    biretract :: LeftF f f ~> f
biretract      = LeftF f f x -> f x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> LeftF g h ~> f
binterpret g ~> f
f h ~> f
_ = g x -> f x
g ~> f
f (g x -> f x) -> (LeftF g h x -> g x) -> LeftF g h x -> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeftF g h x -> g x
forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF
instance Associative RightF where
    type NonEmptyBy RightF = Step
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy RightF f, FunctorBy RightF g, FunctorBy RightF h) =>
RightF f (RightF g h) <~> RightF (RightF f g) h
associating = (RightF f (RightF g h) ~> RightF (RightF f g) h)
-> (RightF (RightF f g) h ~> RightF f (RightF g h))
-> RightF f (RightF g h) <~> RightF (RightF f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (h x -> RightF (RightF f g) h x
forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF (h x -> RightF (RightF f g) h x)
-> (RightF f (RightF g h) x -> h x)
-> RightF f (RightF g h) x
-> RightF (RightF f g) h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF g h x -> h x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF (RightF g h x -> h x)
-> (RightF f (RightF g h) x -> RightF g h x)
-> RightF f (RightF g h) x
-> h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF f (RightF g h) x -> RightF g h x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF)
                       (RightF g h x -> RightF f (RightF g h) x
forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF (RightF g h x -> RightF f (RightF g h) x)
-> (RightF (RightF f g) h x -> RightF g h x)
-> RightF (RightF f g) h x
-> RightF f (RightF g h) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. h x -> RightF g h x
forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF    (h x -> RightF g h x)
-> (RightF (RightF f g) h x -> h x)
-> RightF (RightF f g) h x
-> RightF g h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF (RightF f g) h x -> h x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF)
    appendNE :: forall (f :: * -> *).
RightF (NonEmptyBy RightF f) (NonEmptyBy RightF f)
~> NonEmptyBy RightF f
appendNE = (:+:) f (Step f) x -> Step f x
forall {k} (f :: k -> *) (x :: k). (:+:) f (Step f) x -> Step f x
stepUp ((:+:) f (Step f) x -> Step f x)
-> (RightF (Step f) (Step f) x -> (:+:) f (Step f) x)
-> RightF (Step f) (Step f) x
-> Step f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Step f x -> (:+:) f (Step f) x)
-> (RightF (Step f) (Step f) x -> Step f x)
-> RightF (Step f) (Step f) x
-> (:+:) f (Step f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF (Step f) (Step f) x -> Step f x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF
    matchNE :: forall (f :: * -> *).
FunctorBy RightF f =>
NonEmptyBy RightF f ~> (f :+: RightF f (NonEmptyBy RightF f))
matchNE  = (Step f ~> RightF f (Step f))
-> (f :+: Step f) ~> (f :+: RightF f (Step f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> (f :+: g) ~> (f :+: l)
hright Step f x -> RightF f (Step f) x
Step f ~> RightF f (Step f)
forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF ((:+:) f (Step f) x -> (:+:) f (RightF f (Step f)) x)
-> (Step f x -> (:+:) f (Step f) x)
-> Step f x
-> (:+:) f (RightF f (Step f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall {k} (f :: k -> *) (x :: k). Step f x -> (:+:) f (Step f) x
stepDown
    consNE :: forall (f :: * -> *).
RightF f (NonEmptyBy RightF f) ~> NonEmptyBy RightF f
consNE   = (:+:) f (Step f) x -> Step f x
forall {k} (f :: k -> *) (x :: k). (:+:) f (Step f) x -> Step f x
stepUp ((:+:) f (Step f) x -> Step f x)
-> (RightF f (Step f) x -> (:+:) f (Step f) x)
-> RightF f (Step f) x
-> Step f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Step f x -> (:+:) f (Step f) x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (Step f x -> (:+:) f (Step f) x)
-> (RightF f (Step f) x -> Step f x)
-> RightF f (Step f) x
-> (:+:) f (Step f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF f (Step f) x -> Step f x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF
    toNonEmptyBy :: forall (f :: * -> *). RightF f f ~> NonEmptyBy RightF f
toNonEmptyBy     = Natural -> f x -> Step f x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
1 (f x -> Step f x)
-> (RightF f f x -> f x) -> RightF f f x -> Step f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF f f x -> f x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF
instance SemigroupIn RightF f where
    biretract :: RightF f f ~> f
biretract      = RightF f f x -> f x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> RightF g h ~> f
binterpret g ~> f
_ h ~> f
g = h x -> f x
h ~> f
g (h x -> f x) -> (RightF g h x -> h x) -> RightF g h x -> f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RightF g h x -> h x
forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF
newtype WrapHBF t f g a = WrapHBF { forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF :: t f g a }
  deriving (Int -> WrapHBF t f g a -> ShowS
[WrapHBF t f g a] -> ShowS
WrapHBF t f g a -> String
(Int -> WrapHBF t f g a -> ShowS)
-> (WrapHBF t f g a -> String)
-> ([WrapHBF t f g a] -> ShowS)
-> Show (WrapHBF t f g a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Show (t f g a) =>
Int -> WrapHBF t f g a -> ShowS
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Show (t f g a) =>
[WrapHBF t f g a] -> ShowS
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Show (t f g a) =>
WrapHBF t f g a -> String
$cshowsPrec :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Show (t f g a) =>
Int -> WrapHBF t f g a -> ShowS
showsPrec :: Int -> WrapHBF t f g a -> ShowS
$cshow :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Show (t f g a) =>
WrapHBF t f g a -> String
show :: WrapHBF t f g a -> String
$cshowList :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Show (t f g a) =>
[WrapHBF t f g a] -> ShowS
showList :: [WrapHBF t f g a] -> ShowS
Show, ReadPrec [WrapHBF t f g a]
ReadPrec (WrapHBF t f g a)
Int -> ReadS (WrapHBF t f g a)
ReadS [WrapHBF t f g a]
(Int -> ReadS (WrapHBF t f g a))
-> ReadS [WrapHBF t f g a]
-> ReadPrec (WrapHBF t f g a)
-> ReadPrec [WrapHBF t f g a]
-> Read (WrapHBF t f g a)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
ReadPrec [WrapHBF t f g a]
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
ReadPrec (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
Int -> ReadS (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
ReadS [WrapHBF t f g a]
$creadsPrec :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
Int -> ReadS (WrapHBF t f g a)
readsPrec :: Int -> ReadS (WrapHBF t f g a)
$creadList :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
ReadS [WrapHBF t f g a]
readList :: ReadS [WrapHBF t f g a]
$creadPrec :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
ReadPrec (WrapHBF t f g a)
readPrec :: ReadPrec (WrapHBF t f g a)
$creadListPrec :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Read (t f g a) =>
ReadPrec [WrapHBF t f g a]
readListPrec :: ReadPrec [WrapHBF t f g a]
Read, WrapHBF t f g a -> WrapHBF t f g a -> Bool
(WrapHBF t f g a -> WrapHBF t f g a -> Bool)
-> (WrapHBF t f g a -> WrapHBF t f g a -> Bool)
-> Eq (WrapHBF t f g a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Eq (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
$c== :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Eq (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
== :: WrapHBF t f g a -> WrapHBF t f g a -> Bool
$c/= :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Eq (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
/= :: WrapHBF t f g a -> WrapHBF t f g a -> Bool
Eq, Eq (WrapHBF t f g a)
Eq (WrapHBF t f g a) =>
(WrapHBF t f g a -> WrapHBF t f g a -> Ordering)
-> (WrapHBF t f g a -> WrapHBF t f g a -> Bool)
-> (WrapHBF t f g a -> WrapHBF t f g a -> Bool)
-> (WrapHBF t f g a -> WrapHBF t f g a -> Bool)
-> (WrapHBF t f g a -> WrapHBF t f g a -> Bool)
-> (WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a)
-> (WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a)
-> Ord (WrapHBF t f g a)
WrapHBF t f g a -> WrapHBF t f g a -> Bool
WrapHBF t f g a -> WrapHBF t f g a -> Ordering
WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g 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 k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
Eq (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Ordering
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a
$ccompare :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Ordering
compare :: WrapHBF t f g a -> WrapHBF t f g a -> Ordering
$c< :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
< :: WrapHBF t f g a -> WrapHBF t f g a -> Bool
$c<= :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
<= :: WrapHBF t f g a -> WrapHBF t f g a -> Bool
$c> :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
> :: WrapHBF t f g a -> WrapHBF t f g a -> Bool
$c>= :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> Bool
>= :: WrapHBF t f g a -> WrapHBF t f g a -> Bool
$cmax :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a
max :: WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a
$cmin :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
Ord (t f g a) =>
WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a
min :: WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a
Ord, (forall a b. (a -> b) -> WrapHBF t f g a -> WrapHBF t f g b)
-> (forall a b. a -> WrapHBF t f g b -> WrapHBF t f g a)
-> Functor (WrapHBF t f g)
forall a b. a -> WrapHBF t f g b -> WrapHBF t f g a
forall a b. (a -> b) -> WrapHBF t f g a -> WrapHBF t f g b
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Functor (t f g) =>
a -> WrapHBF t f g b -> WrapHBF t f g a
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Functor (t f g) =>
(a -> b) -> WrapHBF t f g a -> WrapHBF t f g b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Functor (t f g) =>
(a -> b) -> WrapHBF t f g a -> WrapHBF t f g b
fmap :: forall a b. (a -> b) -> WrapHBF t f g a -> WrapHBF t f g b
$c<$ :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Functor (t f g) =>
a -> WrapHBF t f g b -> WrapHBF t f g a
<$ :: forall a b. a -> WrapHBF t f g b -> WrapHBF t f g a
Functor, (forall m. Monoid m => WrapHBF t f g m -> m)
-> (forall m a. Monoid m => (a -> m) -> WrapHBF t f g a -> m)
-> (forall m a. Monoid m => (a -> m) -> WrapHBF t f g a -> m)
-> (forall a b. (a -> b -> b) -> b -> WrapHBF t f g a -> b)
-> (forall a b. (a -> b -> b) -> b -> WrapHBF t f g a -> b)
-> (forall b a. (b -> a -> b) -> b -> WrapHBF t f g a -> b)
-> (forall b a. (b -> a -> b) -> b -> WrapHBF t f g a -> b)
-> (forall a. (a -> a -> a) -> WrapHBF t f g a -> a)
-> (forall a. (a -> a -> a) -> WrapHBF t f g a -> a)
-> (forall a. WrapHBF t f g a -> [a])
-> (forall a. WrapHBF t f g a -> Bool)
-> (forall a. WrapHBF t f g a -> Int)
-> (forall a. Eq a => a -> WrapHBF t f g a -> Bool)
-> (forall a. Ord a => WrapHBF t f g a -> a)
-> (forall a. Ord a => WrapHBF t f g a -> a)
-> (forall a. Num a => WrapHBF t f g a -> a)
-> (forall a. Num a => WrapHBF t f g a -> a)
-> Foldable (WrapHBF t f g)
forall a. Eq a => a -> WrapHBF t f g a -> Bool
forall a. Num a => WrapHBF t f g a -> a
forall a. Ord a => WrapHBF t f g a -> a
forall m. Monoid m => WrapHBF t f g m -> m
forall a. WrapHBF t f g a -> Bool
forall a. WrapHBF t f g a -> Int
forall a. WrapHBF t f g a -> [a]
forall a. (a -> a -> a) -> WrapHBF t f g a -> a
forall m a. Monoid m => (a -> m) -> WrapHBF t f g a -> m
forall b a. (b -> a -> b) -> b -> WrapHBF t f g a -> b
forall a b. (a -> b -> b) -> b -> WrapHBF t f g a -> b
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Eq a) =>
a -> WrapHBF t f g a -> Bool
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Num a) =>
WrapHBF t f g a -> a
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Ord a) =>
WrapHBF t f g a -> a
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) m.
(Foldable (t f g), Monoid m) =>
WrapHBF t f g m -> m
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> Bool
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> Int
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> [a]
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
(a -> a -> a) -> WrapHBF t f g a -> a
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) m a.
(Foldable (t f g), Monoid m) =>
(a -> m) -> WrapHBF t f g a -> m
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) b a.
Foldable (t f g) =>
(b -> a -> b) -> b -> WrapHBF t f g a -> b
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Foldable (t f g) =>
(a -> b -> b) -> b -> WrapHBF t f g 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
$cfold :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) m.
(Foldable (t f g), Monoid m) =>
WrapHBF t f g m -> m
fold :: forall m. Monoid m => WrapHBF t f g m -> m
$cfoldMap :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) m a.
(Foldable (t f g), Monoid m) =>
(a -> m) -> WrapHBF t f g a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> WrapHBF t f g a -> m
$cfoldMap' :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) m a.
(Foldable (t f g), Monoid m) =>
(a -> m) -> WrapHBF t f g a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> WrapHBF t f g a -> m
$cfoldr :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Foldable (t f g) =>
(a -> b -> b) -> b -> WrapHBF t f g a -> b
foldr :: forall a b. (a -> b -> b) -> b -> WrapHBF t f g a -> b
$cfoldr' :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a b.
Foldable (t f g) =>
(a -> b -> b) -> b -> WrapHBF t f g a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> WrapHBF t f g a -> b
$cfoldl :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) b a.
Foldable (t f g) =>
(b -> a -> b) -> b -> WrapHBF t f g a -> b
foldl :: forall b a. (b -> a -> b) -> b -> WrapHBF t f g a -> b
$cfoldl' :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) b a.
Foldable (t f g) =>
(b -> a -> b) -> b -> WrapHBF t f g a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> WrapHBF t f g a -> b
$cfoldr1 :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
(a -> a -> a) -> WrapHBF t f g a -> a
foldr1 :: forall a. (a -> a -> a) -> WrapHBF t f g a -> a
$cfoldl1 :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
(a -> a -> a) -> WrapHBF t f g a -> a
foldl1 :: forall a. (a -> a -> a) -> WrapHBF t f g a -> a
$ctoList :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> [a]
toList :: forall a. WrapHBF t f g a -> [a]
$cnull :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> Bool
null :: forall a. WrapHBF t f g a -> Bool
$clength :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> Int
length :: forall a. WrapHBF t f g a -> Int
$celem :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Eq a) =>
a -> WrapHBF t f g a -> Bool
elem :: forall a. Eq a => a -> WrapHBF t f g a -> Bool
$cmaximum :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Ord a) =>
WrapHBF t f g a -> a
maximum :: forall a. Ord a => WrapHBF t f g a -> a
$cminimum :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Ord a) =>
WrapHBF t f g a -> a
minimum :: forall a. Ord a => WrapHBF t f g a -> a
$csum :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Num a) =>
WrapHBF t f g a -> a
sum :: forall a. Num a => WrapHBF t f g a -> a
$cproduct :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Num a) =>
WrapHBF t f g a -> a
product :: forall a. Num a => WrapHBF t f g a -> a
Foldable, Functor (WrapHBF t f g)
Foldable (WrapHBF t f g)
(Functor (WrapHBF t f g), Foldable (WrapHBF t f g)) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> WrapHBF t f g a -> f (WrapHBF t f g b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    WrapHBF t f g (f a) -> f (WrapHBF t f g a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> WrapHBF t f g a -> m (WrapHBF t f g b))
-> (forall (m :: * -> *) a.
    Monad m =>
    WrapHBF t f g (m a) -> m (WrapHBF t f g a))
-> Traversable (WrapHBF t f g)
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k).
Traversable (t f g) =>
Functor (WrapHBF t f g)
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k).
Traversable (t f g) =>
Foldable (WrapHBF t f g)
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (m :: * -> *)
       a.
(Traversable (t f g), Monad m) =>
WrapHBF t f g (m a) -> m (WrapHBF t f g a)
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (f :: * -> *)
       a.
(Traversable (t f g), Applicative f) =>
WrapHBF t f g (f a) -> f (WrapHBF t f g a)
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (m :: * -> *)
       a b.
(Traversable (t f g), Monad m) =>
(a -> m b) -> WrapHBF t f g a -> m (WrapHBF t f g b)
forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (f :: * -> *)
       a b.
(Traversable (t f g), Applicative f) =>
(a -> f b) -> WrapHBF t f g a -> f (WrapHBF t f g 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 =>
WrapHBF t f g (m a) -> m (WrapHBF t f g a)
forall (f :: * -> *) a.
Applicative f =>
WrapHBF t f g (f a) -> f (WrapHBF t f g a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WrapHBF t f g a -> m (WrapHBF t f g b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WrapHBF t f g a -> f (WrapHBF t f g b)
$ctraverse :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (f :: * -> *)
       a b.
(Traversable (t f g), Applicative f) =>
(a -> f b) -> WrapHBF t f g a -> f (WrapHBF t f g b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WrapHBF t f g a -> f (WrapHBF t f g b)
$csequenceA :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (f :: * -> *)
       a.
(Traversable (t f g), Applicative f) =>
WrapHBF t f g (f a) -> f (WrapHBF t f g a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
WrapHBF t f g (f a) -> f (WrapHBF t f g a)
$cmapM :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (m :: * -> *)
       a b.
(Traversable (t f g), Monad m) =>
(a -> m b) -> WrapHBF t f g a -> m (WrapHBF t f g b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WrapHBF t f g a -> m (WrapHBF t f g b)
$csequence :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) (m :: * -> *)
       a.
(Traversable (t f g), Monad m) =>
WrapHBF t f g (m a) -> m (WrapHBF t f g a)
sequence :: forall (m :: * -> *) a.
Monad m =>
WrapHBF t f g (m a) -> m (WrapHBF t f g a)
Traversable, Typeable, (forall x. WrapHBF t f g a -> Rep (WrapHBF t f g a) x)
-> (forall x. Rep (WrapHBF t f g a) x -> WrapHBF t f g a)
-> Generic (WrapHBF t f g a)
forall x. Rep (WrapHBF t f g a) x -> WrapHBF t f g a
forall x. WrapHBF t f g a -> Rep (WrapHBF t f g a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) x.
Rep (WrapHBF t f g a) x -> WrapHBF t f g a
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) x.
WrapHBF t f g a -> Rep (WrapHBF t f g a) x
$cfrom :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) x.
WrapHBF t f g a -> Rep (WrapHBF t f g a) x
from :: forall x. WrapHBF t f g a -> Rep (WrapHBF t f g a) x
$cto :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) x.
Rep (WrapHBF t f g a) x -> WrapHBF t f g a
to :: forall x. Rep (WrapHBF t f g a) x -> WrapHBF t f g a
Generic, Typeable (WrapHBF t f g a)
Typeable (WrapHBF t f g a) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> WrapHBF t f g a -> c (WrapHBF t f g a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (WrapHBF t f g a))
-> (WrapHBF t f g a -> Constr)
-> (WrapHBF t f g a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (WrapHBF t f g a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (WrapHBF t f g a)))
-> ((forall b. Data b => b -> b)
    -> WrapHBF t f g a -> WrapHBF t f g a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> WrapHBF t f g a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> WrapHBF t f g a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> WrapHBF t f g a -> m (WrapHBF t f g a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WrapHBF t f g a -> m (WrapHBF t f g a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WrapHBF t f g a -> m (WrapHBF t f g a))
-> Data (WrapHBF t f g a)
WrapHBF t f g a -> Constr
WrapHBF t f g a -> DataType
(forall b. Data b => b -> b) -> WrapHBF t f g a -> WrapHBF t f g 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 u.
Int -> (forall d. Data d => d -> u) -> WrapHBF t f g a -> u
forall u. (forall d. Data d => d -> u) -> WrapHBF t f g a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
Typeable (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
WrapHBF t f g a -> Constr
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
WrapHBF t f g a -> DataType
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall b. Data b => b -> b) -> WrapHBF t f g a -> WrapHBF t f g a
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) u.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
Int -> (forall d. Data d => d -> u) -> WrapHBF t f g a -> u
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) u.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall d. Data d => d -> u) -> WrapHBF t f g a -> [u]
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) r
       r'.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) r
       r'.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (m :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), Monad m) =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (m :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrapHBF t f g a -> c (WrapHBF t f g a)
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WrapHBF t f g a))
forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrapHBF t f g a))
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrapHBF t f g a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrapHBF t f g a -> c (WrapHBF t f g a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WrapHBF t f g a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrapHBF t f g a))
$cgfoldl :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrapHBF t f g a -> c (WrapHBF t f g a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrapHBF t f g a -> c (WrapHBF t f g a)
$cgunfold :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrapHBF t f g a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrapHBF t f g a)
$ctoConstr :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
WrapHBF t f g a -> Constr
toConstr :: WrapHBF t f g a -> Constr
$cdataTypeOf :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
WrapHBF t f g a -> DataType
dataTypeOf :: WrapHBF t f g a -> DataType
$cdataCast1 :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WrapHBF t f g a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WrapHBF t f g a))
$cdataCast2 :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrapHBF t f g a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrapHBF t f g a))
$cgmapT :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall b. Data b => b -> b) -> WrapHBF t f g a -> WrapHBF t f g a
gmapT :: (forall b. Data b => b -> b) -> WrapHBF t f g a -> WrapHBF t f g a
$cgmapQl :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) r
       r'.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
$cgmapQr :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) r
       r'.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
$cgmapQ :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) u.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
(forall d. Data d => d -> u) -> WrapHBF t f g a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> WrapHBF t f g a -> [u]
$cgmapQi :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k) u.
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a)) =>
Int -> (forall d. Data d => d -> u) -> WrapHBF t f g a -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> WrapHBF t f g a -> u
$cgmapM :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (m :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), Monad m) =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
$cgmapMp :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (m :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
$cgmapMo :: forall k k k (t :: k -> k -> k -> *) (f :: k) (g :: k) (a :: k)
       (m :: * -> *).
(Typeable f, Typeable g, Typeable a, Typeable t, Typeable k,
 Typeable k, Typeable k, Data (t f g a), MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
Data)
instance Show1 (t f g) => Show1 (WrapHBF t f g) where
    liftShowsPrec :: forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> WrapHBF t f g a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl Int
d (WrapHBF t f g a
x) = (Int -> t f g a -> ShowS) -> String -> Int -> t f g a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> t f g a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> t f g a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl) String
"WrapHBF" Int
d t f g a
x
instance Eq1 (t f g) => Eq1 (WrapHBF t f g) where
    liftEq :: forall a b.
(a -> b -> Bool) -> WrapHBF t f g a -> WrapHBF t f g b -> Bool
liftEq a -> b -> Bool
eq (WrapHBF t f g a
x) (WrapHBF t f g b
y) = (a -> b -> Bool) -> t f g a -> t f g b -> Bool
forall a b. (a -> b -> Bool) -> t f g a -> t f g b -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> b -> Bool
eq t f g a
x t f g b
y
instance Ord1 (t f g) => Ord1 (WrapHBF t f g) where
    liftCompare :: forall a b.
(a -> b -> Ordering)
-> WrapHBF t f g a -> WrapHBF t f g b -> Ordering
liftCompare a -> b -> Ordering
c (WrapHBF t f g a
x) (WrapHBF t f g b
y) = (a -> b -> Ordering) -> t f g a -> t f g b -> Ordering
forall a b. (a -> b -> Ordering) -> t f g a -> t f g b -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> b -> Ordering
c t f g a
x t f g b
y
instance HBifunctor t => HBifunctor (WrapHBF t) where
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> WrapHBF t f g ~> WrapHBF t j l
hbimap f ~> j
f g ~> l
g (WrapHBF t f g x
x) = t j l x -> WrapHBF t j l x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF ((f ~> j) -> (g ~> l) -> t f g ~> t j l
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> t f g ~> t j l
hbimap f x -> j x
f ~> j
f g x -> l x
g ~> l
g t f g x
x)
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> WrapHBF t f g ~> WrapHBF t j g
hleft f ~> j
f (WrapHBF t f g x
x) = t j g x -> WrapHBF t j g x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF ((f ~> j) -> t f g ~> t j g
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> t f g ~> t j g
hleft f x -> j x
f ~> j
f t f g x
x)
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> WrapHBF t f g ~> WrapHBF t f l
hright g ~> l
g (WrapHBF t f g x
x) = t f l x -> WrapHBF t f l x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF ((g ~> l) -> t f g ~> t f l
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> t f g ~> t f l
hright g x -> l x
g ~> l
g t f g x
x)
deriving via (WrappedHBifunctor (WrapHBF t) f)
    instance HBifunctor t => HFunctor (WrapHBF t f)
instance Associative t => Associative (WrapHBF t) where
    type NonEmptyBy (WrapHBF t) = NonEmptyBy t
    type FunctorBy (WrapHBF t) = FunctorBy t
    associating :: forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
(FunctorBy (WrapHBF t) f, FunctorBy (WrapHBF t) g,
 FunctorBy (WrapHBF t) h) =>
WrapHBF t f (WrapHBF t g h) <~> WrapHBF t (WrapHBF t f g) h
associating = (WrapHBF t f (WrapHBF t g h) ~> t f (t g h))
-> (t f (t g h) ~> WrapHBF t f (WrapHBF t g h))
-> WrapHBF t f (WrapHBF t g h) <~> t f (t g h)
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF ((WrapHBF t g h ~> t g h) -> t f (WrapHBF t g h) ~> t f (t g h)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> t f g ~> t f l
hright WrapHBF t g h x -> t g h x
WrapHBF t g h ~> t g h
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF (t f (WrapHBF t g h) x -> t f (t g h) x)
-> (WrapHBF t f (WrapHBF t g h) x -> t f (WrapHBF t g h) x)
-> WrapHBF t f (WrapHBF t g h) x
-> t f (t g h) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapHBF t f (WrapHBF t g h) x -> t f (WrapHBF t g h) x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF) (t f (WrapHBF t g h) x -> WrapHBF t f (WrapHBF t g h) x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF (t f (WrapHBF t g h) x -> WrapHBF t f (WrapHBF t g h) x)
-> (t f (t g h) x -> t f (WrapHBF t g h) x)
-> t f (t g h) x
-> WrapHBF t f (WrapHBF t g h) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (t g h ~> WrapHBF t g h) -> t f (t g h) ~> t f (WrapHBF t g h)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> t f g ~> t f l
hright t g h x -> WrapHBF t g h x
t g h ~> WrapHBF t g h
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF)
                (p (t f (t g h) a) (t f (t g h) a)
 -> p (WrapHBF t f (WrapHBF t g h) a)
      (WrapHBF t f (WrapHBF t g h) a))
-> (p (WrapHBF t (WrapHBF t f g) h a)
      (WrapHBF t (WrapHBF t f g) h a)
    -> p (t f (t g h) a) (t f (t g h) a))
-> p (WrapHBF t (WrapHBF t f g) h a)
     (WrapHBF t (WrapHBF t f g) h a)
-> p (WrapHBF t f (WrapHBF t g h) a)
     (WrapHBF t f (WrapHBF t g h) a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Associative t, FunctorBy t f, FunctorBy t g, FunctorBy t h) =>
t f (t g h) <~> t (t f g) h
associating @t
                (p (t (t f g) h a) (t (t f g) h a)
 -> p (t f (t g h) a) (t f (t g h) a))
-> (p (WrapHBF t (WrapHBF t f g) h a)
      (WrapHBF t (WrapHBF t f g) h a)
    -> p (t (t f g) h a) (t (t f g) h a))
-> p (WrapHBF t (WrapHBF t f g) h a)
     (WrapHBF t (WrapHBF t f g) h a)
-> p (t f (t g h) a) (t f (t g h) a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (t (t f g) h ~> WrapHBF t (WrapHBF t f g) h)
-> (WrapHBF t (WrapHBF t f g) h ~> t (t f g) h)
-> t (t f g) h <~> WrapHBF t (WrapHBF t f g) h
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (t (WrapHBF t f g) h x -> WrapHBF t (WrapHBF t f g) h x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF (t (WrapHBF t f g) h x -> WrapHBF t (WrapHBF t f g) h x)
-> (t (t f g) h x -> t (WrapHBF t f g) h x)
-> t (t f g) h x
-> WrapHBF t (WrapHBF t f g) h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (t f g ~> WrapHBF t f g) -> t (t f g) h ~> t (WrapHBF t f g) h
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> t f g ~> t j g
hleft t f g x -> WrapHBF t f g x
t f g ~> WrapHBF t f g
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF) ((WrapHBF t f g ~> t f g) -> t (WrapHBF t f g) h ~> t (t f g) h
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> t f g ~> t j g
hleft WrapHBF t f g x -> t f g x
WrapHBF t f g ~> t f g
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF (t (WrapHBF t f g) h x -> t (t f g) h x)
-> (WrapHBF t (WrapHBF t f g) h x -> t (WrapHBF t f g) h x)
-> WrapHBF t (WrapHBF t f g) h x
-> t (t f g) h x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapHBF t (WrapHBF t f g) h x -> t (WrapHBF t f g) h x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF)
    appendNE :: forall (f :: * -> *).
WrapHBF t (NonEmptyBy (WrapHBF t) f) (NonEmptyBy (WrapHBF t) f)
~> NonEmptyBy (WrapHBF t) f
appendNE     = t (NonEmptyBy t f) (NonEmptyBy t f) x -> NonEmptyBy t f x
forall (f :: * -> *).
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
appendNE (t (NonEmptyBy t f) (NonEmptyBy t f) x -> NonEmptyBy t f x)
-> (WrapHBF t (NonEmptyBy t f) (NonEmptyBy t f) x
    -> t (NonEmptyBy t f) (NonEmptyBy t f) x)
-> WrapHBF t (NonEmptyBy t f) (NonEmptyBy t f) x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapHBF t (NonEmptyBy t f) (NonEmptyBy t f) x
-> t (NonEmptyBy t f) (NonEmptyBy t f) x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF
    matchNE :: forall (f :: * -> *).
FunctorBy (WrapHBF t) f =>
NonEmptyBy (WrapHBF t) f
~> (f :+: WrapHBF t f (NonEmptyBy (WrapHBF t) f))
matchNE      = (t f (NonEmptyBy t f) ~> WrapHBF t f (NonEmptyBy t f))
-> (f :+: t f (NonEmptyBy t f))
   ~> (f :+: WrapHBF t f (NonEmptyBy t f))
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> (f :+: g) ~> (f :+: l)
hright t f (NonEmptyBy t f) x -> WrapHBF t f (NonEmptyBy t f) x
t f (NonEmptyBy t f) ~> WrapHBF t f (NonEmptyBy t f)
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
t f g a -> WrapHBF t f g a
WrapHBF ((:+:) f (t f (NonEmptyBy t f)) x
 -> (:+:) f (WrapHBF t f (NonEmptyBy t f)) x)
-> (NonEmptyBy t f x -> (:+:) f (t f (NonEmptyBy t f)) x)
-> NonEmptyBy t f x
-> (:+:) f (WrapHBF t f (NonEmptyBy t f)) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyBy t f x -> (:+:) f (t f (NonEmptyBy t f)) x
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
forall (f :: * -> *).
FunctorBy t f =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
(Associative t, FunctorBy t f) =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
matchNE
    consNE :: forall (f :: * -> *).
WrapHBF t f (NonEmptyBy (WrapHBF t) f) ~> NonEmptyBy (WrapHBF t) f
consNE       = t f (NonEmptyBy t f) x -> NonEmptyBy t f x
forall (f :: * -> *). t f (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE (t f (NonEmptyBy t f) x -> NonEmptyBy t f x)
-> (WrapHBF t f (NonEmptyBy t f) x -> t f (NonEmptyBy t f) x)
-> WrapHBF t f (NonEmptyBy t f) x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapHBF t f (NonEmptyBy t f) x -> t f (NonEmptyBy t f) x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF
    toNonEmptyBy :: forall (f :: * -> *). WrapHBF t f f ~> NonEmptyBy (WrapHBF t) f
toNonEmptyBy = t f f x -> NonEmptyBy t f x
forall (f :: * -> *). t f f ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f f ~> NonEmptyBy t f
toNonEmptyBy (t f f x -> NonEmptyBy t f x)
-> (WrapHBF t f f x -> t f f x)
-> WrapHBF t f f x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapHBF t f f x -> t f f x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF
newtype WrapNE t f a = WrapNE { forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
WrapNE t f a -> NonEmptyBy t f a
unwrapNE :: NonEmptyBy t f a }
instance Functor (NonEmptyBy t f) => Functor (WrapNE t f) where
    fmap :: forall a b. (a -> b) -> WrapNE t f a -> WrapNE t f b
fmap a -> b
f (WrapNE NonEmptyBy t f a
x) = NonEmptyBy t f b -> WrapNE t f b
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE ((a -> b) -> NonEmptyBy t f a -> NonEmptyBy t f b
forall a b. (a -> b) -> NonEmptyBy t f a -> NonEmptyBy t f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f NonEmptyBy t f a
x)
instance Contravariant (NonEmptyBy t f) => Contravariant (WrapNE t f) where
    contramap :: forall a' a. (a' -> a) -> WrapNE t f a -> WrapNE t f a'
contramap a' -> a
f (WrapNE NonEmptyBy t f a
x) = NonEmptyBy t f a' -> WrapNE t f a'
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE ((a' -> a) -> NonEmptyBy t f a -> NonEmptyBy t f a'
forall a' a. (a' -> a) -> NonEmptyBy t f a -> NonEmptyBy t f a'
forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a' -> a
f NonEmptyBy t f a
x)
instance Invariant (NonEmptyBy t f) => Invariant (WrapNE t f) where
    invmap :: forall a b. (a -> b) -> (b -> a) -> WrapNE t f a -> WrapNE t f b
invmap a -> b
f b -> a
g (WrapNE NonEmptyBy t f a
x) = NonEmptyBy t f b -> WrapNE t f b
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE ((a -> b) -> (b -> a) -> NonEmptyBy t f a -> NonEmptyBy t f b
forall a b.
(a -> b) -> (b -> a) -> NonEmptyBy t f a -> NonEmptyBy t f b
forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g NonEmptyBy t f a
x)
instance (Associative t, FunctorBy t f, FunctorBy t (WrapNE t f)) => SemigroupIn (WrapHBF t) (WrapNE t f) where
    biretract :: WrapHBF t (WrapNE t f) (WrapNE t f) ~> WrapNE t f
biretract = NonEmptyBy t f x -> WrapNE t f x
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE (NonEmptyBy t f x -> WrapNE t f x)
-> (WrapHBF t (WrapNE t f) (WrapNE t f) x -> NonEmptyBy t f x)
-> WrapHBF t (WrapNE t f) (WrapNE t f) x
-> WrapNE t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t (NonEmptyBy t f) (NonEmptyBy t f) x -> NonEmptyBy t f x
forall (f :: * -> *).
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
appendNE (t (NonEmptyBy t f) (NonEmptyBy t f) x -> NonEmptyBy t f x)
-> (WrapHBF t (WrapNE t f) (WrapNE t f) x
    -> t (NonEmptyBy t f) (NonEmptyBy t f) x)
-> WrapHBF t (WrapNE t f) (WrapNE t f) x
-> NonEmptyBy t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WrapNE t f ~> NonEmptyBy t f)
-> (WrapNE t f ~> NonEmptyBy t f)
-> t (WrapNE t f) (WrapNE t f)
   ~> t (NonEmptyBy t f) (NonEmptyBy t f)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> t f g ~> t j l
hbimap WrapNE t f x -> NonEmptyBy t f x
WrapNE t f ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
WrapNE t f a -> NonEmptyBy t f a
unwrapNE WrapNE t f x -> NonEmptyBy t f x
WrapNE t f ~> NonEmptyBy t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
WrapNE t f a -> NonEmptyBy t f a
unwrapNE (t (WrapNE t f) (WrapNE t f) x
 -> t (NonEmptyBy t f) (NonEmptyBy t f) x)
-> (WrapHBF t (WrapNE t f) (WrapNE t f) x
    -> t (WrapNE t f) (WrapNE t f) x)
-> WrapHBF t (WrapNE t f) (WrapNE t f) x
-> t (NonEmptyBy t f) (NonEmptyBy t f) x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrapHBF t (WrapNE t f) (WrapNE t f) x
-> t (WrapNE t f) (WrapNE t f) x
forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
       (a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF
    binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> WrapNE t f)
-> (h ~> WrapNE t f) -> WrapHBF t g h ~> WrapNE t f
binterpret g ~> WrapNE t f
f h ~> WrapNE t f
g = WrapHBF t (WrapNE t f) (WrapNE t f) x -> WrapNE t f x
WrapHBF t (WrapNE t f) (WrapNE t f) ~> WrapNE t f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
t f f ~> f
biretract (WrapHBF t (WrapNE t f) (WrapNE t f) x -> WrapNE t f x)
-> (WrapHBF t g h x -> WrapHBF t (WrapNE t f) (WrapNE t f) x)
-> WrapHBF t g h x
-> WrapNE t f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (g ~> WrapNE t f)
-> (h ~> WrapNE t f)
-> WrapHBF t g h ~> WrapHBF t (WrapNE t f) (WrapNE t f)
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> WrapHBF t f g ~> WrapHBF t j l
hbimap g x -> WrapNE t f x
g ~> WrapNE t f
f h x -> WrapNE t f x
h ~> WrapNE t f
g