{-# LANGUAGE PolyKinds, StandaloneDeriving, UndecidableInstances #-}
module Data.SOP.NP
(
NP(..)
, POP(..)
, unPOP
, pure_NP
, pure_POP
, cpure_NP
, cpure_POP
, fromList
, ap_NP
, ap_POP
, hd
, tl
, Projection
, projections
, shiftProjection
, liftA_NP
, liftA_POP
, liftA2_NP
, liftA2_POP
, liftA3_NP
, liftA3_POP
, map_NP
, map_POP
, zipWith_NP
, zipWith_POP
, zipWith3_NP
, zipWith3_POP
, cliftA_NP
, cliftA_POP
, cliftA2_NP
, cliftA2_POP
, cliftA3_NP
, cliftA3_POP
, cmap_NP
, cmap_POP
, czipWith_NP
, czipWith_POP
, czipWith3_NP
, czipWith3_POP
, hcliftA'
, hcliftA2'
, hcliftA3'
, cliftA2'_NP
, collapse_NP
, collapse_POP
, ctraverse__NP
, ctraverse__POP
, traverse__NP
, traverse__POP
, cfoldMap_NP
, cfoldMap_POP
, sequence'_NP
, sequence'_POP
, sequence_NP
, sequence_POP
, ctraverse'_NP
, ctraverse'_POP
, traverse'_NP
, traverse'_POP
, ctraverse_NP
, ctraverse_POP
, cata_NP
, ccata_NP
, ana_NP
, cana_NP
, trans_NP
, trans_POP
, coerce_NP
, coerce_POP
, fromI_NP
, fromI_POP
, toI_NP
, toI_POP
) where
import Data.Coerce
import Data.Kind (Type)
import Data.Proxy (Proxy(..))
import Unsafe.Coerce
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup (..))
#endif
import Control.DeepSeq (NFData(..))
import Data.SOP.BasicFunctors
import Data.SOP.Classes
import Data.SOP.Constraint
import Data.SOP.Sing
data NP :: (k -> Type) -> [k] -> Type where
Nil :: NP f '[]
(:*) :: f x -> NP f xs -> NP f (x ': xs)
infixr 5 :*
instance All (Show `Compose` f) xs => Show (NP f xs) where
showsPrec :: Int -> NP f xs -> ShowS
showsPrec Int
_ NP f xs
Nil = String -> ShowS
showString String
"Nil"
showsPrec Int
d (f x
f :* NP f xs
fs) = Bool -> ShowS -> ShowS
showParen (Int
d forall a. Ord a => a -> a -> Bool
> Int
5)
forall a b. (a -> b) -> a -> b
$ forall a. Show a => Int -> a -> ShowS
showsPrec (Int
5 forall a. Num a => a -> a -> a
+ Int
1) f x
f
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString String
" :* "
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => Int -> a -> ShowS
showsPrec Int
5 NP f xs
fs
deriving instance All (Eq `Compose` f) xs => Eq (NP f xs)
deriving instance (All (Eq `Compose` f) xs, All (Ord `Compose` f) xs) => Ord (NP f xs)
instance All (Semigroup `Compose` f) xs => Semigroup (NP f xs) where
<> :: NP f xs -> NP f xs -> NP f xs
(<>) = forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a)
-> NP f xs
-> NP g xs
-> NP h xs
czipWith_NP (forall {k} (t :: k). Proxy t
Proxy :: Proxy (Semigroup `Compose` f)) forall a. Semigroup a => a -> a -> a
(<>)
instance (All (Monoid `Compose` f) xs
#if MIN_VERSION_base(4,11,0)
, All (Semigroup `Compose` f) xs
#endif
) => Monoid (NP f xs) where
mempty :: NP f xs
mempty = forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP (forall {k} (t :: k). Proxy t
Proxy :: Proxy (Monoid `Compose` f)) forall a. Monoid a => a
mempty
#if !MIN_VERSION_base(4,11,0)
mappend = czipWith_NP (Proxy :: Proxy (Monoid `Compose` f)) mappend
#endif
instance All (NFData `Compose` f) xs => NFData (NP f xs) where
rnf :: NP f xs -> ()
rnf NP f xs
Nil = ()
rnf (f x
x :* NP f xs
xs) = forall a. NFData a => a -> ()
rnf f x
x seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf NP f xs
xs
newtype POP (f :: (k -> Type)) (xss :: [[k]]) = POP (NP (NP f) xss)
deriving instance (Show (NP (NP f) xss)) => Show (POP f xss)
deriving instance (Eq (NP (NP f) xss)) => Eq (POP f xss)
deriving instance (Ord (NP (NP f) xss)) => Ord (POP f xss)
instance (Semigroup (NP (NP f) xss)) => Semigroup (POP f xss) where
POP NP (NP f) xss
xss <> :: POP f xss -> POP f xss -> POP f xss
<> POP NP (NP f) xss
yss = forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP (NP (NP f) xss
xss forall a. Semigroup a => a -> a -> a
<> NP (NP f) xss
yss)
instance (Monoid (NP (NP f) xss)) => Monoid (POP f xss) where
mempty :: POP f xss
mempty = forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP forall a. Monoid a => a
mempty
#if !MIN_VERSION_base(4,11,0)
mappend (POP xss) (POP yss) = POP (mappend xss yss)
#endif
instance (NFData (NP (NP f) xss)) => NFData (POP f xss) where
rnf :: POP f xss -> ()
rnf (POP NP (NP f) xss
xss) = forall a. NFData a => a -> ()
rnf NP (NP f) xss
xss
unPOP :: POP f xss -> NP (NP f) xss
unPOP :: forall {k} (f :: k -> *) (xss :: [[k]]). POP f xss -> NP (NP f) xss
unPOP (POP NP (NP f) xss
xss) = NP (NP f) xss
xss
type instance AllN NP c = All c
type instance AllN POP c = All2 c
type instance AllZipN NP c = AllZip c
type instance AllZipN POP c = AllZip2 c
type instance SListIN NP = SListI
type instance SListIN POP = SListI2
pure_NP :: forall f xs. SListI xs => (forall a. f a) -> NP f xs
pure_NP :: forall {k} (f :: k -> *) (xs :: [k]).
SListI xs =>
(forall (a :: k). f a) -> NP f xs
pure_NP forall (a :: k). f a
f = forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP forall {k}. Proxy Top
topP forall (a :: k). f a
f
{-# INLINE pure_NP #-}
pure_POP :: All SListI xss => (forall a. f a) -> POP f xss
pure_POP :: forall {k} (xss :: [[k]]) (f :: k -> *).
All SListI xss =>
(forall (a :: k). f a) -> POP f xss
pure_POP forall (a :: k). f a
f = forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All2 c xss =>
proxy c -> (forall (a :: k). c a => f a) -> POP f xss
cpure_POP forall {k}. Proxy Top
topP forall (a :: k). f a
f
{-# INLINE pure_POP #-}
topP :: Proxy Top
topP :: forall {k}. Proxy Top
topP = forall {k} (t :: k). Proxy t
Proxy
cpure_NP :: forall c xs proxy f. All c xs
=> proxy c -> (forall a. c a => f a) -> NP f xs
cpure_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP proxy c
p forall (a :: k). c a => f a
f = case forall {k} (xs :: [k]). SListI xs => SList xs
sList :: SList xs of
SList xs
SNil -> forall {k} (f :: k -> *). NP f '[]
Nil
SList xs
SCons -> forall (a :: k). c a => f a
f forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP proxy c
p forall (a :: k). c a => f a
f
cpure_POP :: forall c xss proxy f. All2 c xss
=> proxy c -> (forall a. c a => f a) -> POP f xss
cpure_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All2 c xss =>
proxy c -> (forall (a :: k). c a => f a) -> POP f xss
cpure_POP proxy c
p forall (a :: k). c a => f a
f = forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP (forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP (forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
p) (forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP proxy c
p forall (a :: k). c a => f a
f))
allP :: proxy c -> Proxy (All c)
allP :: forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
_ = forall {k} (t :: k). Proxy t
Proxy
instance HPure NP where
hpure :: forall (xs :: [k]) (f :: k -> *).
SListIN NP xs =>
(forall (a :: k). f a) -> NP f xs
hpure = forall {k} (f :: k -> *) (xs :: [k]).
SListI xs =>
(forall (a :: k). f a) -> NP f xs
pure_NP
hcpure :: forall (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
AllN NP c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
hcpure = forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All c xs =>
proxy c -> (forall (a :: k). c a => f a) -> NP f xs
cpure_NP
instance HPure POP where
hpure :: forall (xs :: [[k]]) (f :: k -> *).
SListIN POP xs =>
(forall (a :: k). f a) -> POP f xs
hpure = forall {k} (xss :: [[k]]) (f :: k -> *).
All SListI xss =>
(forall (a :: k). f a) -> POP f xss
pure_POP
hcpure :: forall (c :: k -> Constraint) (xs :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
AllN POP c xs =>
proxy c -> (forall (a :: k). c a => f a) -> POP f xs
hcpure = forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
All2 c xss =>
proxy c -> (forall (a :: k). c a => f a) -> POP f xss
cpure_POP
fromList :: SListI xs => [a] -> Maybe (NP (K a) xs)
fromList :: forall {k} (xs :: [k]) a. SListI xs => [a] -> Maybe (NP (K a) xs)
fromList = forall {k} (xs :: [k]) a. SList xs -> [a] -> Maybe (NP (K a) xs)
go forall {k} (xs :: [k]). SListI xs => SList xs
sList
where
go :: SList xs -> [a] -> Maybe (NP (K a) xs)
go :: forall {k} (xs :: [k]) a. SList xs -> [a] -> Maybe (NP (K a) xs)
go SList xs
SNil [] = forall (m :: * -> *) a. Monad m => a -> m a
return forall {k} (f :: k -> *). NP f '[]
Nil
go SList xs
SCons (a
x:[a]
xs) = do NP (K a) xs
ys <- forall {k} (xs :: [k]) a. SList xs -> [a] -> Maybe (NP (K a) xs)
go forall {k} (xs :: [k]). SListI xs => SList xs
sList [a]
xs ; forall (m :: * -> *) a. Monad m => a -> m a
return (forall k a (b :: k). a -> K a b
K a
x forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* NP (K a) xs
ys)
go SList xs
_ [a]
_ = forall a. Maybe a
Nothing
ap_NP :: NP (f -.-> g) xs -> NP f xs -> NP g xs
ap_NP :: forall {k} (f :: k -> *) (g :: k -> *) (xs :: [k]).
NP (f -.-> g) xs -> NP f xs -> NP g xs
ap_NP NP (f -.-> g) xs
Nil NP f xs
Nil = forall {k} (f :: k -> *). NP f '[]
Nil
ap_NP (Fn f x -> g x
f :* NP (f -.-> g) xs
fs) (f x
x :* NP f xs
xs) = f x -> g x
f f x
x forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* forall {k} (f :: k -> *) (g :: k -> *) (xs :: [k]).
NP (f -.-> g) xs -> NP f xs -> NP g xs
ap_NP NP (f -.-> g) xs
fs NP f xs
xs
ap_POP :: POP (f -.-> g) xss -> POP f xss -> POP g xss
ap_POP :: forall {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]]).
POP (f -.-> g) xss -> POP f xss -> POP g xss
ap_POP (POP NP (NP (f -.-> g)) xss
fss') (POP NP (NP f) xss
xss') = forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP (forall {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]]).
NP (NP (f -.-> g)) xss -> NP (NP f) xss -> NP (NP g) xss
go NP (NP (f -.-> g)) xss
fss' NP (NP f) xss
xss')
where
go :: NP (NP (f -.-> g)) xss -> NP (NP f) xss -> NP (NP g) xss
go :: forall {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]]).
NP (NP (f -.-> g)) xss -> NP (NP f) xss -> NP (NP g) xss
go NP (NP (f -.-> g)) xss
Nil NP (NP f) xss
Nil = forall {k} (f :: k -> *). NP f '[]
Nil
go (NP (f -.-> g) x
fs :* NP (NP (f -.-> g)) xs
fss) (NP f x
xs :* NP (NP f) xs
xss) = forall {k} (f :: k -> *) (g :: k -> *) (xs :: [k]).
NP (f -.-> g) xs -> NP f xs -> NP g xs
ap_NP NP (f -.-> g) x
fs NP f x
xs forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* forall {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]]).
NP (NP (f -.-> g)) xss -> NP (NP f) xss -> NP (NP g) xss
go NP (NP (f -.-> g)) xs
fss NP (NP f) xs
xss
_ap_POP_spec :: SListI xss => POP (f -.-> g) xss -> POP f xss -> POP g xss
_ap_POP_spec :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *).
SListI xss =>
POP (f -.-> g) xss -> POP f xss -> POP g xss
_ap_POP_spec (POP NP (NP (f -.-> g)) xss
fs) (POP NP (NP f) xss
xs) = forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP (forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *) (h :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a -> h a)
-> NP f xs -> NP g xs -> NP h xs
liftA2_NP forall {k} (f :: k -> *) (g :: k -> *) (xs :: [k]).
NP (f -.-> g) xs -> NP f xs -> NP g xs
ap_NP NP (NP (f -.-> g)) xss
fs NP (NP f) xss
xs)
type instance Same NP = NP
type instance Same POP = POP
type instance Prod NP = NP
type instance Prod POP = POP
instance HAp NP where hap :: forall (f :: k -> *) (g :: k -> *) (xs :: [k]).
Prod NP (f -.-> g) xs -> NP f xs -> NP g xs
hap = forall {k} (f :: k -> *) (g :: k -> *) (xs :: [k]).
NP (f -.-> g) xs -> NP f xs -> NP g xs
ap_NP
instance HAp POP where hap :: forall (f :: k -> *) (g :: k -> *) (xs :: [[k]]).
Prod POP (f -.-> g) xs -> POP f xs -> POP g xs
hap = forall {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]]).
POP (f -.-> g) xss -> POP f xss -> POP g xss
ap_POP
hd :: NP f (x ': xs) -> f x
hd :: forall {k} (f :: k -> *) (x :: k) (xs :: [k]). NP f (x : xs) -> f x
hd (f x
x :* NP f xs
_xs) = f x
x
tl :: NP f (x ': xs) -> NP f xs
tl :: forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
NP f (x : xs) -> NP f xs
tl (f x
_x :* NP f xs
xs) = NP f xs
xs
type Projection (f :: k -> Type) (xs :: [k]) = K (NP f xs) -.-> f
projections :: forall xs f . SListI xs => NP (Projection f xs) xs
projections :: forall {k} (xs :: [k]) (f :: k -> *).
SListI xs =>
NP (Projection f xs) xs
projections = case forall {k} (xs :: [k]). SListI xs => SList xs
sList :: SList xs of
SList xs
SNil -> forall {k} (f :: k -> *). NP f '[]
Nil
SList xs
SCons -> forall {k} (f :: k -> *) (a :: k) (f' :: k -> *).
(f a -> f' a) -> (-.->) f f' a
fn (forall {k} (f :: k -> *) (x :: k) (xs :: [k]). NP f (x : xs) -> f x
hd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} a (b :: k). K a b -> a
unK) forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a) -> NP f xs -> NP g xs
liftA_NP forall {a} (f :: a -> *) (xs :: [a]) (a :: a) (x :: a).
Projection f xs a -> Projection f (x : xs) a
shiftProjection forall {k} (xs :: [k]) (f :: k -> *).
SListI xs =>
NP (Projection f xs) xs
projections
shiftProjection :: Projection f xs a -> Projection f (x ': xs) a
shiftProjection :: forall {a} (f :: a -> *) (xs :: [a]) (a :: a) (x :: a).
Projection f xs a -> Projection f (x : xs) a
shiftProjection (Fn K (NP f xs) a -> f a
f) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
(f a -> g a) -> (-.->) f g a
Fn forall a b. (a -> b) -> a -> b
$ K (NP f xs) a -> f a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a (b :: k). a -> K a b
K forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
NP f (x : xs) -> NP f xs
tl forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} a (b :: k). K a b -> a
unK
liftA_NP :: SListI xs => (forall a. f a -> g a) -> NP f xs -> NP g xs
liftA_POP :: All SListI xss => (forall a. f a -> g a) -> POP f xss -> POP g xss
liftA_NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a) -> NP f xs -> NP g xs
liftA_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hliftA
liftA_POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *).
All SListI xss =>
(forall (a :: k). f a -> g a) -> POP f xss -> POP g xss
liftA_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hliftA
liftA2_NP :: SListI xs => (forall a. f a -> g a -> h a) -> NP f xs -> NP g xs -> NP h xs
liftA2_POP :: All SListI xss => (forall a. f a -> g a -> h a) -> POP f xss -> POP g xss -> POP h xss
liftA2_NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *) (h :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a -> h a)
-> NP f xs -> NP g xs -> NP h xs
liftA2_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a)
-> Prod h f xs -> h f' xs -> h f'' xs
hliftA2
liftA2_POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All SListI xss =>
(forall (a :: k). f a -> g a -> h a)
-> POP f xss -> POP g xss -> POP h xss
liftA2_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a)
-> Prod h f xs -> h f' xs -> h f'' xs
hliftA2
liftA3_NP :: SListI xs => (forall a. f a -> g a -> h a -> i a) -> NP f xs -> NP g xs -> NP h xs -> NP i xs
liftA3_POP :: All SListI xss => (forall a. f a -> g a -> h a -> i a) -> POP f xss -> POP g xss -> POP h xss -> POP i xss
liftA3_NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *) (h :: k -> *)
(i :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a -> h a -> i a)
-> NP f xs -> NP g xs -> NP h xs -> NP i xs
liftA3_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
hliftA3
liftA3_POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *) (h :: k -> *)
(i :: k -> *).
All SListI xss =>
(forall (a :: k). f a -> g a -> h a -> i a)
-> POP f xss -> POP g xss -> POP h xss -> POP i xss
liftA3_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
hliftA3
map_NP :: SListI xs => (forall a. f a -> g a) -> NP f xs -> NP g xs
map_POP :: All SListI xss => (forall a. f a -> g a) -> POP f xss -> POP g xss
map_NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a) -> NP f xs -> NP g xs
map_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hmap
map_POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *).
All SListI xss =>
(forall (a :: k). f a -> g a) -> POP f xss -> POP g xss
map_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hmap
zipWith_NP :: SListI xs => (forall a. f a -> g a -> h a) -> NP f xs -> NP g xs -> NP h xs
zipWith_POP :: All SListI xss => (forall a. f a -> g a -> h a) -> POP f xss -> POP g xss -> POP h xss
zipWith_NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *) (h :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a -> h a)
-> NP f xs -> NP g xs -> NP h xs
zipWith_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a)
-> Prod h f xs -> h f' xs -> h f'' xs
hzipWith
zipWith_POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All SListI xss =>
(forall (a :: k). f a -> g a -> h a)
-> POP f xss -> POP g xss -> POP h xss
zipWith_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a)
-> Prod h f xs -> h f' xs -> h f'' xs
hzipWith
zipWith3_NP :: SListI xs => (forall a. f a -> g a -> h a -> i a) -> NP f xs -> NP g xs -> NP h xs -> NP i xs
zipWith3_POP :: All SListI xss => (forall a. f a -> g a -> h a -> i a) -> POP f xss -> POP g xss -> POP h xss -> POP i xss
zipWith3_NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: k -> *) (h :: k -> *)
(i :: k -> *).
SListI xs =>
(forall (a :: k). f a -> g a -> h a -> i a)
-> NP f xs -> NP g xs -> NP h xs -> NP i xs
zipWith3_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
hzipWith3
zipWith3_POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: k -> *) (h :: k -> *)
(i :: k -> *).
All SListI xss =>
(forall (a :: k). f a -> g a -> h a -> i a)
-> POP f xss -> POP g xss -> POP h xss -> POP i xss
zipWith3_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(SListIN (Prod h) xs, HAp h, HAp (Prod h)) =>
(forall (a :: k). f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
hzipWith3
cliftA_NP :: All c xs => proxy c -> (forall a. c a => f a -> g a) -> NP f xs -> NP g xs
cliftA_POP :: All2 c xss => proxy c -> (forall a. c a => f a -> g a) -> POP f xss -> POP g xss
cliftA_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a) -> NP f xs -> NP g xs
cliftA_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcliftA
cliftA_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
All2 c xss =>
proxy c
-> (forall (a :: k). c a => f a -> g a) -> POP f xss -> POP g xss
cliftA_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcliftA
cliftA2_NP :: All c xs => proxy c -> (forall a. c a => f a -> g a -> h a) -> NP f xs -> NP g xs -> NP h xs
cliftA2_POP :: All2 c xss => proxy c -> (forall a. c a => f a -> g a -> h a) -> POP f xss -> POP g xss -> POP h xss
cliftA2_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a)
-> NP f xs
-> NP g xs
-> NP h xs
cliftA2_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hcliftA2
cliftA2_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All2 c xss =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a)
-> POP f xss
-> POP g xss
-> POP h xss
cliftA2_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hcliftA2
cliftA3_NP :: All c xs => proxy c -> (forall a. c a => f a -> g a -> h a -> i a) -> NP f xs -> NP g xs -> NP h xs -> NP i xs
cliftA3_POP :: All2 c xss => proxy c -> (forall a. c a => f a -> g a -> h a -> i a) -> POP f xss -> POP g xss -> POP h xss -> POP i xss
cliftA3_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *) (i :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a -> i a)
-> NP f xs
-> NP g xs
-> NP h xs
-> NP i xs
cliftA3_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hcliftA3
cliftA3_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *) (i :: k -> *).
All2 c xss =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a -> i a)
-> POP f xss
-> POP g xss
-> POP h xss
-> POP i xss
cliftA3_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hcliftA3
cmap_NP :: All c xs => proxy c -> (forall a. c a => f a -> g a) -> NP f xs -> NP g xs
cmap_POP :: All2 c xss => proxy c -> (forall a. c a => f a -> g a) -> POP f xss -> POP g xss
cmap_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a) -> NP f xs -> NP g xs
cmap_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
cmap_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
All2 c xss =>
proxy c
-> (forall (a :: k). c a => f a -> g a) -> POP f xss -> POP g xss
cmap_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcmap
czipWith_NP :: All c xs => proxy c -> (forall a. c a => f a -> g a -> h a) -> NP f xs -> NP g xs -> NP h xs
czipWith_POP :: All2 c xss => proxy c -> (forall a. c a => f a -> g a -> h a) -> POP f xss -> POP g xss -> POP h xss
czipWith_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a)
-> NP f xs
-> NP g xs
-> NP h xs
czipWith_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hczipWith
czipWith_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *).
All2 c xss =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a)
-> POP f xss
-> POP g xss
-> POP h xss
czipWith_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hczipWith
czipWith3_NP :: All c xs => proxy c -> (forall a. c a => f a -> g a -> h a -> i a) -> NP f xs -> NP g xs -> NP h xs -> NP i xs
czipWith3_POP :: All2 c xss => proxy c -> (forall a. c a => f a -> g a -> h a -> i a) -> POP f xss -> POP g xss -> POP h xss -> POP i xss
czipWith3_NP :: forall {k} (c :: k -> Constraint) (xs :: [k])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *) (i :: k -> *).
All c xs =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a -> i a)
-> NP f xs
-> NP g xs
-> NP h xs
-> NP i xs
czipWith3_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hczipWith3
czipWith3_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (g :: k -> *)
(h :: k -> *) (i :: k -> *).
All2 c xss =>
proxy c
-> (forall (a :: k). c a => f a -> g a -> h a -> i a)
-> POP f xss
-> POP g xss
-> POP h xss
-> POP i xss
czipWith3_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hczipWith3
{-# DEPRECATED hcliftA' "Use 'hcliftA' or 'hcmap' instead." #-}
hcliftA' :: (All2 c xss, Prod h ~ NP, HAp h) => proxy c -> (forall xs. All c xs => f xs -> f' xs) -> h f xss -> h f' xss
{-# DEPRECATED hcliftA2' "Use 'hcliftA2' or 'hczipWith' instead." #-}
hcliftA2' :: (All2 c xss, Prod h ~ NP, HAp h) => proxy c -> (forall xs. All c xs => f xs -> f' xs -> f'' xs) -> Prod h f xss -> h f' xss -> h f'' xss
{-# DEPRECATED hcliftA3' "Use 'hcliftA3' or 'hczipWith3' instead." #-}
hcliftA3' :: (All2 c xss, Prod h ~ NP, HAp h) => proxy c -> (forall xs. All c xs => f xs -> f' xs -> f'' xs -> f''' xs) -> Prod h f xss -> Prod h f' xss -> h f'' xss -> h f''' xss
hcliftA' :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(h :: ([k] -> *) -> [[k]] -> *) (proxy :: (k -> Constraint) -> *)
(f :: [k] -> *) (f' :: [k] -> *).
(All2 c xss, Prod h ~ NP, HAp h) =>
proxy c
-> (forall (xs :: [k]). All c xs => f xs -> f' xs)
-> h f xss
-> h f' xss
hcliftA' proxy c
p = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *).
(AllN (Prod h) c xs, HAp h) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
hcliftA (forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
p)
hcliftA2' :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(h :: ([k] -> *) -> [[k]] -> *) (proxy :: (k -> Constraint) -> *)
(f :: [k] -> *) (f' :: [k] -> *) (f'' :: [k] -> *).
(All2 c xss, Prod h ~ NP, HAp h) =>
proxy c
-> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs)
-> Prod h f xss
-> h f' xss
-> h f'' xss
hcliftA2' proxy c
p = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a)
-> Prod h f xs
-> h f' xs
-> h f'' xs
hcliftA2 (forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
p)
hcliftA3' :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(h :: ([k] -> *) -> [[k]] -> *) (proxy :: (k -> Constraint) -> *)
(f :: [k] -> *) (f' :: [k] -> *) (f'' :: [k] -> *)
(f''' :: [k] -> *).
(All2 c xss, Prod h ~ NP, HAp h) =>
proxy c
-> (forall (xs :: [k]).
All c xs =>
f xs -> f' xs -> f'' xs -> f''' xs)
-> Prod h f xss
-> Prod h f' xss
-> h f'' xss
-> h f''' xss
hcliftA3' proxy c
p = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) (proxy :: (k -> Constraint) -> *) (f :: k -> *)
(f' :: k -> *) (f'' :: k -> *) (f''' :: k -> *).
(AllN (Prod h) c xs, HAp h, HAp (Prod h)) =>
proxy c
-> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a)
-> Prod h f xs
-> Prod h f' xs
-> h f'' xs
-> h f''' xs
hcliftA3 (forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
p)
{-# DEPRECATED cliftA2'_NP "Use 'cliftA2_NP' instead." #-}
cliftA2'_NP :: All2 c xss => proxy c -> (forall xs. All c xs => f xs -> g xs -> h xs) -> NP f xss -> NP g xss -> NP h xss
cliftA2'_NP :: forall {k} (c :: k -> Constraint) (xss :: [[k]])
(proxy :: (k -> Constraint) -> *) (f :: [k] -> *) (g :: [k] -> *)
(h :: [k] -> *).
All2 c xss =>
proxy c
-> (forall (xs :: [k]). All c xs => f xs -> g xs -> h xs)
-> NP f xss
-> NP g xss
-> NP h xss
cliftA2'_NP = forall {k} (c :: k -> Constraint) (xss :: [[k]])
(h :: ([k] -> *) -> [[k]] -> *) (proxy :: (k -> Constraint) -> *)
(f :: [k] -> *) (f' :: [k] -> *) (f'' :: [k] -> *).
(All2 c xss, Prod h ~ NP, HAp h) =>
proxy c
-> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs)
-> Prod h f xss
-> h f' xss
-> h f'' xss
hcliftA2'
collapse_NP :: NP (K a) xs -> [a]
collapse_POP :: SListI xss => POP (K a) xss -> [[a]]
collapse_NP :: forall {k} a (xs :: [k]). NP (K a) xs -> [a]
collapse_NP NP (K a) xs
Nil = []
collapse_NP (K a
x :* NP (K a) xs
xs) = a
x forall a. a -> [a] -> [a]
: forall {k} a (xs :: [k]). NP (K a) xs -> [a]
collapse_NP NP (K a) xs
xs
collapse_POP :: forall {k} (xss :: [[k]]) a. SListI xss => POP (K a) xss -> [[a]]
collapse_POP = forall {k} a (xs :: [k]). NP (K a) xs -> [a]
collapse_NP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hliftA (forall k a (b :: k). a -> K a b
K forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} a (xs :: [k]). NP (K a) xs -> [a]
collapse_NP) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (xss :: [[k]]). POP f xss -> NP (NP f) xss
unPOP
type instance CollapseTo NP a = [a]
type instance CollapseTo POP a = [[a]]
instance HCollapse NP where hcollapse :: forall (xs :: [k]) a.
SListIN NP xs =>
NP (K a) xs -> CollapseTo NP a
hcollapse = forall {k} a (xs :: [k]). NP (K a) xs -> [a]
collapse_NP
instance HCollapse POP where hcollapse :: forall (xs :: [[k]]) a.
SListIN POP xs =>
POP (K a) xs -> CollapseTo POP a
hcollapse = forall {k} (xss :: [[k]]) a. SListI xss => POP (K a) xss -> [[a]]
collapse_POP
ctraverse__NP ::
forall c proxy xs f g. (All c xs, Applicative g)
=> proxy c -> (forall a. c a => f a -> g ()) -> NP f xs -> g ()
ctraverse__NP :: forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c -> (forall (a :: k). c a => f a -> g ()) -> NP f xs -> g ()
ctraverse__NP proxy c
_ forall (a :: k). c a => f a -> g ()
f = forall (ys :: [k]). All c ys => NP f ys -> g ()
go
where
go :: All c ys => NP f ys -> g ()
go :: forall (ys :: [k]). All c ys => NP f ys -> g ()
go NP f ys
Nil = forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
go (f x
x :* NP f xs
xs) = forall (a :: k). c a => f a -> g ()
f f x
x forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> forall (ys :: [k]). All c ys => NP f ys -> g ()
go NP f xs
xs
traverse__NP ::
forall xs f g. (SListI xs, Applicative g)
=> (forall a. f a -> g ()) -> NP f xs -> g ()
traverse__NP :: forall {k} (xs :: [k]) (f :: k -> *) (g :: * -> *).
(SListI xs, Applicative g) =>
(forall (a :: k). f a -> g ()) -> NP f xs -> g ()
traverse__NP forall (a :: k). f a -> g ()
f =
forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c -> (forall (a :: k). c a => f a -> g ()) -> NP f xs -> g ()
ctraverse__NP forall {k}. Proxy Top
topP forall (a :: k). f a -> g ()
f
{-# INLINE traverse__NP #-}
ctraverse__POP ::
forall c proxy xss f g. (All2 c xss, Applicative g)
=> proxy c -> (forall a. c a => f a -> g ()) -> POP f xss -> g ()
ctraverse__POP :: forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xss :: [[k]]) (f :: k -> *) (g :: * -> *).
(All2 c xss, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g ()) -> POP f xss -> g ()
ctraverse__POP proxy c
p forall (a :: k). c a => f a -> g ()
f = forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c -> (forall (a :: k). c a => f a -> g ()) -> NP f xs -> g ()
ctraverse__NP (forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
p) (forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c -> (forall (a :: k). c a => f a -> g ()) -> NP f xs -> g ()
ctraverse__NP proxy c
p forall (a :: k). c a => f a -> g ()
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (xss :: [[k]]). POP f xss -> NP (NP f) xss
unPOP
traverse__POP ::
forall xss f g. (SListI2 xss, Applicative g)
=> (forall a. f a -> g ()) -> POP f xss -> g ()
traverse__POP :: forall {k} (xss :: [[k]]) (f :: k -> *) (g :: * -> *).
(SListI2 xss, Applicative g) =>
(forall (a :: k). f a -> g ()) -> POP f xss -> g ()
traverse__POP forall (a :: k). f a -> g ()
f =
forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xss :: [[k]]) (f :: k -> *) (g :: * -> *).
(All2 c xss, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g ()) -> POP f xss -> g ()
ctraverse__POP forall {k}. Proxy Top
topP forall (a :: k). f a -> g ()
f
{-# INLINE traverse__POP #-}
instance HTraverse_ NP where
hctraverse_ :: forall (c :: k -> Constraint) (xs :: [k]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
(AllN NP c xs, Applicative g) =>
proxy c -> (forall (a :: k). c a => f a -> g ()) -> NP f xs -> g ()
hctraverse_ = forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c -> (forall (a :: k). c a => f a -> g ()) -> NP f xs -> g ()
ctraverse__NP
htraverse_ :: forall (xs :: [k]) (g :: * -> *) (f :: k -> *).
(SListIN NP xs, Applicative g) =>
(forall (a :: k). f a -> g ()) -> NP f xs -> g ()
htraverse_ = forall {k} (xs :: [k]) (f :: k -> *) (g :: * -> *).
(SListI xs, Applicative g) =>
(forall (a :: k). f a -> g ()) -> NP f xs -> g ()
traverse__NP
instance HTraverse_ POP where
hctraverse_ :: forall (c :: k -> Constraint) (xs :: [[k]]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
(AllN POP c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g ()) -> POP f xs -> g ()
hctraverse_ = forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xss :: [[k]]) (f :: k -> *) (g :: * -> *).
(All2 c xss, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g ()) -> POP f xss -> g ()
ctraverse__POP
htraverse_ :: forall (xs :: [[k]]) (g :: * -> *) (f :: k -> *).
(SListIN POP xs, Applicative g) =>
(forall (a :: k). f a -> g ()) -> POP f xs -> g ()
htraverse_ = forall {k} (xss :: [[k]]) (f :: k -> *) (g :: * -> *).
(SListI2 xss, Applicative g) =>
(forall (a :: k). f a -> g ()) -> POP f xss -> g ()
traverse__POP
cfoldMap_NP :: (All c xs, Monoid m) => proxy c -> (forall a. c a => f a -> m) -> NP f xs -> m
cfoldMap_NP :: forall {k} (c :: k -> Constraint) (xs :: [k]) m
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
(All c xs, Monoid m) =>
proxy c -> (forall (a :: k). c a => f a -> m) -> NP f xs -> m
cfoldMap_NP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) m (proxy :: (k -> Constraint) -> *) (f :: k -> *).
(HTraverse_ h, AllN h c xs, Monoid m) =>
proxy c -> (forall (a :: k). c a => f a -> m) -> h f xs -> m
hcfoldMap
cfoldMap_POP :: (All2 c xs, Monoid m) => proxy c -> (forall a. c a => f a -> m) -> POP f xs -> m
cfoldMap_POP :: forall {k} (c :: k -> Constraint) (xs :: [[k]]) m
(proxy :: (k -> Constraint) -> *) (f :: k -> *).
(All2 c xs, Monoid m) =>
proxy c -> (forall (a :: k). c a => f a -> m) -> POP f xs -> m
cfoldMap_POP = forall {k} {l} (h :: (k -> *) -> l -> *) (c :: k -> Constraint)
(xs :: l) m (proxy :: (k -> Constraint) -> *) (f :: k -> *).
(HTraverse_ h, AllN h c xs, Monoid m) =>
proxy c -> (forall (a :: k). c a => f a -> m) -> h f xs -> m
hcfoldMap
sequence'_NP :: Applicative f => NP (f :.: g) xs -> f (NP g xs)
sequence'_NP :: forall {k} (f :: * -> *) (g :: k -> *) (xs :: [k]).
Applicative f =>
NP (f :.: g) xs -> f (NP g xs)
sequence'_NP NP (f :.: g) xs
Nil = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall {k} (f :: k -> *). NP f '[]
Nil
sequence'_NP ((:.:) f g x
mx :* NP (f :.: g) xs
mxs) = forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
(:*) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall {l} {k} (f :: l -> *) (g :: k -> l) (p :: k).
(:.:) f g p -> f (g p)
unComp (:.:) f g x
mx forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall {k} (f :: * -> *) (g :: k -> *) (xs :: [k]).
Applicative f =>
NP (f :.: g) xs -> f (NP g xs)
sequence'_NP NP (f :.: g) xs
mxs
sequence'_POP :: (SListI xss, Applicative f) => POP (f :.: g) xss -> f (POP g xss)
sequence'_POP :: forall {k} (xss :: [[k]]) (f :: * -> *) (g :: k -> *).
(SListI xss, Applicative f) =>
POP (f :.: g) xss -> f (POP g xss)
sequence'_POP = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: * -> *) (g :: k -> *) (xs :: [k]).
Applicative f =>
NP (f :.: g) xs -> f (NP g xs)
sequence'_NP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {l} (h :: (k -> *) -> l -> *) (xs :: l) (f :: k -> *)
(f' :: k -> *).
(SListIN (Prod h) xs, HAp h) =>
(forall (a :: k). f a -> f' a) -> h f xs -> h f' xs
hliftA (forall l k (f :: l -> *) (g :: k -> l) (p :: k).
f (g p) -> (:.:) f g p
Comp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: * -> *) (g :: k -> *) (xs :: [k]).
Applicative f =>
NP (f :.: g) xs -> f (NP g xs)
sequence'_NP) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (xss :: [[k]]). POP f xss -> NP (NP f) xss
unPOP
ctraverse'_NP ::
forall c proxy xs f f' g. (All c xs, Applicative g)
=> proxy c -> (forall a. c a => f a -> g (f' a)) -> NP f xs -> g (NP f' xs)
ctraverse'_NP :: forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> NP f xs
-> g (NP f' xs)
ctraverse'_NP proxy c
_ forall (a :: k). c a => f a -> g (f' a)
f = forall (ys :: [k]). All c ys => NP f ys -> g (NP f' ys)
go where
go :: All c ys => NP f ys -> g (NP f' ys)
go :: forall (ys :: [k]). All c ys => NP f ys -> g (NP f' ys)
go NP f ys
Nil = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall {k} (f :: k -> *). NP f '[]
Nil
go (f x
x :* NP f xs
xs) = forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
(:*) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (a :: k). c a => f a -> g (f' a)
f f x
x forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (ys :: [k]). All c ys => NP f ys -> g (NP f' ys)
go NP f xs
xs
traverse'_NP ::
forall xs f f' g. (SListI xs, Applicative g)
=> (forall a. f a -> g (f' a)) -> NP f xs -> g (NP f' xs)
traverse'_NP :: forall {k} (xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(SListI xs, Applicative g) =>
(forall (a :: k). f a -> g (f' a)) -> NP f xs -> g (NP f' xs)
traverse'_NP forall (a :: k). f a -> g (f' a)
f =
forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> NP f xs
-> g (NP f' xs)
ctraverse'_NP forall {k}. Proxy Top
topP forall (a :: k). f a -> g (f' a)
f
{-# INLINE traverse'_NP #-}
ctraverse'_POP :: (All2 c xss, Applicative g) => proxy c -> (forall a. c a => f a -> g (f' a)) -> POP f xss -> g (POP f' xss)
ctraverse'_POP :: forall {k} (c :: k -> Constraint) (xss :: [[k]]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *).
(All2 c xss, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> POP f xss
-> g (POP f' xss)
ctraverse'_POP proxy c
p forall (a :: k). c a => f a -> g (f' a)
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> NP f xs
-> g (NP f' xs)
ctraverse'_NP (forall {k} (proxy :: (k -> Constraint) -> *)
(c :: k -> Constraint).
proxy c -> Proxy (All c)
allP proxy c
p) (forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> NP f xs
-> g (NP f' xs)
ctraverse'_NP proxy c
p forall (a :: k). c a => f a -> g (f' a)
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (xss :: [[k]]). POP f xss -> NP (NP f) xss
unPOP
traverse'_POP :: (SListI2 xss, Applicative g) => (forall a. f a -> g (f' a)) -> POP f xss -> g (POP f' xss)
traverse'_POP :: forall {k} (xss :: [[k]]) (g :: * -> *) (f :: k -> *)
(f' :: k -> *).
(SListI2 xss, Applicative g) =>
(forall (a :: k). f a -> g (f' a)) -> POP f xss -> g (POP f' xss)
traverse'_POP forall (a :: k). f a -> g (f' a)
f =
forall {k} (c :: k -> Constraint) (xss :: [[k]]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *).
(All2 c xss, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> POP f xss
-> g (POP f' xss)
ctraverse'_POP forall {k}. Proxy Top
topP forall (a :: k). f a -> g (f' a)
f
{-# INLINE traverse'_POP #-}
instance HSequence NP where
hsequence' :: forall (xs :: [k]) (f :: * -> *) (g :: k -> *).
(SListIN NP xs, Applicative f) =>
NP (f :.: g) xs -> f (NP g xs)
hsequence' = forall {k} (f :: * -> *) (g :: k -> *) (xs :: [k]).
Applicative f =>
NP (f :.: g) xs -> f (NP g xs)
sequence'_NP
hctraverse' :: forall (c :: k -> Constraint) (xs :: [k]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *).
(AllN NP c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> NP f xs
-> g (NP f' xs)
hctraverse' = forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(All c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> NP f xs
-> g (NP f' xs)
ctraverse'_NP
htraverse' :: forall (xs :: [k]) (g :: * -> *) (f :: k -> *) (f' :: k -> *).
(SListIN NP xs, Applicative g) =>
(forall (a :: k). f a -> g (f' a)) -> NP f xs -> g (NP f' xs)
htraverse' = forall {k} (xs :: [k]) (f :: k -> *) (f' :: k -> *) (g :: * -> *).
(SListI xs, Applicative g) =>
(forall (a :: k). f a -> g (f' a)) -> NP f xs -> g (NP f' xs)
traverse'_NP
instance HSequence POP where
hsequence' :: forall (xs :: [[k]]) (f :: * -> *) (g :: k -> *).
(SListIN POP xs, Applicative f) =>
POP (f :.: g) xs -> f (POP g xs)
hsequence' = forall {k} (xss :: [[k]]) (f :: * -> *) (g :: k -> *).
(SListI xss, Applicative f) =>
POP (f :.: g) xss -> f (POP g xss)
sequence'_POP
hctraverse' :: forall (c :: k -> Constraint) (xs :: [[k]]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *).
(AllN POP c xs, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> POP f xs
-> g (POP f' xs)
hctraverse' = forall {k} (c :: k -> Constraint) (xss :: [[k]]) (g :: * -> *)
(proxy :: (k -> Constraint) -> *) (f :: k -> *) (f' :: k -> *).
(All2 c xss, Applicative g) =>
proxy c
-> (forall (a :: k). c a => f a -> g (f' a))
-> POP f xss
-> g (POP f' xss)
ctraverse'_POP
htraverse' :: forall (xs :: [[k]]) (g :: * -> *) (f :: k -> *) (f' :: k -> *).
(SListIN POP xs, Applicative g) =>
(forall (a :: k). f a -> g (f' a)) -> POP f xs -> g (POP f' xs)
htraverse' = forall {k} (xss :: [[k]]) (g :: * -> *) (f :: k -> *)
(f' :: k -> *).
(SListI2 xss, Applicative g) =>
(forall (a :: k). f a -> g (f' a)) -> POP f xss -> g (POP f' xss)
traverse'_POP
sequence_NP :: (SListI xs, Applicative f) => NP f xs -> f (NP I xs)
sequence_POP :: (All SListI xss, Applicative f) => POP f xss -> f (POP I xss)
sequence_NP :: forall (xs :: [*]) (f :: * -> *).
(SListI xs, Applicative f) =>
NP f xs -> f (NP I xs)
sequence_NP = forall {l} (h :: (* -> *) -> l -> *) (xs :: l) (f :: * -> *).
(SListIN h xs, SListIN (Prod h) xs, HSequence h, Applicative f) =>
h f xs -> f (h I xs)
hsequence
sequence_POP :: forall (xss :: [[*]]) (f :: * -> *).
(All SListI xss, Applicative f) =>
POP f xss -> f (POP I xss)
sequence_POP = forall {l} (h :: (* -> *) -> l -> *) (xs :: l) (f :: * -> *).
(SListIN h xs, SListIN (Prod h) xs, HSequence h, Applicative f) =>
h f xs -> f (h I xs)
hsequence
ctraverse_NP :: (All c xs, Applicative g) => proxy c -> (forall a. c a => f a -> g a) -> NP f xs -> g (NP I xs)
ctraverse_POP :: (All2 c xs, Applicative g) => proxy c -> (forall a. c a => f a -> g a) -> POP f xs -> g (POP I xs)
ctraverse_NP :: forall (c :: * -> Constraint) (xs :: [*]) (g :: * -> *)
(proxy :: (* -> Constraint) -> *) (f :: * -> *).
(All c xs, Applicative g) =>
proxy c -> (forall a. c a => f a -> g a) -> NP f xs -> g (NP I xs)
ctraverse_NP = forall {l} (h :: (* -> *) -> l -> *) (c :: * -> Constraint)
(xs :: l) (g :: * -> *) (proxy :: (* -> Constraint) -> *)
(f :: * -> *).
(HSequence h, AllN h c xs, Applicative g) =>
proxy c -> (forall a. c a => f a -> g a) -> h f xs -> g (h I xs)
hctraverse
ctraverse_POP :: forall (c :: * -> Constraint) (xs :: [[*]]) (g :: * -> *)
(proxy :: (* -> Constraint) -> *) (f :: * -> *).
(All2 c xs, Applicative g) =>
proxy c
-> (forall a. c a => f a -> g a) -> POP f xs -> g (POP I xs)
ctraverse_POP = forall {l} (h :: (* -> *) -> l -> *) (c :: * -> Constraint)
(xs :: l) (g :: * -> *) (proxy :: (* -> Constraint) -> *)
(f :: * -> *).
(HSequence h, AllN h c xs, Applicative g) =>
proxy c -> (forall a. c a => f a -> g a) -> h f xs -> g (h I xs)
hctraverse
cata_NP ::
forall r f xs .
r '[]
-> (forall y ys . f y -> r ys -> r (y ': ys))
-> NP f xs
-> r xs
cata_NP :: forall {k} (r :: [k] -> *) (f :: k -> *) (xs :: [k]).
r '[]
-> (forall (y :: k) (ys :: [k]). f y -> r ys -> r (y : ys))
-> NP f xs
-> r xs
cata_NP r '[]
nil forall (y :: k) (ys :: [k]). f y -> r ys -> r (y : ys)
cons = forall (ys :: [k]). NP f ys -> r ys
go
where
go :: forall ys . NP f ys -> r ys
go :: forall (ys :: [k]). NP f ys -> r ys
go NP f ys
Nil = r '[]
nil
go (f x
x :* NP f xs
xs) = forall (y :: k) (ys :: [k]). f y -> r ys -> r (y : ys)
cons f x
x (forall (ys :: [k]). NP f ys -> r ys
go NP f xs
xs)
ccata_NP ::
forall c proxy r f xs . (All c xs)
=> proxy c
-> r '[]
-> (forall y ys . c y => f y -> r ys -> r (y ': ys))
-> NP f xs
-> r xs
ccata_NP :: forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(r :: [k] -> *) (f :: k -> *) (xs :: [k]).
All c xs =>
proxy c
-> r '[]
-> (forall (y :: k) (ys :: [k]). c y => f y -> r ys -> r (y : ys))
-> NP f xs
-> r xs
ccata_NP proxy c
_ r '[]
nil forall (y :: k) (ys :: [k]). c y => f y -> r ys -> r (y : ys)
cons = forall (ys :: [k]). All c ys => NP f ys -> r ys
go
where
go :: forall ys . (All c ys) => NP f ys -> r ys
go :: forall (ys :: [k]). All c ys => NP f ys -> r ys
go NP f ys
Nil = r '[]
nil
go (f x
x :* NP f xs
xs) = forall (y :: k) (ys :: [k]). c y => f y -> r ys -> r (y : ys)
cons f x
x (forall (ys :: [k]). All c ys => NP f ys -> r ys
go NP f xs
xs)
ana_NP ::
forall s f xs .
SListI xs
=> (forall y ys . s (y ': ys) -> (f y, s ys))
-> s xs
-> NP f xs
ana_NP :: forall {k} (s :: [k] -> *) (f :: k -> *) (xs :: [k]).
SListI xs =>
(forall (y :: k) (ys :: [k]). s (y : ys) -> (f y, s ys))
-> s xs -> NP f xs
ana_NP forall (y :: k) (ys :: [k]). s (y : ys) -> (f y, s ys)
uncons =
forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(s :: [k] -> *) (f :: k -> *) (xs :: [k]).
All c xs =>
proxy c
-> (forall (y :: k) (ys :: [k]). c y => s (y : ys) -> (f y, s ys))
-> s xs
-> NP f xs
cana_NP forall {k}. Proxy Top
topP forall (y :: k) (ys :: [k]). s (y : ys) -> (f y, s ys)
uncons
{-# INLINE ana_NP #-}
cana_NP ::
forall c proxy s f xs . (All c xs)
=> proxy c
-> (forall y ys . c y => s (y ': ys) -> (f y, s ys))
-> s xs
-> NP f xs
cana_NP :: forall {k} (c :: k -> Constraint) (proxy :: (k -> Constraint) -> *)
(s :: [k] -> *) (f :: k -> *) (xs :: [k]).
All c xs =>
proxy c
-> (forall (y :: k) (ys :: [k]). c y => s (y : ys) -> (f y, s ys))
-> s xs
-> NP f xs
cana_NP proxy c
_ forall (y :: k) (ys :: [k]). c y => s (y : ys) -> (f y, s ys)
uncons = forall (ys :: [k]). All c ys => SList ys -> s ys -> NP f ys
go forall {k} (xs :: [k]). SListI xs => SList xs
sList
where
go :: forall ys . (All c ys) => SList ys -> s ys -> NP f ys
go :: forall (ys :: [k]). All c ys => SList ys -> s ys -> NP f ys
go SList ys
SNil s ys
_ = forall {k} (f :: k -> *). NP f '[]
Nil
go SList ys
SCons s ys
s = case forall (y :: k) (ys :: [k]). c y => s (y : ys) -> (f y, s ys)
uncons s ys
s of
(f x
x, s xs
s') -> f x
x forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* forall (ys :: [k]). All c ys => SList ys -> s ys -> NP f ys
go forall {k} (xs :: [k]). SListI xs => SList xs
sList s xs
s'
trans_NP ::
AllZip c xs ys
=> proxy c
-> (forall x y . c x y => f x -> g y)
-> NP f xs -> NP g ys
trans_NP :: forall {k} {k} (c :: k -> k -> Constraint) (xs :: [k]) (ys :: [k])
(proxy :: (k -> k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
AllZip c xs ys =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> NP f xs
-> NP g ys
trans_NP proxy c
_ forall (x :: k) (y :: k). c x y => f x -> g y
_t NP f xs
Nil = forall {k} (f :: k -> *). NP f '[]
Nil
trans_NP proxy c
p forall (x :: k) (y :: k). c x y => f x -> g y
t (f x
x :* NP f xs
xs) = forall (x :: k) (y :: k). c x y => f x -> g y
t f x
x forall {k} (f :: k -> *) (x :: k) (xs :: [k]).
f x -> NP f xs -> NP f (x : xs)
:* forall {k} {k} (c :: k -> k -> Constraint) (xs :: [k]) (ys :: [k])
(proxy :: (k -> k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
AllZip c xs ys =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> NP f xs
-> NP g ys
trans_NP proxy c
p forall (x :: k) (y :: k). c x y => f x -> g y
t NP f xs
xs
trans_POP ::
AllZip2 c xss yss
=> proxy c
-> (forall x y . c x y => f x -> g y)
-> POP f xss -> POP g yss
trans_POP :: forall {k} {k} (c :: k -> k -> Constraint) (xss :: [[k]])
(yss :: [[k]]) (proxy :: (k -> k -> Constraint) -> *) (f :: k -> *)
(g :: k -> *).
AllZip2 c xss yss =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> POP f xss
-> POP g yss
trans_POP proxy c
p forall (x :: k) (y :: k). c x y => f x -> g y
t =
forall k (f :: k -> *) (xss :: [[k]]). NP (NP f) xss -> POP f xss
POP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k} (c :: k -> k -> Constraint) (xs :: [k]) (ys :: [k])
(proxy :: (k -> k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
AllZip c xs ys =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> NP f xs
-> NP g ys
trans_NP (forall {a} {b} (proxy :: (a -> b -> Constraint) -> *)
(c :: a -> b -> Constraint).
proxy c -> Proxy (AllZip c)
allZipP proxy c
p) (forall {k} {k} (c :: k -> k -> Constraint) (xs :: [k]) (ys :: [k])
(proxy :: (k -> k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
AllZip c xs ys =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> NP f xs
-> NP g ys
trans_NP proxy c
p forall (x :: k) (y :: k). c x y => f x -> g y
t) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (xss :: [[k]]). POP f xss -> NP (NP f) xss
unPOP
allZipP :: proxy c -> Proxy (AllZip c)
allZipP :: forall {a} {b} (proxy :: (a -> b -> Constraint) -> *)
(c :: a -> b -> Constraint).
proxy c -> Proxy (AllZip c)
allZipP proxy c
_ = forall {k} (t :: k). Proxy t
Proxy
coerce_NP ::
forall f g xs ys .
AllZip (LiftedCoercible f g) xs ys
=> NP f xs -> NP g ys
coerce_NP :: forall {k} {k} (f :: k -> *) (g :: k -> *) (xs :: [k]) (ys :: [k]).
AllZip (LiftedCoercible f g) xs ys =>
NP f xs -> NP g ys
coerce_NP =
forall a b. a -> b
unsafeCoerce
_safe_coerce_NP ::
forall f g xs ys .
AllZip (LiftedCoercible f g) xs ys
=> NP f xs -> NP g ys
_safe_coerce_NP :: forall {k} {k} (f :: k -> *) (g :: k -> *) (xs :: [k]) (ys :: [k]).
AllZip (LiftedCoercible f g) xs ys =>
NP f xs -> NP g ys
_safe_coerce_NP =
forall {k} {k} (c :: k -> k -> Constraint) (xs :: [k]) (ys :: [k])
(proxy :: (k -> k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
AllZip c xs ys =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> NP f xs
-> NP g ys
trans_NP (forall {k} (t :: k). Proxy t
Proxy :: Proxy (LiftedCoercible f g)) coerce :: forall a b. Coercible a b => a -> b
coerce
coerce_POP ::
forall f g xss yss .
AllZip2 (LiftedCoercible f g) xss yss
=> POP f xss -> POP g yss
coerce_POP :: forall {k} {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]])
(yss :: [[k]]).
AllZip2 (LiftedCoercible f g) xss yss =>
POP f xss -> POP g yss
coerce_POP =
forall a b. a -> b
unsafeCoerce
_safe_coerce_POP ::
forall f g xss yss .
AllZip2 (LiftedCoercible f g) xss yss
=> POP f xss -> POP g yss
_safe_coerce_POP :: forall {k} {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]])
(yss :: [[k]]).
AllZip2 (LiftedCoercible f g) xss yss =>
POP f xss -> POP g yss
_safe_coerce_POP =
forall {k} {k} (c :: k -> k -> Constraint) (xss :: [[k]])
(yss :: [[k]]) (proxy :: (k -> k -> Constraint) -> *) (f :: k -> *)
(g :: k -> *).
AllZip2 c xss yss =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> POP f xss
-> POP g yss
trans_POP (forall {k} (t :: k). Proxy t
Proxy :: Proxy (LiftedCoercible f g)) coerce :: forall a b. Coercible a b => a -> b
coerce
fromI_NP ::
forall f xs ys .
AllZip (LiftedCoercible I f) xs ys
=> NP I xs -> NP f ys
fromI_NP :: forall {k} (f :: k -> *) (xs :: [*]) (ys :: [k]).
AllZip (LiftedCoercible I f) xs ys =>
NP I xs -> NP f ys
fromI_NP = forall {l1} {k2} {l2} (h1 :: (* -> *) -> l1 -> *) (f :: k2 -> *)
(xs :: l1) (ys :: l2) (h2 :: (k2 -> *) -> l2 -> *).
(AllZipN (Prod h1) (LiftedCoercible I f) xs ys, HTrans h1 h2) =>
h1 I xs -> h2 f ys
hfromI
toI_NP ::
forall f xs ys .
AllZip (LiftedCoercible f I) xs ys
=> NP f xs -> NP I ys
toI_NP :: forall {k} (f :: k -> *) (xs :: [k]) (ys :: [*]).
AllZip (LiftedCoercible f I) xs ys =>
NP f xs -> NP I ys
toI_NP = forall {k1} {l1} {l2} (h1 :: (k1 -> *) -> l1 -> *) (f :: k1 -> *)
(xs :: l1) (ys :: l2) (h2 :: (* -> *) -> l2 -> *).
(AllZipN (Prod h1) (LiftedCoercible f I) xs ys, HTrans h1 h2) =>
h1 f xs -> h2 I ys
htoI
fromI_POP ::
forall f xss yss .
AllZip2 (LiftedCoercible I f) xss yss
=> POP I xss -> POP f yss
fromI_POP :: forall {k} (f :: k -> *) (xss :: [[*]]) (yss :: [[k]]).
AllZip2 (LiftedCoercible I f) xss yss =>
POP I xss -> POP f yss
fromI_POP = forall {l1} {k2} {l2} (h1 :: (* -> *) -> l1 -> *) (f :: k2 -> *)
(xs :: l1) (ys :: l2) (h2 :: (k2 -> *) -> l2 -> *).
(AllZipN (Prod h1) (LiftedCoercible I f) xs ys, HTrans h1 h2) =>
h1 I xs -> h2 f ys
hfromI
toI_POP ::
forall f xss yss .
AllZip2 (LiftedCoercible f I) xss yss
=> POP f xss -> POP I yss
toI_POP :: forall {k} (f :: k -> *) (xss :: [[k]]) (yss :: [[*]]).
AllZip2 (LiftedCoercible f I) xss yss =>
POP f xss -> POP I yss
toI_POP = forall {k1} {l1} {l2} (h1 :: (k1 -> *) -> l1 -> *) (f :: k1 -> *)
(xs :: l1) (ys :: l2) (h2 :: (* -> *) -> l2 -> *).
(AllZipN (Prod h1) (LiftedCoercible f I) xs ys, HTrans h1 h2) =>
h1 f xs -> h2 I ys
htoI
instance HTrans NP NP where
htrans :: forall (c :: k1 -> k2 -> Constraint) (xs :: [k1]) (ys :: [k2])
(proxy :: (k1 -> k2 -> Constraint) -> *) (f :: k1 -> *)
(g :: k2 -> *).
AllZipN (Prod NP) c xs ys =>
proxy c
-> (forall (x :: k1) (y :: k2). c x y => f x -> g y)
-> NP f xs
-> NP g ys
htrans = forall {k} {k} (c :: k -> k -> Constraint) (xs :: [k]) (ys :: [k])
(proxy :: (k -> k -> Constraint) -> *) (f :: k -> *) (g :: k -> *).
AllZip c xs ys =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> NP f xs
-> NP g ys
trans_NP
hcoerce :: forall (f :: k1 -> *) (g :: k2 -> *) (xs :: [k1]) (ys :: [k2]).
AllZipN (Prod NP) (LiftedCoercible f g) xs ys =>
NP f xs -> NP g ys
hcoerce = forall {k} {k} (f :: k -> *) (g :: k -> *) (xs :: [k]) (ys :: [k]).
AllZip (LiftedCoercible f g) xs ys =>
NP f xs -> NP g ys
coerce_NP
instance HTrans POP POP where
htrans :: forall (c :: k1 -> k2 -> Constraint) (xs :: [[k1]]) (ys :: [[k2]])
(proxy :: (k1 -> k2 -> Constraint) -> *) (f :: k1 -> *)
(g :: k2 -> *).
AllZipN (Prod POP) c xs ys =>
proxy c
-> (forall (x :: k1) (y :: k2). c x y => f x -> g y)
-> POP f xs
-> POP g ys
htrans = forall {k} {k} (c :: k -> k -> Constraint) (xss :: [[k]])
(yss :: [[k]]) (proxy :: (k -> k -> Constraint) -> *) (f :: k -> *)
(g :: k -> *).
AllZip2 c xss yss =>
proxy c
-> (forall (x :: k) (y :: k). c x y => f x -> g y)
-> POP f xss
-> POP g yss
trans_POP
hcoerce :: forall (f :: k1 -> *) (g :: k2 -> *) (xs :: [[k1]]) (ys :: [[k2]]).
AllZipN (Prod POP) (LiftedCoercible f g) xs ys =>
POP f xs -> POP g ys
hcoerce = forall {k} {k} (f :: k -> *) (g :: k -> *) (xss :: [[k]])
(yss :: [[k]]).
AllZip2 (LiftedCoercible f g) xss yss =>
POP f xss -> POP g yss
coerce_POP