{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE UndecidableInstances #-}
module Control.Effect.Freer where
import Control.Applicative (Alternative)
import Control.Effect.Class (
EffectDataHandler,
EffectsVia (EffectsVia),
Instruction,
SendIns,
Tag,
getTag,
runEffectsVia,
sendIns,
type (~>),
)
import Control.Freer.Trans (
TransFreer,
hoistFreer,
interposeLowerT,
interpretFT,
liftInsT,
liftLowerFT,
reinterpretFT,
runInterpretF,
transformT,
)
import Control.Monad (MonadPlus)
import Control.Monad.Cont (ContT (ContT), runContT)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Trans (MonadTrans, lift)
import Control.Monad.Trans.Freer (MonadTransFreer, interpretMK, interpretMT, reinterpretMK, reinterpretMT)
import Control.Monad.Trans.Freer.Church (FreerChurchT)
import Data.Coerce (Coercible, coerce)
import Data.Free.Extensible (ExtensibleUnion)
import Data.Free.Sum (caseF, pattern L1, pattern R1, type (+))
import Data.Free.Union (
IsMember,
Member,
Union (
absurdUnion,
bundleUnion2,
bundleUnion3,
bundleUnion4,
decomp,
flipUnion,
flipUnion3,
flipUnionUnder,
inject,
inject0,
project,
rot3,
rot3',
unbundleUnion2,
unbundleUnion3,
unbundleUnion4,
weaken,
weaken2,
weaken2Under,
weaken2Under2,
weaken3,
weaken3Under,
weaken4,
weakenUnder,
weakenUnder2,
weakenUnder3
),
(|+|:),
)
import Data.Function ((&))
import Data.Kind (Type)
newtype
FreerUnion
(fr :: Instruction -> (Type -> Type) -> Type -> Type)
u
(es :: [Instruction])
f
a = FreerUnion {forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
FreerUnion fr u es f a -> fr (u es) f a
runFreerUnion :: fr (u es) f a}
deriving newtype (forall a b. a -> FreerUnion fr u es f b -> FreerUnion fr u es f a
forall a b.
(a -> b) -> FreerUnion fr u es f a -> FreerUnion fr u es f b
forall (f :: Instruction).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
a -> FreerUnion fr u es f b -> FreerUnion fr u es f a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
(a -> b) -> FreerUnion fr u es f a -> FreerUnion fr u es f b
<$ :: forall a b. a -> FreerUnion fr u es f b -> FreerUnion fr u es f a
$c<$ :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
a -> FreerUnion fr u es f b -> FreerUnion fr u es f a
fmap :: forall a b.
(a -> b) -> FreerUnion fr u es f a -> FreerUnion fr u es f b
$cfmap :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
(a -> b) -> FreerUnion fr u es f a -> FreerUnion fr u es f b
Functor, forall a. a -> FreerUnion fr u es f a
forall a b.
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f a
forall a b.
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
forall a b.
FreerUnion fr u es f (a -> b)
-> FreerUnion fr u es f a -> FreerUnion fr u es f b
forall a b c.
(a -> b -> c)
-> FreerUnion fr u es f a
-> FreerUnion fr u es f b
-> FreerUnion fr u es f c
forall (f :: Instruction).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Applicative (fr (u es) f) =>
Functor (FreerUnion fr u es f)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Applicative (fr (u es) f) =>
a -> FreerUnion fr u es f a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnion fr u es f (a -> b)
-> FreerUnion fr u es f a -> FreerUnion fr u es f b
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b c.
Applicative (fr (u es) f) =>
(a -> b -> c)
-> FreerUnion fr u es f a
-> FreerUnion fr u es f b
-> FreerUnion fr u es f c
<* :: forall a b.
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f a
$c<* :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f a
*> :: forall a b.
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
$c*> :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
liftA2 :: forall a b c.
(a -> b -> c)
-> FreerUnion fr u es f a
-> FreerUnion fr u es f b
-> FreerUnion fr u es f c
$cliftA2 :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b c.
Applicative (fr (u es) f) =>
(a -> b -> c)
-> FreerUnion fr u es f a
-> FreerUnion fr u es f b
-> FreerUnion fr u es f c
<*> :: forall a b.
FreerUnion fr u es f (a -> b)
-> FreerUnion fr u es f a -> FreerUnion fr u es f b
$c<*> :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnion fr u es f (a -> b)
-> FreerUnion fr u es f a -> FreerUnion fr u es f b
pure :: forall a. a -> FreerUnion fr u es f a
$cpure :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Applicative (fr (u es) f) =>
a -> FreerUnion fr u es f a
Applicative, forall a. FreerUnion fr u es f a
forall a. FreerUnion fr u es f a -> FreerUnion fr u es f [a]
forall a.
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
forall (f :: Instruction).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Alternative (fr (u es) f) =>
Applicative (FreerUnion fr u es f)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a -> FreerUnion fr u es f [a]
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
many :: forall a. FreerUnion fr u es f a -> FreerUnion fr u es f [a]
$cmany :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a -> FreerUnion fr u es f [a]
some :: forall a. FreerUnion fr u es f a -> FreerUnion fr u es f [a]
$csome :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a -> FreerUnion fr u es f [a]
<|> :: forall a.
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
$c<|> :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
empty :: forall a. FreerUnion fr u es f a
$cempty :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnion fr u es f a
Alternative, forall a. a -> FreerUnion fr u es f a
forall a b.
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
forall a b.
FreerUnion fr u es f a
-> (a -> FreerUnion fr u es f b) -> FreerUnion fr u es f b
forall (m :: Instruction).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Monad (fr (u es) f) =>
Applicative (FreerUnion fr u es f)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Monad (fr (u es) f) =>
a -> FreerUnion fr u es f a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnion fr u es f a
-> (a -> FreerUnion fr u es f b) -> FreerUnion fr u es f b
return :: forall a. a -> FreerUnion fr u es f a
$creturn :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Monad (fr (u es) f) =>
a -> FreerUnion fr u es f a
>> :: forall a b.
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
$c>> :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f b -> FreerUnion fr u es f b
>>= :: forall a b.
FreerUnion fr u es f a
-> (a -> FreerUnion fr u es f b) -> FreerUnion fr u es f b
$c>>= :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnion fr u es f a
-> (a -> FreerUnion fr u es f b) -> FreerUnion fr u es f b
Monad, forall a. FreerUnion fr u es f a
forall a.
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
forall (m :: Instruction).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
MonadPlus (fr (u es) f) =>
Monad (FreerUnion fr u es f)
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
MonadPlus (fr (u es) f) =>
Alternative (FreerUnion fr u es f)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnion fr u es f a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
mplus :: forall a.
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
$cmplus :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnion fr u es f a
-> FreerUnion fr u es f a -> FreerUnion fr u es f a
mzero :: forall a. FreerUnion fr u es f a
$cmzero :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnion fr u es f a
MonadPlus)
deriving stock (forall a. FreerUnion fr u es f a -> Bool
forall m a. Monoid m => (a -> m) -> FreerUnion fr u es f a -> m
forall a b. (a -> b -> b) -> b -> FreerUnion fr u es f a -> b
forall (t :: Instruction).
(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
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Eq a) =>
a -> FreerUnion fr u es f a -> Bool
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Num a) =>
FreerUnion fr u es f a -> a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Ord a) =>
FreerUnion fr u es f a -> a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m.
(Foldable (fr (u es) f), Monoid m) =>
FreerUnion fr u es f m -> m
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnion fr u es f a -> Bool
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnion fr u es f a -> Int
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnion fr u es f a -> [a]
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
(a -> a -> a) -> FreerUnion fr u es f a -> a
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m a.
(Foldable (fr (u es) f), Monoid m) =>
(a -> m) -> FreerUnion fr u es f a -> m
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) b a.
Foldable (fr (u es) f) =>
(b -> a -> b) -> b -> FreerUnion fr u es f a -> b
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Foldable (fr (u es) f) =>
(a -> b -> b) -> b -> FreerUnion fr u es f a -> b
product :: forall a. Num a => FreerUnion fr u es f a -> a
$cproduct :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Num a) =>
FreerUnion fr u es f a -> a
sum :: forall a. Num a => FreerUnion fr u es f a -> a
$csum :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Num a) =>
FreerUnion fr u es f a -> a
minimum :: forall a. Ord a => FreerUnion fr u es f a -> a
$cminimum :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Ord a) =>
FreerUnion fr u es f a -> a
maximum :: forall a. Ord a => FreerUnion fr u es f a -> a
$cmaximum :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Ord a) =>
FreerUnion fr u es f a -> a
elem :: forall a. Eq a => a -> FreerUnion fr u es f a -> Bool
$celem :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Eq a) =>
a -> FreerUnion fr u es f a -> Bool
length :: forall a. FreerUnion fr u es f a -> Int
$clength :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnion fr u es f a -> Int
null :: forall a. FreerUnion fr u es f a -> Bool
$cnull :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnion fr u es f a -> Bool
toList :: forall a. FreerUnion fr u es f a -> [a]
$ctoList :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnion fr u es f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> FreerUnion fr u es f a -> a
$cfoldl1 :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
(a -> a -> a) -> FreerUnion fr u es f a -> a
foldr1 :: forall a. (a -> a -> a) -> FreerUnion fr u es f a -> a
$cfoldr1 :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
(a -> a -> a) -> FreerUnion fr u es f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> FreerUnion fr u es f a -> b
$cfoldl' :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) b a.
Foldable (fr (u es) f) =>
(b -> a -> b) -> b -> FreerUnion fr u es f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> FreerUnion fr u es f a -> b
$cfoldl :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) b a.
Foldable (fr (u es) f) =>
(b -> a -> b) -> b -> FreerUnion fr u es f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> FreerUnion fr u es f a -> b
$cfoldr' :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Foldable (fr (u es) f) =>
(a -> b -> b) -> b -> FreerUnion fr u es f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> FreerUnion fr u es f a -> b
$cfoldr :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Foldable (fr (u es) f) =>
(a -> b -> b) -> b -> FreerUnion fr u es f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> FreerUnion fr u es f a -> m
$cfoldMap' :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m a.
(Foldable (fr (u es) f), Monoid m) =>
(a -> m) -> FreerUnion fr u es f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> FreerUnion fr u es f a -> m
$cfoldMap :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m a.
(Foldable (fr (u es) f), Monoid m) =>
(a -> m) -> FreerUnion fr u es f a -> m
fold :: forall m. Monoid m => FreerUnion fr u es f m -> m
$cfold :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m.
(Foldable (fr (u es) f), Monoid m) =>
FreerUnion fr u es f m -> m
Foldable, forall (t :: Instruction).
Functor t
-> Foldable t
-> (forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: Instruction) a.
Applicative f =>
t (f a) -> f (t a))
-> (forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: Instruction) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> FreerUnion fr u es f a -> f (FreerUnion fr u es f b)
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Traversable (fr (u es) f) =>
Functor (FreerUnion fr u es f)
forall {fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Traversable (fr (u es) f) =>
Foldable (FreerUnion fr u es f)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a.
(Traversable (fr (u es) f), Monad m) =>
FreerUnion fr u es f (m a) -> m (FreerUnion fr u es f a)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a.
(Traversable (fr (u es) f), Applicative f) =>
FreerUnion fr u es f (f a) -> f (FreerUnion fr u es f a)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a b.
(Traversable (fr (u es) f), Monad m) =>
(a -> m b) -> FreerUnion fr u es f a -> m (FreerUnion fr u es f b)
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a b.
(Traversable (fr (u es) f), Applicative f) =>
(a -> f b) -> FreerUnion fr u es f a -> f (FreerUnion fr u es f b)
sequence :: forall (m :: Instruction) a.
Monad m =>
FreerUnion fr u es f (m a) -> m (FreerUnion fr u es f a)
$csequence :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a.
(Traversable (fr (u es) f), Monad m) =>
FreerUnion fr u es f (m a) -> m (FreerUnion fr u es f a)
mapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> FreerUnion fr u es f a -> m (FreerUnion fr u es f b)
$cmapM :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a b.
(Traversable (fr (u es) f), Monad m) =>
(a -> m b) -> FreerUnion fr u es f a -> m (FreerUnion fr u es f b)
sequenceA :: forall (f :: Instruction) a.
Applicative f =>
FreerUnion fr u es f (f a) -> f (FreerUnion fr u es f a)
$csequenceA :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a.
(Traversable (fr (u es) f), Applicative f) =>
FreerUnion fr u es f (f a) -> f (FreerUnion fr u es f a)
traverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> FreerUnion fr u es f a -> f (FreerUnion fr u es f b)
$ctraverse :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a b.
(Traversable (fr (u es) f), Applicative f) =>
(a -> f b) -> FreerUnion fr u es f a -> f (FreerUnion fr u es f b)
Traversable)
type FreerEffects fr u es f = EffectsVia EffectDataHandler (FreerUnion fr u es f)
unFreerEffects :: FreerEffects fr u es f ~> fr (u es) f
unFreerEffects :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
FreerUnion fr u es f a -> fr (u es) f a
runFreerUnion forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (handlerSystem :: k) (f :: Instruction) a.
EffectsVia handlerSystem f a -> f a
runEffectsVia
{-# INLINE unFreerEffects #-}
freerEffects :: fr (u es) f ~> FreerEffects fr u es f
freerEffects :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
fr (u es) f ~> FreerEffects fr u es f
freerEffects = forall {k} (handlerSystem :: k) (f :: Instruction) a.
f a -> EffectsVia handlerSystem f a
EffectsVia forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
fr (u es) f a -> FreerUnion fr u es f a
FreerUnion
{-# INLINE freerEffects #-}
newtype FreerUnionForSend handleHere fr u es f a = FreerUnionForSend
{forall {k} (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
FreerUnionForSend handleHere fr u es f a -> FreerUnion fr u es f a
runFreerUnionForSend :: FreerUnion fr u es f a}
deriving newtype (forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
(a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
forall a b.
a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
forall a b.
(a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
forall (f :: Instruction).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b.
a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
$c<$ :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
fmap :: forall a b.
(a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
$cfmap :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Functor (fr (u es) f) =>
(a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
Functor, forall a. a -> FreerUnionForSend handleHere fr u es f a
forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Applicative (fr (u es) f) =>
Functor (FreerUnionForSend handleHere fr u es f)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Applicative (fr (u es) f) =>
a -> FreerUnionForSend handleHere fr u es f a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f (a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b c.
Applicative (fr (u es) f) =>
(a -> b -> c)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f c
forall a b.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
forall a b.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
forall a b.
FreerUnionForSend handleHere fr u es f (a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
forall a b c.
(a -> b -> c)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f c
forall (f :: Instruction).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: forall a b.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
$c<* :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f a
*> :: forall a b.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
$c*> :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
liftA2 :: forall a b c.
(a -> b -> c)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f c
$cliftA2 :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b c.
Applicative (fr (u es) f) =>
(a -> b -> c)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f c
<*> :: forall a b.
FreerUnionForSend handleHere fr u es f (a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
$c<*> :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Applicative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f (a -> b)
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
pure :: forall a. a -> FreerUnionForSend handleHere fr u es f a
$cpure :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Applicative (fr (u es) f) =>
a -> FreerUnionForSend handleHere fr u es f a
Applicative, forall a. FreerUnionForSend handleHere fr u es f a
forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f [a]
forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Alternative (fr (u es) f) =>
Applicative (FreerUnionForSend handleHere fr u es f)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f [a]
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
forall (f :: Instruction).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
many :: forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f [a]
$cmany :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f [a]
some :: forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f [a]
$csome :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f [a]
<|> :: forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
$c<|> :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
empty :: forall a. FreerUnionForSend handleHere fr u es f a
$cempty :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Alternative (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
Alternative, forall a. a -> FreerUnionForSend handleHere fr u es f a
forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Monad (fr (u es) f) =>
Applicative (FreerUnionForSend handleHere fr u es f)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Monad (fr (u es) f) =>
a -> FreerUnionForSend handleHere fr u es f a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> (a -> FreerUnionForSend handleHere fr u es f b)
-> FreerUnionForSend handleHere fr u es f b
forall a b.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
forall a b.
FreerUnionForSend handleHere fr u es f a
-> (a -> FreerUnionForSend handleHere fr u es f b)
-> FreerUnionForSend handleHere fr u es f b
forall (m :: Instruction).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: forall a. a -> FreerUnionForSend handleHere fr u es f a
$creturn :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Monad (fr (u es) f) =>
a -> FreerUnionForSend handleHere fr u es f a
>> :: forall a b.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
$c>> :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f b
-> FreerUnionForSend handleHere fr u es f b
>>= :: forall a b.
FreerUnionForSend handleHere fr u es f a
-> (a -> FreerUnionForSend handleHere fr u es f b)
-> FreerUnionForSend handleHere fr u es f b
$c>>= :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Monad (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> (a -> FreerUnionForSend handleHere fr u es f b)
-> FreerUnionForSend handleHere fr u es f b
Monad, forall a. FreerUnionForSend handleHere fr u es f a
forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
MonadPlus (fr (u es) f) =>
Monad (FreerUnionForSend handleHere fr u es f)
forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
MonadPlus (fr (u es) f) =>
Alternative (FreerUnionForSend handleHere fr u es f)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
forall (m :: Instruction).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
mplus :: forall a.
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
$cmplus :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
-> FreerUnionForSend handleHere fr u es f a
mzero :: forall a. FreerUnionForSend handleHere fr u es f a
$cmzero :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
MonadPlus (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a
MonadPlus)
deriving stock (forall a. FreerUnionForSend handleHere fr u es f a -> Bool
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Eq a) =>
a -> FreerUnionForSend handleHere fr u es f a -> Bool
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Num a) =>
FreerUnionForSend handleHere fr u es f a -> a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Ord a) =>
FreerUnionForSend handleHere fr u es f a -> a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m.
(Foldable (fr (u es) f), Monoid m) =>
FreerUnionForSend handleHere fr u es f m -> m
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a -> Bool
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a -> Int
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a -> [a]
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
(a -> a -> a) -> FreerUnionForSend handleHere fr u es f a -> a
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m a.
(Foldable (fr (u es) f), Monoid m) =>
(a -> m) -> FreerUnionForSend handleHere fr u es f a -> m
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) b a.
Foldable (fr (u es) f) =>
(b -> a -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Foldable (fr (u es) f) =>
(a -> b -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
forall m a.
Monoid m =>
(a -> m) -> FreerUnionForSend handleHere fr u es f a -> m
forall a b.
(a -> b -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
forall (t :: Instruction).
(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 => FreerUnionForSend handleHere fr u es f a -> a
$cproduct :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Num a) =>
FreerUnionForSend handleHere fr u es f a -> a
sum :: forall a. Num a => FreerUnionForSend handleHere fr u es f a -> a
$csum :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Num a) =>
FreerUnionForSend handleHere fr u es f a -> a
minimum :: forall a. Ord a => FreerUnionForSend handleHere fr u es f a -> a
$cminimum :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Ord a) =>
FreerUnionForSend handleHere fr u es f a -> a
maximum :: forall a. Ord a => FreerUnionForSend handleHere fr u es f a -> a
$cmaximum :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Ord a) =>
FreerUnionForSend handleHere fr u es f a -> a
elem :: forall a.
Eq a =>
a -> FreerUnionForSend handleHere fr u es f a -> Bool
$celem :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
(Foldable (fr (u es) f), Eq a) =>
a -> FreerUnionForSend handleHere fr u es f a -> Bool
length :: forall a. FreerUnionForSend handleHere fr u es f a -> Int
$clength :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a -> Int
null :: forall a. FreerUnionForSend handleHere fr u es f a -> Bool
$cnull :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a -> Bool
toList :: forall a. FreerUnionForSend handleHere fr u es f a -> [a]
$ctoList :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
FreerUnionForSend handleHere fr u es f a -> [a]
foldl1 :: forall a.
(a -> a -> a) -> FreerUnionForSend handleHere fr u es f a -> a
$cfoldl1 :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
(a -> a -> a) -> FreerUnionForSend handleHere fr u es f a -> a
foldr1 :: forall a.
(a -> a -> a) -> FreerUnionForSend handleHere fr u es f a -> a
$cfoldr1 :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
Foldable (fr (u es) f) =>
(a -> a -> a) -> FreerUnionForSend handleHere fr u es f a -> a
foldl' :: forall b a.
(b -> a -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
$cfoldl' :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) b a.
Foldable (fr (u es) f) =>
(b -> a -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
foldl :: forall b a.
(b -> a -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
$cfoldl :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) b a.
Foldable (fr (u es) f) =>
(b -> a -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
foldr' :: forall a b.
(a -> b -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
$cfoldr' :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Foldable (fr (u es) f) =>
(a -> b -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
foldr :: forall a b.
(a -> b -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
$cfoldr :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a b.
Foldable (fr (u es) f) =>
(a -> b -> b) -> b -> FreerUnionForSend handleHere fr u es f a -> b
foldMap' :: forall m a.
Monoid m =>
(a -> m) -> FreerUnionForSend handleHere fr u es f a -> m
$cfoldMap' :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m a.
(Foldable (fr (u es) f), Monoid m) =>
(a -> m) -> FreerUnionForSend handleHere fr u es f a -> m
foldMap :: forall m a.
Monoid m =>
(a -> m) -> FreerUnionForSend handleHere fr u es f a -> m
$cfoldMap :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m a.
(Foldable (fr (u es) f), Monoid m) =>
(a -> m) -> FreerUnionForSend handleHere fr u es f a -> m
fold :: forall m. Monoid m => FreerUnionForSend handleHere fr u es f m -> m
$cfold :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) m.
(Foldable (fr (u es) f), Monoid m) =>
FreerUnionForSend handleHere fr u es f m -> m
Foldable, forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Traversable (fr (u es) f) =>
Functor (FreerUnionForSend handleHere fr u es f)
forall {k} {handleHere :: k}
{fr :: Instruction -> Instruction -> Instruction}
{u :: [Instruction] -> Instruction} {es :: [Instruction]}
{f :: Instruction}.
Traversable (fr (u es) f) =>
Foldable (FreerUnionForSend handleHere fr u es f)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a.
(Traversable (fr (u es) f), Monad m) =>
FreerUnionForSend handleHere fr u es f (m a)
-> m (FreerUnionForSend handleHere fr u es f a)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a.
(Traversable (fr (u es) f), Applicative f) =>
FreerUnionForSend handleHere fr u es f (f a)
-> f (FreerUnionForSend handleHere fr u es f a)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a b.
(Traversable (fr (u es) f), Monad m) =>
(a -> m b)
-> FreerUnionForSend handleHere fr u es f a
-> m (FreerUnionForSend handleHere fr u es f b)
forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a b.
(Traversable (fr (u es) f), Applicative f) =>
(a -> f b)
-> FreerUnionForSend handleHere fr u es f a
-> f (FreerUnionForSend handleHere fr u es f b)
forall (t :: Instruction).
Functor t
-> Foldable t
-> (forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: Instruction) a.
Applicative f =>
t (f a) -> f (t a))
-> (forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: Instruction) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (f :: Instruction) a b.
Applicative f =>
(a -> f b)
-> FreerUnionForSend handleHere fr u es f a
-> f (FreerUnionForSend handleHere fr u es f b)
sequence :: forall (m :: Instruction) a.
Monad m =>
FreerUnionForSend handleHere fr u es f (m a)
-> m (FreerUnionForSend handleHere fr u es f a)
$csequence :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a.
(Traversable (fr (u es) f), Monad m) =>
FreerUnionForSend handleHere fr u es f (m a)
-> m (FreerUnionForSend handleHere fr u es f a)
mapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b)
-> FreerUnionForSend handleHere fr u es f a
-> m (FreerUnionForSend handleHere fr u es f b)
$cmapM :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (m :: Instruction) a b.
(Traversable (fr (u es) f), Monad m) =>
(a -> m b)
-> FreerUnionForSend handleHere fr u es f a
-> m (FreerUnionForSend handleHere fr u es f b)
sequenceA :: forall (f :: Instruction) a.
Applicative f =>
FreerUnionForSend handleHere fr u es f (f a)
-> f (FreerUnionForSend handleHere fr u es f a)
$csequenceA :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a.
(Traversable (fr (u es) f), Applicative f) =>
FreerUnionForSend handleHere fr u es f (f a)
-> f (FreerUnionForSend handleHere fr u es f a)
traverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b)
-> FreerUnionForSend handleHere fr u es f a
-> f (FreerUnionForSend handleHere fr u es f b)
$ctraverse :: forall k (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (f :: Instruction) a b.
(Traversable (fr (u es) f), Applicative f) =>
(a -> f b)
-> FreerUnionForSend handleHere fr u es f a
-> f (FreerUnionForSend handleHere fr u es f b)
Traversable)
instance
SendIns e (FreerUnionForSend (e `IsMember` es) fr u es f) =>
SendIns e (FreerUnion fr u es f)
where
sendIns :: forall a. e a -> FreerUnion fr u es f a
sendIns = forall {k} (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
FreerUnionForSend handleHere fr u es f a -> FreerUnion fr u es f a
runFreerUnionForSend @(e `IsMember` es) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns
{-# INLINE sendIns #-}
instance
(TransFreer c fr, Union u, Member u e es) =>
SendIns e (FreerUnionForSend 'True fr u es f)
where
sendIns :: forall a. e a -> FreerUnionForSend 'True fr u es f a
sendIns = forall {k} (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
FreerUnion fr u es f a -> FreerUnionForSend handleHere fr u es f a
FreerUnionForSend forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
fr (u es) f a -> FreerUnion fr u es f a
FreerUnion forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]).
(Union u, HasMembership u f fs) =>
f ~> u fs
inject
{-# INLINE sendIns #-}
instance (TransFreer c fr, SendIns e f, c f) => SendIns e (FreerUnionForSend 'False fr u es f) where
sendIns :: forall a. e a -> FreerUnionForSend 'False fr u es f a
sendIns = forall {k} (handleHere :: k)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
FreerUnion fr u es f a -> FreerUnionForSend handleHere fr u es f a
FreerUnionForSend forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a.
fr (u es) f a -> FreerUnion fr u es f a
FreerUnion forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns
{-# INLINE sendIns #-}
interpret ::
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u es f) ->
FreerEffects fr u (e ': es) f ~> FreerEffects fr u es f
interpret :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(e :: Instruction) (es :: [Instruction]).
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u es f)
-> FreerEffects fr u (e : es) f ~> FreerEffects fr u es f
interpret e ~> FreerEffects fr u es f
i =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT \u (e : es) x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
Union u =>
u (f : fs) a -> Either (f a) (u fs a)
decomp u (e : es) x
u of
Left e x
e -> forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects forall a b. (a -> b) -> a -> b
$ e ~> FreerEffects fr u es f
i e x
e
Right u es x
e -> forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT u es x
e
interpretT ::
forall t fr u e es f.
(MonadTransFreer fr, Union u, MonadTrans t, Monad f, Monad (t (FreerEffects fr u es f))) =>
(e ~> t (FreerEffects fr u es f)) ->
FreerEffects fr u (e ': es) f ~> t (FreerEffects fr u es f)
interpretT :: forall (t :: Instruction -> Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (e :: Instruction)
(es :: [Instruction]) (f :: Instruction).
(MonadTransFreer fr, Union u, MonadTrans t, Monad f,
Monad (t (FreerEffects fr u es f))) =>
(e ~> t (FreerEffects fr u es f))
-> FreerEffects fr u (e : es) f ~> t (FreerEffects fr u es f)
interpretT e ~> t (FreerEffects fr u es f)
i = forall (fr :: Instruction -> Instruction -> Instruction)
(m :: Instruction) (t :: Instruction -> Instruction)
(ins :: Instruction).
(MonadTransFreer fr, Monad m, MonadTrans t, Monad (t m)) =>
(ins ~> t m) -> fr ins m ~> t m
interpretMT e ~> t (FreerEffects fr u es f)
i forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (c :: Instruction -> Constraint)
(fr' :: Instruction -> Instruction -> Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]) (e :: Instruction).
(TransFreer c fr', TransFreer c fr, c f,
c (FreerEffects fr u es f), Union u) =>
FreerEffects fr u (e : es) f ~> fr' e (FreerEffects fr u es f)
splitFreerEffects @_ @fr
{-# INLINE interpretT #-}
interpretK ::
(MonadTransFreer fr, Union u, Monad f) =>
(a -> FreerEffects fr u es f r) ->
(forall x. (x -> FreerEffects fr u es f r) -> e x -> FreerEffects fr u es f r) ->
FreerEffects fr u (e ': es) f a ->
FreerEffects fr u es f r
interpretK :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction) a
(es :: [Instruction]) r (e :: Instruction).
(MonadTransFreer fr, Union u, Monad f) =>
(a -> FreerEffects fr u es f r)
-> (forall x.
(x -> FreerEffects fr u es f r) -> e x -> FreerEffects fr u es f r)
-> FreerEffects fr u (e : es) f a
-> FreerEffects fr u es f r
interpretK a -> FreerEffects fr u es f r
k forall x.
(x -> FreerEffects fr u es f r) -> e x -> FreerEffects fr u es f r
i = (forall {k} (r :: k) (m :: k -> *) a.
ContT r m a -> (a -> m r) -> m r
`runContT` a -> FreerEffects fr u es f r
k) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (e :: Instruction)
(es :: [Instruction]) (f :: Instruction).
(MonadTransFreer fr, Union u, Monad f) =>
(e ~> ContT r (FreerEffects fr u es f))
-> FreerEffects fr u (e : es) f ~> ContT r (FreerEffects fr u es f)
interpretContT \e x
e -> forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall x.
(x -> FreerEffects fr u es f r) -> e x -> FreerEffects fr u es f r
`i` e x
e)
{-# INLINE interpretK #-}
interpretContT ::
forall r fr u e es f.
(MonadTransFreer fr, Union u, Monad f) =>
(e ~> ContT r (FreerEffects fr u es f)) ->
FreerEffects fr u (e ': es) f ~> ContT r (FreerEffects fr u es f)
interpretContT :: forall r (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (e :: Instruction)
(es :: [Instruction]) (f :: Instruction).
(MonadTransFreer fr, Union u, Monad f) =>
(e ~> ContT r (FreerEffects fr u es f))
-> FreerEffects fr u (e : es) f ~> ContT r (FreerEffects fr u es f)
interpretContT e ~> ContT r (FreerEffects fr u es f)
i = forall (fr :: Instruction -> Instruction -> Instruction)
(m :: Instruction) (ins :: Instruction) r.
(MonadTransFreer fr, Monad m) =>
(ins ~> ContT r m) -> fr ins m ~> ContT r m
interpretMK e ~> ContT r (FreerEffects fr u es f)
i forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (c :: Instruction -> Constraint)
(fr' :: Instruction -> Instruction -> Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]) (e :: Instruction).
(TransFreer c fr', TransFreer c fr, c f,
c (FreerEffects fr u es f), Union u) =>
FreerEffects fr u (e : es) f ~> fr' e (FreerEffects fr u es f)
splitFreerEffects @_ @fr
{-# INLINE interpretContT #-}
interpretAll ::
(TransFreer c fr, Union u, c f, c g) =>
(f ~> g) ->
(u es ~> g) ->
(e ~> g) ->
FreerEffects fr u (e ': es) f ~> g
interpretAll :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(g :: Instruction) (es :: [Instruction]) (e :: Instruction).
(TransFreer c fr, Union u, c f, c g) =>
(f ~> g)
-> (u es ~> g) -> (e ~> g) -> FreerEffects fr u (e : es) f ~> g
interpretAll f ~> g
iLower u es ~> g
iOther e ~> g
iTarget FreerEffects fr u (e : es) f x
a =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects FreerEffects fr u (e : es) f x
a forall a b. a -> (a -> b) -> b
& forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT f ~> g
iLower \u (e : es) x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
Union u =>
u (f : fs) a -> Either (f a) (u fs a)
decomp u (e : es) x
u of
Left e x
e -> e ~> g
iTarget e x
e
Right u es x
e -> u es ~> g
iOther u es x
e
reinterpret ::
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u (e ': es) f) ->
FreerEffects fr u (e ': es) f ~> FreerEffects fr u (e ': es) f
reinterpret :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(e :: Instruction) (es :: [Instruction]).
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u (e : es) f)
-> FreerEffects fr u (e : es) f ~> FreerEffects fr u (e : es) f
reinterpret e ~> FreerEffects fr u (e : es) f
i =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f) =>
(ins ~> fr ins f) -> fr ins f ~> fr ins f
reinterpretFT \u (e : es) x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
Union u =>
u (f : fs) a -> Either (f a) (u fs a)
decomp u (e : es) x
u of
Left e x
e -> forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects forall a b. (a -> b) -> a -> b
$ e ~> FreerEffects fr u (e : es) f
i e x
e
Right u es x
e -> forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT forall a b. (a -> b) -> a -> b
$ forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f :: Instruction).
Union u =>
u fs a -> u (f : fs) a
weaken u es x
e
transformAll ::
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es') ->
FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll u es ~> u' es'
f = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *) (ins' :: k -> *).
(TransFreer c fr, c f) =>
(ins ~> ins') -> fr ins f ~> fr ins' f
transformT u es ~> u' es'
f
{-# INLINE transformAll #-}
transform ::
forall e' e fr u r f c.
(TransFreer c fr, Union u, c f) =>
(e ~> e') ->
FreerEffects fr u (e ': r) f ~> FreerEffects fr u (e' ': r) f
transform :: forall (e' :: Instruction) (e :: Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (r :: [Instruction])
(f :: Instruction) (c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
(e ~> e')
-> FreerEffects fr u (e : r) f ~> FreerEffects fr u (e' : r) f
transform e ~> e'
f =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *) (ins' :: k -> *).
(TransFreer c fr, c f) =>
(ins ~> ins') -> fr ins f ~> fr ins' f
transformT \u (e : r) x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
Union u =>
u (f : fs) a -> Either (f a) (u fs a)
decomp u (e : r) x
u of
Left e x
e -> forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]).
Union u =>
f ~> u (f : fs)
inject0 forall a b. (a -> b) -> a -> b
$ e ~> e'
f e x
e
Right u r x
e -> forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f :: Instruction).
Union u =>
u fs a -> u (f : fs) a
weaken u r x
e
untag ::
forall tag e fr u r f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (Tag e tag ': r) f ~> FreerEffects fr u (e ': r) f
untag :: forall {k} (tag :: k) (e :: Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (r :: [Instruction])
(f :: Instruction) (c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (Tag e tag : r) f ~> FreerEffects fr u (e : r) f
untag = forall (e' :: Instruction) (e :: Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (r :: [Instruction])
(f :: Instruction) (c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
(e ~> e')
-> FreerEffects fr u (e : r) f ~> FreerEffects fr u (e' : r) f
transform forall {k} (ins :: Instruction) (tag :: k) a.
Tag ins tag a -> ins a
getTag
interpose ::
forall e fr u es f c.
(TransFreer c fr, Union u, Member u e es, c f) =>
(e ~> FreerEffects fr u es f) ->
FreerEffects fr u es f ~> FreerEffects fr u es f
interpose :: forall (e :: Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (c :: Instruction -> Constraint).
(TransFreer c fr, Union u, Member u e es, c f) =>
(e ~> FreerEffects fr u es f)
-> FreerEffects fr u es f ~> FreerEffects fr u es f
interpose e ~> FreerEffects fr u es f
f =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f) =>
(ins ~> fr ins f) -> fr ins f ~> fr ins f
reinterpretFT \u es x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
(Union u, HasMembership u f fs) =>
u fs a -> Maybe (f a)
project @_ @e u es x
u of
Just e x
e -> forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects forall a b. (a -> b) -> a -> b
$ e ~> FreerEffects fr u es f
f e x
e
Maybe (e x)
Nothing -> forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT u es x
u
interposeT ::
forall e t fr u es m.
( MonadTransFreer fr
, Union u
, Member u e es
, Monad m
, MonadTrans t
, forall m1 m2 x. Coercible m1 m2 => Coercible (t m1 x) (t m2 x)
, Monad (t (fr (u es) m))
) =>
(e ~> t (FreerEffects fr u es m)) ->
FreerEffects fr u es m ~> t (FreerEffects fr u es m)
interposeT :: forall (e :: Instruction) (t :: Instruction -> Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(m :: Instruction).
(MonadTransFreer fr, Union u, Member u e es, Monad m, MonadTrans t,
forall (m1 :: Instruction) (m2 :: Instruction) x.
Coercible m1 m2 =>
Coercible (t m1 x) (t m2 x),
Monad (t (fr (u es) m))) =>
(e ~> t (FreerEffects fr u es m))
-> FreerEffects fr u es m ~> t (FreerEffects fr u es m)
interposeT e ~> t (FreerEffects fr u es m)
f FreerEffects fr u es m x
a =
forall (m1 :: Instruction) a (m2 :: Instruction).
Coercible (t m1 a) (t m2 a) =>
t m1 a -> t m2 a
hoistT @(fr (u es) m) forall a b. (a -> b) -> a -> b
$
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects FreerEffects fr u es m x
a forall a b. a -> (a -> b) -> b
& forall (fr :: Instruction -> Instruction -> Instruction)
(m :: Instruction) (t :: Instruction -> Instruction)
(n :: Instruction) (ins :: Instruction).
(MonadTransFreer fr, Monad m, MonadTrans t, Coercible n (fr ins m),
Monad (t n), Monad n) =>
(ins ~> t n) -> fr ins m ~> t n
reinterpretMT \u es x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
(Union u, HasMembership u f fs) =>
u fs a -> Maybe (f a)
project @_ @e u es x
u of
Just e x
e -> forall (m1 :: Instruction) a (m2 :: Instruction).
Coercible (t m1 a) (t m2 a) =>
t m1 a -> t m2 a
hoistT forall a b. (a -> b) -> a -> b
$ e ~> t (FreerEffects fr u es m)
f e x
e
Maybe (e x)
Nothing -> forall (t :: Instruction -> Instruction) (m :: Instruction) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT u es x
u
where
hoistT :: Coercible (t m1 a) (t m2 a) => t m1 a -> t m2 a
hoistT :: forall (m1 :: Instruction) a (m2 :: Instruction).
Coercible (t m1 a) (t m2 a) =>
t m1 a -> t m2 a
hoistT = coerce :: forall a b. Coercible a b => a -> b
coerce
{-# INLINE hoistT #-}
interposeAll ::
forall e g fr u es f c.
( TransFreer c fr
, Union u
, Member u e es
, c f
, c g
) =>
(f ~> g) ->
(u es ~> g) ->
(e ~> g) ->
FreerEffects fr u es f ~> g
interposeAll :: forall (e :: Instruction) (g :: Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (c :: Instruction -> Constraint).
(TransFreer c fr, Union u, Member u e es, c f, c g) =>
(f ~> g) -> (u es ~> g) -> (e ~> g) -> FreerEffects fr u es f ~> g
interposeAll f ~> g
iLower u es ~> g
iOther e ~> g
iTarget FreerEffects fr u es f x
a =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects FreerEffects fr u es f x
a forall a b. a -> (a -> b) -> b
& forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT f ~> g
iLower \u es x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
(Union u, HasMembership u f fs) =>
u fs a -> Maybe (f a)
project @_ @e u es x
u of
Just e x
e -> e ~> g
iTarget e x
e
Maybe (e x)
Nothing -> u es ~> g
iOther u es x
u
interposeK ::
(MonadTransFreer fr, Union u, Member u e es, Monad m) =>
(a -> FreerEffects fr u es m r) ->
(forall x. (x -> FreerEffects fr u es m r) -> e x -> FreerEffects fr u es m r) ->
FreerEffects fr u es m a ->
FreerEffects fr u es m r
interposeK :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (e :: Instruction)
(es :: [Instruction]) (m :: Instruction) a r.
(MonadTransFreer fr, Union u, Member u e es, Monad m) =>
(a -> FreerEffects fr u es m r)
-> (forall x.
(x -> FreerEffects fr u es m r) -> e x -> FreerEffects fr u es m r)
-> FreerEffects fr u es m a
-> FreerEffects fr u es m r
interposeK a -> FreerEffects fr u es m r
k forall x.
(x -> FreerEffects fr u es m r) -> e x -> FreerEffects fr u es m r
i = (forall {k} (r :: k) (m :: k -> *) a.
ContT r m a -> (a -> m r) -> m r
`runContT` a -> FreerEffects fr u es m r
k) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (e :: Instruction) r
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(m :: Instruction).
(MonadTransFreer fr, Union u, Member u e es, Monad m) =>
(e ~> ContT r (FreerEffects fr u es m))
-> FreerEffects fr u es m ~> ContT r (FreerEffects fr u es m)
interposeContT \e x
e -> forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall x.
(x -> FreerEffects fr u es m r) -> e x -> FreerEffects fr u es m r
`i` e x
e)
{-# INLINE interposeK #-}
interposeContT ::
forall e r fr u es m.
(MonadTransFreer fr, Union u, Member u e es, Monad m) =>
(e ~> ContT r (FreerEffects fr u es m)) ->
FreerEffects fr u es m ~> ContT r (FreerEffects fr u es m)
interposeContT :: forall (e :: Instruction) r
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(m :: Instruction).
(MonadTransFreer fr, Union u, Member u e es, Monad m) =>
(e ~> ContT r (FreerEffects fr u es m))
-> FreerEffects fr u es m ~> ContT r (FreerEffects fr u es m)
interposeContT e ~> ContT r (FreerEffects fr u es m)
f FreerEffects fr u es m x
a =
forall (m1 :: Instruction) (m2 :: Instruction) a.
Coercible m1 m2 =>
ContT r m1 a -> ContT r m2 a
hoistContT forall a b. (a -> b) -> a -> b
$
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects FreerEffects fr u es m x
a forall a b. a -> (a -> b) -> b
& forall (fr :: Instruction -> Instruction -> Instruction)
(m :: Instruction) (ins :: Instruction) r.
(MonadTransFreer fr, Monad m) =>
(ins ~> ContT r (fr ins m)) -> fr ins m ~> ContT r (fr ins m)
reinterpretMK \u es x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
(Union u, HasMembership u f fs) =>
u fs a -> Maybe (f a)
project @_ @e u es x
u of
Just e x
e -> forall (m1 :: Instruction) (m2 :: Instruction) a.
Coercible m1 m2 =>
ContT r m1 a -> ContT r m2 a
hoistContT forall a b. (a -> b) -> a -> b
$ e ~> ContT r (FreerEffects fr u es m)
f e x
e
Maybe (e x)
Nothing -> forall (t :: Instruction -> Instruction) (m :: Instruction) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT u es x
u
where
hoistContT :: Coercible m1 m2 => ContT r m1 a -> ContT r m2 a
hoistContT :: forall (m1 :: Instruction) (m2 :: Instruction) a.
Coercible m1 m2 =>
ContT r m1 a -> ContT r m2 a
hoistContT = coerce :: forall a b. Coercible a b => a -> b
coerce
{-# INLINE hoistContT #-}
intercept ::
forall e fr u es f c.
(TransFreer c fr, Union u, Member u e es, c f) =>
(e ~> e) ->
FreerEffects fr u es f ~> FreerEffects fr u es f
intercept :: forall (e :: Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) (c :: Instruction -> Constraint).
(TransFreer c fr, Union u, Member u e es, c f) =>
(e ~> e) -> FreerEffects fr u es f ~> FreerEffects fr u es f
intercept e ~> e
f =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *) (ins' :: k -> *).
(TransFreer c fr, c f) =>
(ins ~> ins') -> fr ins f ~> fr ins' f
transformT \u es x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
(Union u, HasMembership u f fs) =>
u fs a -> Maybe (f a)
project @_ @e u es x
u of
Just e x
e -> forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]).
(Union u, HasMembership u f fs) =>
f ~> u fs
inject forall a b. (a -> b) -> a -> b
$ e ~> e
f e x
e
Maybe (e x)
Nothing -> u es x
u
raise ::
forall e es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e ': es) f
raise :: forall (e :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e : es) f
raise = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f :: Instruction).
Union u =>
u fs a -> u (f : fs) a
weaken
{-# INLINE raise #-}
raise2 ::
forall e1 e2 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e1 ': e2 ': es) f
raise2 :: forall (e1 :: Instruction) (e2 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e1 : e2 : es) f
raise2 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f1 :: Instruction) (f2 :: Instruction).
Union u =>
u fs a -> u (f1 : f2 : fs) a
weaken2
{-# INLINE raise2 #-}
raise3 ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e1 ': e2 ': e3 ': es) f
raise3 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e1 : e2 : e3 : es) f
raise3 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f1 :: Instruction) (f2 :: Instruction) (f3 :: Instruction).
Union u =>
u fs a -> u (f1 : f2 : f3 : fs) a
weaken3
{-# INLINE raise3 #-}
raise4 ::
forall e1 e2 e3 e4 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f ~> FreerEffects fr u (e1 ': e2 ': e3 ': e4 ': es) f
raise4 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(e4 :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u es f
~> FreerEffects fr u (e1 : e2 : e3 : e4 : es) f
raise4 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f1 :: Instruction) (f2 :: Instruction) (f3 :: Instruction)
(f4 :: Instruction).
Union u =>
u fs a -> u (f1 : f2 : f3 : f4 : fs) a
weaken4
{-# INLINE raise4 #-}
raiseUnder ::
forall e1 e2 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': es) f ~> FreerEffects fr u (e1 ': e2 ': es) f
raiseUnder :: forall (e1 :: Instruction) (e2 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : es) f ~> FreerEffects fr u (e1 : e2 : es) f
raiseUnder = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(fs :: [Instruction]) (f2 :: Instruction).
Union u =>
u (f1 : fs) ~> u (f1 : f2 : fs)
weakenUnder
{-# INLINE raiseUnder #-}
raiseUnder2 ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': es) f
raiseUnder2 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : es) f
~> FreerEffects fr u (e1 : e2 : e3 : es) f
raiseUnder2 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (fs :: [Instruction]) (f3 :: Instruction).
Union u =>
u (f1 : f2 : fs) ~> u (f1 : f2 : f3 : fs)
weakenUnder2
{-# INLINE raiseUnder2 #-}
raiseUnder3 ::
forall e1 e2 e3 e4 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': e4 ': es) f
raiseUnder3 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(e4 :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : e3 : es) f
~> FreerEffects fr u (e1 : e2 : e3 : e4 : es) f
raiseUnder3 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction])
(f4 :: Instruction).
Union u =>
u (f1 : f2 : f3 : fs) ~> u (f1 : f2 : f3 : f4 : fs)
weakenUnder3
{-# INLINE raiseUnder3 #-}
raise2Under ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': es) f
raise2Under :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : es) f
~> FreerEffects fr u (e1 : e2 : e3 : es) f
raise2Under = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(fs :: [Instruction]) (f2 :: Instruction) (f3 :: Instruction).
Union u =>
u (f1 : fs) ~> u (f1 : f2 : f3 : fs)
weaken2Under
{-# INLINE raise2Under #-}
raise2Under2 ::
forall e1 e2 e3 e4 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': e4 ': es) f
raise2Under2 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(e4 :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : es) f
~> FreerEffects fr u (e1 : e2 : e3 : e4 : es) f
raise2Under2 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (fs :: [Instruction]) (f3 :: Instruction)
(f4 :: Instruction).
Union u =>
u (f1 : f2 : fs) ~> u (f1 : f2 : f3 : f4 : fs)
weaken2Under2
{-# INLINE raise2Under2 #-}
raise3Under ::
forall e1 e2 e3 e4 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': e4 ': es) f
raise3Under :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(e4 :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : es) f
~> FreerEffects fr u (e1 : e2 : e3 : e4 : es) f
raise3Under = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(fs :: [Instruction]) (f2 :: Instruction) (f3 :: Instruction)
(f4 :: Instruction).
Union u =>
u (f1 : fs) ~> u (f1 : f2 : f3 : f4 : fs)
weaken3Under
{-# INLINE raise3Under #-}
flipFreer ::
forall e1 e2 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': es) f ~> FreerEffects fr u (e2 ': e1 ': es) f
flipFreer :: forall (e1 :: Instruction) (e2 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : es) f
~> FreerEffects fr u (e2 : e1 : es) f
flipFreer = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (fs :: [Instruction]).
Union u =>
u (f1 : f2 : fs) ~> u (f2 : f1 : fs)
flipUnion
{-# INLINE flipFreer #-}
flipFreer3 ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': es) f ~> FreerEffects fr u (e3 ': e2 ': e1 ': es) f
flipFreer3 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : e3 : es) f
~> FreerEffects fr u (e3 : e2 : e1 : es) f
flipFreer3 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction]).
Union u =>
u (f1 : f2 : f3 : fs) ~> u (f3 : f2 : f1 : fs)
flipUnion3
{-# INLINE flipFreer3 #-}
flipFreerUnder ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': es) f ~> FreerEffects fr u (e1 ': e3 ': e2 ': es) f
flipFreerUnder :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : e3 : es) f
~> FreerEffects fr u (e1 : e3 : e2 : es) f
flipFreerUnder = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction]).
Union u =>
u (f1 : f2 : f3 : fs) ~> u (f1 : f3 : f2 : fs)
flipUnionUnder
{-# INLINE flipFreerUnder #-}
rotate3 ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': es) f ~> FreerEffects fr u (e2 ': e3 ': e1 ': es) f
rotate3 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : e3 : es) f
~> FreerEffects fr u (e2 : e3 : e1 : es) f
rotate3 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction]).
Union u =>
u (f1 : f2 : f3 : fs) ~> u (f2 : f3 : f1 : fs)
rot3
{-# INLINE rotate3 #-}
rotate3' ::
forall e1 e2 e3 es fr u f c.
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': es) f ~> FreerEffects fr u (e3 ': e1 ': e2 ': es) f
rotate3' :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint).
(TransFreer c fr, Union u, c f) =>
FreerEffects fr u (e1 : e2 : e3 : es) f
~> FreerEffects fr u (e3 : e1 : e2 : es) f
rotate3' = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction]).
Union u =>
u (f1 : f2 : f3 : fs) ~> u (f3 : f1 : f2 : fs)
rot3'
{-# INLINE rotate3' #-}
bundle2 ::
forall e1 e2 es fr u f c u'.
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (e1 ': e2 ': es) f ~> FreerEffects fr u (u' '[e1, e2] ': es) f
bundle2 :: forall (e1 :: Instruction) (e2 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint)
(u' :: [Instruction] -> Instruction).
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (e1 : e2 : es) f
~> FreerEffects fr u (u' '[e1, e2] : es) f
bundle2 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (fs :: [Instruction]).
(Union u, Union u') =>
u (f1 : f2 : fs) ~> u (u' '[f1, f2] : fs)
bundleUnion2
{-# INLINE bundle2 #-}
bundle3 ::
forall e1 e2 e3 es fr u f c u'.
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': es) f ~> FreerEffects fr u (u' '[e1, e2, e3] ': es) f
bundle3 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint)
(u' :: [Instruction] -> Instruction).
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (e1 : e2 : e3 : es) f
~> FreerEffects fr u (u' '[e1, e2, e3] : es) f
bundle3 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction]).
(Union u, Union u') =>
u (f1 : f2 : f3 : fs) ~> u (u' '[f1, f2, f3] : fs)
bundleUnion3
{-# INLINE bundle3 #-}
bundle4 ::
forall e1 e2 e3 e4 es fr u f c u'.
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (e1 ': e2 ': e3 ': e4 ': es) f ~> FreerEffects fr u (u' '[e1, e2, e3, e4] ': es) f
bundle4 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(e4 :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint)
(u' :: [Instruction] -> Instruction).
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (e1 : e2 : e3 : e4 : es) f
~> FreerEffects fr u (u' '[e1, e2, e3, e4] : es) f
bundle4 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (f4 :: Instruction)
(fs :: [Instruction]).
(Union u, Union u') =>
u (f1 : f2 : f3 : f4 : fs) ~> u (u' '[f1, f2, f3, f4] : fs)
bundleUnion4
{-# INLINE bundle4 #-}
unbundle2 ::
forall e1 e2 es fr u f c u'.
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (u' '[e1, e2] ': es) f ~> FreerEffects fr u (e1 ': e2 ': es) f
unbundle2 :: forall (e1 :: Instruction) (e2 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint)
(u' :: [Instruction] -> Instruction).
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (u' '[e1, e2] : es) f
~> FreerEffects fr u (e1 : e2 : es) f
unbundle2 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (fs :: [Instruction]).
(Union u, Union u') =>
u (u' '[f1, f2] : fs) ~> u (f1 : f2 : fs)
unbundleUnion2
{-# INLINE unbundle2 #-}
unbundle3 ::
forall e1 e2 e3 es fr u f c u'.
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (u' '[e1, e2, e3] ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': es) f
unbundle3 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint)
(u' :: [Instruction] -> Instruction).
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (u' '[e1, e2, e3] : es) f
~> FreerEffects fr u (e1 : e2 : e3 : es) f
unbundle3 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (fs :: [Instruction]).
(Union u, Union u') =>
u (u' '[f1, f2, f3] : fs) ~> u (f1 : f2 : f3 : fs)
unbundleUnion3
{-# INLINE unbundle3 #-}
unbundle4 ::
forall e1 e2 e3 e4 es fr u f c u'.
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (u' '[e1, e2, e3, e4] ': es) f ~> FreerEffects fr u (e1 ': e2 ': e3 ': e4 ': es) f
unbundle4 :: forall (e1 :: Instruction) (e2 :: Instruction) (e3 :: Instruction)
(e4 :: Instruction) (es :: [Instruction])
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(c :: Instruction -> Constraint)
(u' :: [Instruction] -> Instruction).
(TransFreer c fr, Union u, Union u', c f) =>
FreerEffects fr u (u' '[e1, e2, e3, e4] : es) f
~> FreerEffects fr u (e1 : e2 : e3 : e4 : es) f
unbundle4 = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f :: Instruction)
(es :: [Instruction]) (es' :: [Instruction]).
(TransFreer c fr, Union u, Union u', c f) =>
(u es ~> u' es')
-> FreerEffects fr u es f ~> FreerEffects fr u' es' f
transformAll forall (u :: [Instruction] -> Instruction)
(u' :: [Instruction] -> Instruction) (f1 :: Instruction)
(f2 :: Instruction) (f3 :: Instruction) (f4 :: Instruction)
(fs :: [Instruction]).
(Union u, Union u') =>
u (u' '[f1, f2, f3, f4] : fs) ~> u (f1 : f2 : f3 : f4 : fs)
unbundleUnion4
{-# INLINE unbundle4 #-}
hoistFreerEffects ::
(TransFreer c fr, c f, c g) => (f ~> g) -> FreerEffects fr u es f ~> FreerEffects fr u es g
hoistFreerEffects :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (g :: Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction]).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> FreerEffects fr u es f ~> FreerEffects fr u es g
hoistFreerEffects f ~> g
f = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> fr ins f ~> fr ins g
hoistFreer f ~> g
f
{-# INLINE hoistFreerEffects #-}
lowerToIns ::
(TransFreer c fr, c g, c (f + g), Union u) =>
FreerEffects fr u es (f + g) ~> FreerEffects fr u (f ': es) g
lowerToIns :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(g :: Instruction) (f :: Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction]).
(TransFreer c fr, c g, c (f + g), Union u) =>
FreerEffects fr u es (f + g) ~> FreerEffects fr u (f : es) g
lowerToIns =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$
forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT
(forall {k} (f :: k -> *) (a :: k) r (g :: k -> *).
(f a -> r) -> (g a -> r) -> (+) f g a -> r
caseF (forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]).
Union u =>
f ~> u (f : fs)
inject0) forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT)
(forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (u :: [Instruction] -> Instruction) (fs :: [Instruction]) a
(f :: Instruction).
Union u =>
u fs a -> u (f : fs) a
weaken)
{-# INLINE lowerToIns #-}
insToLower ::
(TransFreer c fr, c (f + g), c g, Union u) =>
FreerEffects fr u (f ': es) g ~> FreerEffects fr u es (f + g)
insToLower :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (g :: Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction]).
(TransFreer c fr, c (f + g), c g, Union u) =>
FreerEffects fr u (f : es) g ~> FreerEffects fr u es (f + g)
insToLower = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT (forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT 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 {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 forall (u :: [Instruction] -> Instruction) (f :: Instruction) a r
(fs :: [Instruction]).
Union u =>
(f a -> r) -> (u fs a -> r) -> u (f : fs) a -> r
|+|: forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT)
{-# INLINE insToLower #-}
interpretLower ::
(TransFreer c fr, c f, c g) =>
(f ~> FreerEffects fr u es g) ->
FreerEffects fr u es f ~> FreerEffects fr u es g
interpretLower :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (g :: Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction]).
(TransFreer c fr, c f, c g) =>
(f ~> FreerEffects fr u es g)
-> FreerEffects fr u es f ~> FreerEffects fr u es g
interpretLower f ~> FreerEffects fr u es g
f = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> fr ins g) -> fr ins f ~> fr ins g
interposeLowerT (forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects forall b c a. (b -> c) -> (a -> b) -> a -> c
. f ~> FreerEffects fr u es g
f)
{-# INLINE interpretLower #-}
overFreerEffects ::
(fr (u es) f a -> fr' (u' es') g b) ->
FreerEffects fr u es f a ->
FreerEffects fr' u' es' g b
overFreerEffects :: forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction) a
(fr' :: Instruction -> Instruction -> Instruction)
(u' :: [Instruction] -> Instruction) (es' :: [Instruction])
(g :: Instruction) b.
(fr (u es) f a -> fr' (u' es') g b)
-> FreerEffects fr u es f a -> FreerEffects fr' u' es' g b
overFreerEffects fr (u es) f a -> fr' (u' es') g b
f = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
fr (u es) f ~> FreerEffects fr u es f
freerEffects forall b c a. (b -> c) -> (a -> b) -> a -> c
. fr (u es) f a -> fr' (u' es') g b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects
{-# INLINE overFreerEffects #-}
interpreted :: (TransFreer c fr, c f, Union u) => FreerEffects fr u '[] f ~> f
interpreted :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction).
(TransFreer c fr, c f, Union u) =>
FreerEffects fr u '[] f ~> f
interpreted = forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *) (a :: k).
(TransFreer c fr, c f) =>
(ins ~> f) -> fr ins f a -> f a
runInterpretF forall (u :: [Instruction] -> Instruction) a x.
Union u =>
u '[] a -> x
absurdUnion forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects
{-# INLINE interpreted #-}
splitFreerEffects ::
(TransFreer c fr', TransFreer c fr, c f, c (FreerEffects fr u es f), Union u) =>
FreerEffects fr u (e ': es) f ~> fr' e (FreerEffects fr u es f)
splitFreerEffects :: forall (c :: Instruction -> Constraint)
(fr' :: Instruction -> Instruction -> Instruction)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]) (e :: Instruction).
(TransFreer c fr', TransFreer c fr, c f,
c (FreerEffects fr u es f), Union u) =>
FreerEffects fr u (e : es) f ~> fr' e (FreerEffects fr u es f)
splitFreerEffects FreerEffects fr u (e : es) f x
a =
forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects FreerEffects fr u (e : es) f x
a forall a b. a -> (a -> b) -> b
& forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *) (g :: k -> *)
(ins :: k -> *).
(TransFreer c fr, c f, c g) =>
(f ~> g) -> (ins ~> g) -> fr ins f ~> g
interpretFT (forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
fr (u es) f ~> FreerEffects fr u es f
freerEffects forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT) \u (e : es) x
u ->
case forall (u :: [Instruction] -> Instruction) (f :: Instruction)
(fs :: [Instruction]) a.
Union u =>
u (f : fs) a -> Either (f a) (u fs a)
decomp u (e : es) x
u of
Left e x
e -> forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT e x
e
Right u es x
e -> forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT forall a b. (a -> b) -> a -> b
$ forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
fr (u es) f ~> FreerEffects fr u es f
freerEffects forall a b. (a -> b) -> a -> b
$ forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
TransFreer c fr =>
ins ~> fr ins f
liftInsT u es x
e
subsume ::
(TransFreer c fr, SendIns e (FreerEffects fr u es f), Union u, c f) =>
FreerEffects fr u (e ': es) f ~> FreerEffects fr u es f
subsume :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(e :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]) (f :: Instruction).
(TransFreer c fr, SendIns e (FreerEffects fr u es f), Union u,
c f) =>
FreerEffects fr u (e : es) f ~> FreerEffects fr u es f
subsume = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(e :: Instruction) (es :: [Instruction]).
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u es f)
-> FreerEffects fr u (e : es) f ~> FreerEffects fr u es f
interpret forall (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns
{-# INLINE subsume #-}
subsumeLower ::
(TransFreer c fr, SendIns e f, Union u, c f) =>
FreerEffects fr u (e ': es) f ~> FreerEffects fr u es f
subsumeLower :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(e :: Instruction) (f :: Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction]).
(TransFreer c fr, SendIns e f, Union u, c f) =>
FreerEffects fr u (e : es) f ~> FreerEffects fr u es f
subsumeLower = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(e :: Instruction) (es :: [Instruction]).
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u es f)
-> FreerEffects fr u (e : es) f ~> FreerEffects fr u es f
interpret forall a b. (a -> b) -> a -> b
$ forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]).
(TransFreer c fr, c f) =>
f ~> FreerEffects fr u es f
liftLower forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns
{-# INLINE subsumeLower #-}
liftLower :: (TransFreer c fr, c f) => f ~> FreerEffects fr u es f
liftLower :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]).
(TransFreer c fr, c f) =>
f ~> FreerEffects fr u es f
liftLower = forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
fr (u es) f ~> FreerEffects fr u es f
freerEffects forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (ins :: k -> *)
(f :: k -> *).
(TransFreer c fr, c f) =>
f ~> fr ins f
liftLowerFT
{-# INLINE liftLower #-}
runIO :: MonadIO m => Fre (IO ': es) m ~> Fre es m
runIO :: forall (m :: Instruction) (es :: [Instruction]).
MonadIO m =>
Fre (IO : es) m ~> Fre es m
runIO = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (f :: Instruction)
(e :: Instruction) (es :: [Instruction]).
(TransFreer c fr, Union u, c f) =>
(e ~> FreerEffects fr u es f)
-> FreerEffects fr u (e : es) f ~> FreerEffects fr u es f
interpret forall a b. (a -> b) -> a -> b
$ forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]).
(TransFreer c fr, c f) =>
f ~> FreerEffects fr u es f
liftLower forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: Instruction) a. MonadIO m => IO a -> m a
liftIO
{-# INLINE runIO #-}
runInterpret :: (TransFreer c fr, c f) => (u es ~> f) -> FreerEffects fr u es f ~> f
runInterpret :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]).
(TransFreer c fr, c f) =>
(u es ~> f) -> FreerEffects fr u es f ~> f
runInterpret u es ~> f
f = forall {k} (c :: (k -> *) -> Constraint)
(fr :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
(ins :: k -> *) (a :: k).
(TransFreer c fr, c f) =>
(ins ~> f) -> fr ins f a -> f a
runInterpretF u es ~> f
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (fr :: Instruction -> Instruction -> Instruction)
(u :: [Instruction] -> Instruction) (es :: [Instruction])
(f :: Instruction).
FreerEffects fr u es f ~> fr (u es) f
unFreerEffects
{-# INLINE runInterpret #-}
runFreerEffects ::
(TransFreer c fr, c f, Union u) =>
FreerEffects fr u '[f] f ~> f
runFreerEffects :: forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction).
(TransFreer c fr, c f, Union u) =>
FreerEffects fr u '[f] f ~> f
runFreerEffects = forall (c :: Instruction -> Constraint)
(fr :: Instruction -> Instruction -> Instruction)
(f :: Instruction) (u :: [Instruction] -> Instruction)
(es :: [Instruction]).
(TransFreer c fr, c f) =>
(u es ~> f) -> FreerEffects fr u es f ~> f
runInterpret forall a b. (a -> b) -> a -> b
$ forall a. a -> a
id forall (u :: [Instruction] -> Instruction) (f :: Instruction) a r
(fs :: [Instruction]).
Union u =>
(f a -> r) -> (u fs a -> r) -> u (f : fs) a -> r
|+|: forall (u :: [Instruction] -> Instruction) a x.
Union u =>
u '[] a -> x
absurdUnion
{-# INLINE runFreerEffects #-}
type Fre es f = FreerEffects FreerChurchT ExtensibleUnion es f
type e <| es = Member ExtensibleUnion e es