{-# 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 = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
appendNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
hleft forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
inject
toNonEmptyBy :: t f f ~> NonEmptyBy t f
toNonEmptyBy = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> 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 = forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> f ~> g
viewF 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 = forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> g ~> f
reviewF 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 = forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Interpret t f =>
t f ~> f
retract forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> 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 = forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Interpret t f =>
t f ~> f
retract forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f f ~> NonEmptyBy t f
toNonEmptyBy forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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
hbimap g ~> f
f 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 = (forall a. a -> a
id 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 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright (forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
NonEmptyBy t f ~> f
retractNE @t))
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 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k1} (t :: (k -> *) -> k1 -> *) (f :: k -> *)
(g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
hmap 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
(Associative t, FunctorBy t f) =>
NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
matchNE (forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
inject forall (t :: (* -> *) -> (* -> *) -> * -> *) (h :: * -> *)
(f :: * -> *) (g :: * -> *).
SemigroupIn t h =>
(f ~> h) -> (g ~> h) -> t f g ~> h
!*! 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 = forall {k} w (a :: k). AltConst w a -> w
getAltConst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
(g :: * -> *) (h :: * -> *).
SemigroupIn t f =>
(g ~> f) -> (h ~> f) -> t g h ~> f
binterpret (forall {k} w (a :: k). w -> AltConst w a
AltConst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. f x -> b
f) (forall {k} w (a :: k). w -> AltConst w a
AltConst forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 (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
(!*!) = 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 ~> h
f f x
x
R1 g x
y -> 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 = forall a b. Op a b -> b -> a
getOp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
(g :: * -> *) (h :: * -> *).
SemigroupIn t f =>
(g ~> f) -> (h ~> f) -> t g h ~> f
binterpret (forall a b. (b -> a) -> Op a b
Op forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. f x -> x -> b
f) (forall a b. (b -> a) -> Op a b
Op forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {p :: k}.
(:*:) f (g :*: g) p -> (:*:) (f :*: g) g p
to_ 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 forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g p
y) 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 forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (f p
y 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) = forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x)
xs 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 -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
y
R1 NonEmptyF f x
zs -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ f x
y 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 = forall {k} (f :: k -> *). ListF f ~> (Proxy :+: NonEmptyF f)
fromListF forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
`hright` forall {k} (f :: k -> *) (a :: k).
NonEmptyF f a -> (:*:) f (ListF f) a
nonEmptyProd NonEmptyBy (:*:) f x
x
consNE :: forall (f :: * -> *).
(f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f
consNE (f x
x :*: NonEmptyF NonEmpty (f x)
xs) = forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF forall a b. (a -> b) -> a -> b
$ f x
x forall a. a -> [a] -> NonEmpty 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 ) = forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF forall a b. (a -> b) -> a -> b
$ f x
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 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 ~> f
f g x
x forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {a :: k}.
Product f (Product g g) a -> Product (Product f g) g a
to_ 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)) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (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) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f a
x (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) = forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF (NonEmpty (f x)
xs 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 -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
y
R1 NonEmptyF f x
zs -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ 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 = forall {k} (f :: k -> *). ListF f ~> (Proxy :+: NonEmptyF f)
fromListF forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
`hright` forall {k} (f :: k -> *) (a :: k).
NonEmptyF f a -> (:*:) f (ListF f) a
nonEmptyProd 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) = forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF forall a b. (a -> b) -> a -> b
$ f x
x forall a. a -> [a] -> NonEmpty 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 ) = forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF forall a b. (a -> b) -> a -> b
$ f x
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 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 ~> f
f g x
x forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
Day f (Day g h) a -> Day (Day f g) h a
D.assoc 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmptyBy Day f b
x forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> 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 forall (f :: * -> *). Ap f ~> (Identity :+: Ap1 f)
fromAp forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
`hright` forall (f :: * -> *) a. Ap1 f a -> Day f (Ap f) a
ap1Day 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') -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 forall a b. (a -> b) -> a -> b
$ (b -> c -> x
`z` c
y') forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f b
x
R1 Ap1 f c
ys -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ 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) = forall (a :: * -> *) a1 b. a a1 -> Ap a (a1 -> b) -> Ap1 a b
Ap1 f b
x forall a b. (a -> b) -> a -> b
$ forall a b c. (a -> b -> c) -> b -> a -> c
flip b -> c -> x
z forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *). Ap1 f ~> Ap f
toAp 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
inject f b
x forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f b
x 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g ~> f
f g b
x forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
Day f (Day g h) a -> Day (Day f g) h a
CD.assoc 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) = forall (f :: * -> *) a b c.
Divise f =>
(a -> (b, c)) -> f b -> f c -> f a
divise x -> (b, c)
f NonEmptyBy Day f b
x NonEmptyBy Day f c
y
matchNE :: forall (f :: * -> *).
FunctorBy Day f =>
NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f))
matchNE = 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
hbimap forall (f :: * -> *) a. Contravariant f => Coyoneda f a -> f a
CCY.lowerCoyoneda forall {f :: * -> *} {f :: * -> *} {p}.
(:*:) (Coyoneda f) (NonEmptyF (Coyoneda f)) p -> Day f (Div1 f) p
go 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 @(:*:) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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) = forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (a -> (b, c)) -> Day f g a
CD.Day f b
x (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) = forall (f :: * -> *) a. NonEmpty (Coyoneda f a) -> Div1 f a
Div1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). NonEmptyF f a -> NonEmpty (f a)
runNonEmptyF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE forall a b. (a -> b) -> a -> b
$
forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda (forall a b. (a, b) -> a
fst forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) f b
x forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap (forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) (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) = forall (f :: * -> *) a. NonEmpty (Coyoneda f a) -> Div1 f a
Div1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). NonEmptyF f a -> NonEmpty (f a)
runNonEmptyF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f f ~> NonEmptyBy t f
toNonEmptyBy forall a b. (a -> b) -> a -> b
$
forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda (forall a b. (a, b) -> a
fst forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> (b, c)
f) f b
x forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda (forall a b. (a, b) -> b
snd 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) = 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) = forall (f :: * -> *) a b c.
Divise f =>
(a -> (b, c)) -> f b -> f c -> f a
divise x -> (b, c)
h (g ~> f
f g b
x) (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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF 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 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 = coerce :: forall a b. Coercible a b => a -> b
coerce forall (f :: * -> *).
Day (Chain1 Day f) (Chain1 Day f) ~> Chain1 Day f
appendNEIDay_
matchNE :: forall (f :: * -> *).
FunctorBy Day f =>
NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f))
matchNE = coerce :: forall a b. Coercible a b => a -> b
coerce forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *).
Chain1 t f ~> (f :+: t f (Chain1 t f))
matchChain1
consNE :: forall (f :: * -> *). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f
consNE = coerce :: forall a b. Coercible a b => a -> b
coerce 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 = coerce :: forall a b. Coercible a b => a -> b
coerce 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 :: * -> *).
Day (Chain1 Day f) (Chain1 Day f) ~> Chain1 Day f
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 -> forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 (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) -> forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 forall a b. (a -> b) -> a -> b
$
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 (forall (f :: * -> *).
Day (Chain1 Day f) (Chain1 Day f) ~> Chain1 Day f
appendNEIDay_ (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 (,) 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)
(forall (p :: * -> * -> *) a b c.
Assoc p =>
p (p a b) c -> p a (p b c)
B.assoc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first b -> (b, c)
h 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 = forall (f :: * -> *). Inply f => Day f f ~> f
dather
binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Day g h ~> f
binterpret = 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
Night f (Night g h) ~> Night (Night f g) h
IN.assoc forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
Night (Night f g) h ~> Night f (Night g h)
IN.unassoc
appendNE :: forall (f :: * -> *).
Night (NonEmptyBy Night f) (NonEmptyBy Night f)
~> NonEmptyBy Night f
appendNE = coerce :: forall a b. Coercible a b => a -> b
coerce forall (f :: * -> *).
Night (Chain1 Night f) (Chain1 Night f) ~> Chain1 Night f
appendNEINight_
matchNE :: forall (f :: * -> *).
FunctorBy Night f =>
NonEmptyBy Night f ~> (f :+: Night f (NonEmptyBy Night f))
matchNE = coerce :: forall a b. Coercible a b => a -> b
coerce forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *).
Chain1 t f ~> (f :+: t f (Chain1 t f))
matchChain1
consNE :: forall (f :: * -> *).
Night f (NonEmptyBy Night f) ~> NonEmptyBy Night f
consNE = coerce :: forall a b. Coercible a b => a -> b
coerce 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 = coerce :: forall a b. Coercible a b => a -> b
coerce 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 :: * -> *).
Night (Chain1 Night f) (Chain1 Night f) ~> Chain1 Night f
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 -> forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 (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) -> forall {k} (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(a :: k).
t f (Chain1 t f) a -> Chain1 t f a
More1 forall a b. (a -> b) -> a -> b
$
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 (forall (f :: * -> *).
Night (Chain1 Night f) (Chain1 Night f) ~> Chain1 Night f
appendNEINight_ (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 forall a b. a -> Either a b
Left forall a b. b -> Either a b
Right forall a. a -> a
id))
(b1 -> x
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. b1 -> b1
j)
(forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (b1 -> x
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. c1 -> b1
k) c1 -> x
g)
(forall (p :: * -> * -> *) a b c.
Assoc p =>
p (p a b) c -> p a (p b c)
B.assoc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first b1 -> Either b1 c1
l 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 = forall (f :: * -> *). Inalt f => Night f f ~> f
IN.nerve
binterpret :: forall (g :: * -> *) (h :: * -> *).
(g ~> f) -> (h ~> f) -> Night g h ~> f
binterpret = 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
Night f (Night g h) ~> Night (Night f g) h
N.assoc forall (f :: * -> *) (g :: * -> *) (h :: * -> *).
Night (Night f g) h ~> Night f (Night g h)
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) = forall (f :: * -> *) a b c.
Decide f =>
(a -> Either b c) -> f b -> f c -> f a
decide x -> Either b1 c1
f NonEmptyBy Night f b1
x 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 -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap (forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall a. a -> a
id (forall a. Void -> a
absurd forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> Void
g) 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 -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1 -> b c1 -> (c -> Either b1 c1) -> Night a b c
Night f b1
x (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) = 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 (forall (f :: * -> *) a. Dec1 f a -> Dec f a
toDec 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) = 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 (forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t 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) = 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) = forall (f :: * -> *) a b c.
Decide f =>
(a -> Either b c) -> f b -> f c -> f a
decide x -> Either b1 c1
h (g ~> f
f g b1
x) (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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {p :: k}.
(:+:) f (g :+: g) p -> (:+:) (f :+: g) g p
to_ 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 -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
x)
R1 (L1 g p
y) -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 g p
y)
R1 (R1 g p
z) -> 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) -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
x
L1 (R1 f p
y) -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
y)
R1 g p
z -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (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) -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i forall a. Num a => a -> a -> a
+ Natural
1) f x
x
R1 (Step Natural
i f x
y) -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i forall a. Num a => a -> a -> a
+ Natural
2) f x
y
matchNE :: forall (f :: * -> *).
FunctorBy (:+:) f =>
NonEmptyBy (:+:) f ~> (f :+: (f :+: NonEmptyBy (:+:) f))
matchNE = forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown
consNE :: forall (f :: * -> *).
(f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f
consNE = forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp
toNonEmptyBy :: forall (f :: * -> *). (f :+: f) ~> NonEmptyBy (:+:) f
toNonEmptyBy = \case
L1 f x
x -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
1 f x
x
R1 f x
y -> 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 ~> f
f g x
x
R1 h x
y -> 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {k} {f :: k -> *} {g :: k -> *} {g :: k -> *} {a :: k}.
Sum f (Sum g g) a -> Sum (Sum f g) g a
to_ 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 -> forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
x)
InR (InL g a
y) -> forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR g a
y)
InR (InR g a
z) -> 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) -> forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
x
InL (InR f a
y) -> forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
y)
InR g a
z -> forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (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) -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i forall a. Num a => a -> a -> a
+ Natural
1) f x
x
InR (Step Natural
i f x
y) -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
i 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 = forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright (forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> f ~> g
viewF forall {k} (f :: k -> *) (g :: k -> *). (f :+: g) <~> Sum f g
sumSum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown
consNE :: forall (f :: * -> *). Sum f (NonEmptyBy Sum f) ~> NonEmptyBy Sum f
consNE = forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (g :: k -> *). (f <~> g) -> g ~> f
reviewF forall {k} (f :: k -> *) (g :: k -> *). (f :+: g) <~> Sum f g
sumSum
toNonEmptyBy :: forall (f :: * -> *). Sum f f ~> NonEmptyBy Sum f
toNonEmptyBy = \case
InL f x
x -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
1 f x
x
InR f x
y -> 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 ~> f
f g x
x
InR h x
y -> 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {f :: * -> *} {g :: * -> *} {g :: * -> *} {a}.
These1 f (These1 g g) a -> These1 (These1 f g) g a
to_ 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 -> forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 (forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f a
x )
That1 (This1 g a
y ) -> forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 (forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 g a
y)
That1 (That1 g a
z) -> forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 g a
z
That1 (These1 g a
y g a
z) -> forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (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 ) -> forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 (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) -> forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (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) -> forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (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 ) -> forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f a
x
This1 (That1 f a
y) -> forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 (forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f a
y )
This1 (These1 f a
x f a
y) -> forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x (forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f a
y )
That1 g a
z -> forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 (forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 g a
z)
These1 (This1 f a
x ) g a
z -> forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x (forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 g a
z)
These1 (That1 f a
y) g a
z -> forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 (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 -> forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f a
x (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 = forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT 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)) ->
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)) ->
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b (forall (f :: * -> *). These1 f (Steps f) ~> Steps f
stepsUp (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)) ->
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged (Bool
a Bool -> Bool -> Bool
|| Bool
b) (Steps f x
q 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 forall (f :: * -> *). Steps f ~> These1 f (Steps f)
stepsDown Steps f x
q of
This1 f x
x
| Bool
isImpure -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 f x
x
| Bool
otherwise -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
That1 Steps f x
y -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT forall a b. (a -> b) -> a -> b
$ 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 -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 f x
x forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT forall a b. (a -> b) -> a -> b
$ 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 = forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT forall a b. (a -> b) -> a -> b
$ case These1 f (NonEmptyBy These1 f) x
s of
This1 f x
x -> forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True (forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
inject f x
x)
That1 (ComposeT (Flagged Bool
b Steps f x
y)) -> forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b (forall (f :: * -> *). These1 f (Steps f) ~> Steps f
stepsUp (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)) -> forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b (forall (f :: * -> *). These1 f (Steps f) ~> Steps f
stepsUp (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 = forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT forall a b. (a -> b) -> a -> b
$ case These1 f f x
s of
This1 f x
x -> forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall a b. (a -> b) -> a -> b
$ forall k a. k -> a -> NEMap k a
NEM.singleton Natural
0 f x
x
That1 f x
y -> forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall a b. (a -> b) -> a -> b
$ forall k a. k -> a -> NEMap k a
NEM.singleton Natural
1 f x
y
These1 f x
x f x
y -> forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall a b. (a -> b) -> a -> b
$ forall k a. NonEmpty (k, a) -> NEMap k a
NEM.fromDistinctAscList forall a b. (a -> b) -> a -> b
$ (Natural
0, f x
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 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 ~> f
f g x
x
That1 h x
y -> h ~> f
g h x
y
These1 g x
x h x
y -> g ~> f
f g x
x forall (f :: * -> *) a. Alt f => f a -> f a -> f a
<!> 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF coerce :: forall a b. Coercible a b => a -> b
coerce coerce :: 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 = forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {k} {g :: * -> *} {f :: * -> *} {g :: k -> *} {a :: k}.
Functor g =>
Comp f (Comp g g) a -> Comp (Comp f g) g a
to_ 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 forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= (forall {k} (f :: * -> *) (g :: k -> *) (a :: k).
Functor f =>
Comp f g a -> f (g a)
unComp forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> Comp g g a
y)) forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f 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 forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= ((forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= x -> g a
z) 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) = NonEmptyBy Comp f x
x forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- x -> NonEmptyBy Comp f x
y
matchNE :: forall (f :: * -> *).
FunctorBy Comp f =>
NonEmptyBy Comp f ~> (f :+: Comp f (NonEmptyBy Comp f))
matchNE = 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) = forall (f :: * -> *). f ~> Free1 f
liftFree1 f x
x forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- x -> NonEmptyBy Comp f x
y
toNonEmptyBy :: forall (f :: * -> *). Comp f f ~> NonEmptyBy Comp f
toNonEmptyBy (f x
x :>>= x -> f x
g) = forall (f :: * -> *). f ~> Free1 f
liftFree1 f x
x forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *).
Inject t =>
f ~> t f
inject 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 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 ~> f
f g x
x forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- (h ~> f
g 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker)
(forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (g :: k1 -> *) (a :: k2) (b :: k1).
Joker g a b -> g b
runJoker forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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)) = 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) = forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
matchNE (Flagged Bool
True f x
x) = forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ 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 = 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 ~> f
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF)
(forall {k} {k1} (f :: k -> *) (g :: k1) (a :: k).
f a -> LeftF f g a
LeftF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2) (a :: k1).
LeftF f g a -> f a
runLeftF forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (t :: (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *).
HBind t =>
(f ~> t g) -> t f ~> t g
hbind (forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True) forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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) = forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
matchNE (Flagged Bool
True f x
x) = forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall a b. (a -> b) -> a -> b
$ 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 = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
True forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = 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 ~> f
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1) (g :: k2 -> *) (a :: k2).
RightF f g a -> g a
runRightF)
(forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} {k1} (f :: k) (g :: k1 -> *) (a :: k1).
g a -> RightF f g a
RightF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown
consNE :: forall (f :: * -> *).
RightF f (NonEmptyBy RightF f) ~> NonEmptyBy RightF f
consNE = forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = 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 ~> f
g forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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
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
showList :: [WrapHBF t f g a] -> ShowS
$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
show :: WrapHBF t f g a -> String
$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
showsPrec :: Int -> WrapHBF t f g a -> ShowS
$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
Show, ReadPrec [WrapHBF t f g a]
ReadPrec (WrapHBF t f g a)
ReadS [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]
readListPrec :: 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]
readPrec :: ReadPrec (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)
readList :: 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]
readsPrec :: Int -> 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)
Read, WrapHBF t f g a -> WrapHBF t f g a -> Bool
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
/= :: 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
Eq, 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
min :: 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
max :: WrapHBF t f g a -> WrapHBF t f g a -> WrapHBF t f g a
$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
>= :: 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
$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
compare :: WrapHBF t f g a -> WrapHBF t f g a -> Ordering
$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
Ord, 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
<$ :: forall a b. a -> WrapHBF t f g b -> WrapHBF t f g a
$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
fmap :: forall a b. (a -> b) -> WrapHBF t f g a -> WrapHBF t f g b
$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
Functor, 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
product :: 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
sum :: forall a. Num 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
minimum :: 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
maximum :: forall a. Ord a => WrapHBF t f g a -> a
$cmaximum :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
(Foldable (t f g), Ord a) =>
WrapHBF t f g a -> a
elem :: forall a. Eq a => a -> WrapHBF t f g a -> Bool
$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
length :: forall a. WrapHBF t f g a -> Int
$clength :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> Int
null :: forall a. WrapHBF t f g a -> Bool
$cnull :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) a.
Foldable (t f g) =>
WrapHBF t f g a -> Bool
toList :: forall 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]
foldl1 :: 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
foldr1 :: forall a. (a -> a -> a) -> WrapHBF t f g a -> a
$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
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
$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
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
$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
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
$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
fold :: forall m. Monoid m => WrapHBF t f g m -> m
$cfold :: forall k k (t :: k -> k -> * -> *) (f :: k) (g :: k) m.
(Foldable (t f g), Monoid m) =>
WrapHBF t f g m -> m
Foldable, 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 (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WrapHBF t f g a -> f (WrapHBF t f g b)
sequence :: forall (m :: * -> *) a.
Monad m =>
WrapHBF t f g (m a) -> m (WrapHBF t f g a)
$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)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WrapHBF t f g a -> m (WrapHBF t f g b)
$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)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
WrapHBF t f g (f a) -> f (WrapHBF t f g a)
$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)
traverse :: 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)
Traversable, Typeable, 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
$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
$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
Generic, WrapHBF t f g a -> DataType
WrapHBF t f g a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {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 -> 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)) =>
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)) =>
(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 (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)
gmapMo :: 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)
gmapMp :: forall (m :: * -> *).
MonadPlus 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)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WrapHBF t f g a -> m (WrapHBF t f g a)
$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)
gmapQi :: forall u.
Int -> (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
gmapQ :: forall u. (forall d. Data d => d -> u) -> WrapHBF t f g a -> [u]
$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]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrapHBF t f g a -> r
$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
gmapT :: (forall b. Data b => b -> b) -> WrapHBF t f g a -> 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
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> 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))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WrapHBF t f g a))
$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))
dataTypeOf :: WrapHBF t f g a -> DataType
$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
toConstr :: WrapHBF t f g a -> Constr
$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
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)
$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)
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)
$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)
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) = forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith (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) = 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) = 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) = forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF (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
hbimap f ~> j
f 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) = forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF (forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
hleft 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) = forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF (forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright 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 = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF) (forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF)
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
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
hleft forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF) (forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
hleft forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
WrapHBF t f g a -> t f g a
unwrapHBF forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
appendNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
(l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
hright forall {k} {k} {k} (t :: k -> k -> k -> *) (f :: k) (g :: k)
(a :: k).
t f g a -> WrapHBF t f g a
WrapHBF 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
consNE :: forall (f :: * -> *).
WrapHBF t f (NonEmptyBy (WrapHBF t) f) ~> NonEmptyBy (WrapHBF t) f
consNE = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f (NonEmptyBy t f) ~> NonEmptyBy t f
consNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t f f ~> NonEmptyBy t f
toNonEmptyBy forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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) = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE (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) = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE (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) = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE (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 = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
NonEmptyBy t f a -> WrapNE t f a
WrapNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
Associative t =>
t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
appendNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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
hbimap forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
WrapNE t f a -> NonEmptyBy t f a
unwrapNE forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *) a.
WrapNE t f a -> NonEmptyBy t f a
unwrapNE forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *).
SemigroupIn t f =>
t f f ~> f
biretract forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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
hbimap g ~> WrapNE t f
f h ~> WrapNE t f
g