{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}

-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.

{- |
Copyright   :  (c) 2023 Yamada Ryo
               (c) 2023 Casper Bach Poulsen and Cas van der Rest
License     :  MPL-2.0 (see the file LICENSE)
Maintainer  :  ymdfield@outlook.jp
Stability   :  experimental
Portability :  portable

This module provides the essential definitions required for CEPs compliance, forming the foundation
of classy-effects.
Please refer to [CEPs](https://github.com/sayo-hs/classy-effects/blob/master/CEPs/README.md) for details.
-}
module Control.Effect.Class where

import Control.Applicative (Alternative)
import Control.Effect.Class.Machinery.HFunctor (HFunctor, hfmap)
import Control.Monad (MonadPlus)
import Control.Monad.Fix (MonadFix)
import Control.Monad.IO.Class (MonadIO)
import Data.Coerce (coerce)
import Data.Comp.Multi.Derive (makeHFunctor)
import Data.Kind (Type)

-- | A kind of /signature class/ (a datatype of higher-order effect).
type Signature = (Type -> Type) -> (Type -> Type)

-- | A kind of /instruction class/ (a datatype of first-order effect).
type Instruction = Type -> Type

-- | A natural transformation.
type f ~> g = forall x. f x -> g x

{- | Lift an /instruction class/ to a /signature class/.

     Come from [heft-lang\/POPL2023\/haskell\/src\/Elab.hs]
    (https://github.com/heft-lang/POPL2023/blob/74afe1d5ce0b491cffe40cc5c73a2a5ee6a94d9c/haskell/src/Elab.hs#L9-L10).
-}

-- The code before modification is MIT licensed; (c) 2023 Casper Bach Poulsen and Cas van der Rest.
newtype LiftIns (ins :: Instruction) (f :: Type -> Type) a = LiftIns {forall (ins :: Instruction) (f :: Instruction) a.
LiftIns ins f a -> ins a
unliftIns :: ins a}
    deriving stock (forall a b. a -> LiftIns ins f b -> LiftIns ins f a
forall a b. (a -> b) -> LiftIns ins f a -> LiftIns ins 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 (ins :: Instruction) (f :: Instruction) a b.
Functor ins =>
a -> LiftIns ins f b -> LiftIns ins f a
forall (ins :: Instruction) (f :: Instruction) a b.
Functor ins =>
(a -> b) -> LiftIns ins f a -> LiftIns ins f b
<$ :: forall a b. a -> LiftIns ins f b -> LiftIns ins f a
$c<$ :: forall (ins :: Instruction) (f :: Instruction) a b.
Functor ins =>
a -> LiftIns ins f b -> LiftIns ins f a
fmap :: forall a b. (a -> b) -> LiftIns ins f a -> LiftIns ins f b
$cfmap :: forall (ins :: Instruction) (f :: Instruction) a b.
Functor ins =>
(a -> b) -> LiftIns ins f a -> LiftIns ins f b
Functor, forall a. LiftIns ins f a -> Bool
forall m a. Monoid m => (a -> m) -> LiftIns ins f a -> m
forall a b. (a -> b -> b) -> b -> LiftIns ins 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 (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Eq a) =>
a -> LiftIns ins f a -> Bool
forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Num a) =>
LiftIns ins f a -> a
forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Ord a) =>
LiftIns ins f a -> a
forall (ins :: Instruction) (f :: Instruction) m.
(Foldable ins, Monoid m) =>
LiftIns ins f m -> m
forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
LiftIns ins f a -> Bool
forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
LiftIns ins f a -> Int
forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
LiftIns ins f a -> [a]
forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
(a -> a -> a) -> LiftIns ins f a -> a
forall (ins :: Instruction) (f :: Instruction) m a.
(Foldable ins, Monoid m) =>
(a -> m) -> LiftIns ins f a -> m
forall (ins :: Instruction) (f :: Instruction) b a.
Foldable ins =>
(b -> a -> b) -> b -> LiftIns ins f a -> b
forall (ins :: Instruction) (f :: Instruction) a b.
Foldable ins =>
(a -> b -> b) -> b -> LiftIns ins f a -> b
product :: forall a. Num a => LiftIns ins f a -> a
$cproduct :: forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Num a) =>
LiftIns ins f a -> a
sum :: forall a. Num a => LiftIns ins f a -> a
$csum :: forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Num a) =>
LiftIns ins f a -> a
minimum :: forall a. Ord a => LiftIns ins f a -> a
$cminimum :: forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Ord a) =>
LiftIns ins f a -> a
maximum :: forall a. Ord a => LiftIns ins f a -> a
$cmaximum :: forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Ord a) =>
LiftIns ins f a -> a
elem :: forall a. Eq a => a -> LiftIns ins f a -> Bool
$celem :: forall (ins :: Instruction) (f :: Instruction) a.
(Foldable ins, Eq a) =>
a -> LiftIns ins f a -> Bool
length :: forall a. LiftIns ins f a -> Int
$clength :: forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
LiftIns ins f a -> Int
null :: forall a. LiftIns ins f a -> Bool
$cnull :: forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
LiftIns ins f a -> Bool
toList :: forall a. LiftIns ins f a -> [a]
$ctoList :: forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
LiftIns ins f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> LiftIns ins f a -> a
$cfoldl1 :: forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
(a -> a -> a) -> LiftIns ins f a -> a
foldr1 :: forall a. (a -> a -> a) -> LiftIns ins f a -> a
$cfoldr1 :: forall (ins :: Instruction) (f :: Instruction) a.
Foldable ins =>
(a -> a -> a) -> LiftIns ins f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> LiftIns ins f a -> b
$cfoldl' :: forall (ins :: Instruction) (f :: Instruction) b a.
Foldable ins =>
(b -> a -> b) -> b -> LiftIns ins f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> LiftIns ins f a -> b
$cfoldl :: forall (ins :: Instruction) (f :: Instruction) b a.
Foldable ins =>
(b -> a -> b) -> b -> LiftIns ins f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> LiftIns ins f a -> b
$cfoldr' :: forall (ins :: Instruction) (f :: Instruction) a b.
Foldable ins =>
(a -> b -> b) -> b -> LiftIns ins f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> LiftIns ins f a -> b
$cfoldr :: forall (ins :: Instruction) (f :: Instruction) a b.
Foldable ins =>
(a -> b -> b) -> b -> LiftIns ins f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> LiftIns ins f a -> m
$cfoldMap' :: forall (ins :: Instruction) (f :: Instruction) m a.
(Foldable ins, Monoid m) =>
(a -> m) -> LiftIns ins f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> LiftIns ins f a -> m
$cfoldMap :: forall (ins :: Instruction) (f :: Instruction) m a.
(Foldable ins, Monoid m) =>
(a -> m) -> LiftIns ins f a -> m
fold :: forall m. Monoid m => LiftIns ins f m -> m
$cfold :: forall (ins :: Instruction) (f :: Instruction) m.
(Foldable ins, Monoid m) =>
LiftIns ins 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) -> LiftIns ins f a -> f (LiftIns ins f b)
forall {ins :: Instruction} {f :: Instruction}.
Traversable ins =>
Functor (LiftIns ins f)
forall {ins :: Instruction} {f :: Instruction}.
Traversable ins =>
Foldable (LiftIns ins f)
forall (ins :: Instruction) (f :: Instruction) (m :: Instruction)
       a.
(Traversable ins, Monad m) =>
LiftIns ins f (m a) -> m (LiftIns ins f a)
forall (ins :: Instruction) (f :: Instruction) (f :: Instruction)
       a.
(Traversable ins, Applicative f) =>
LiftIns ins f (f a) -> f (LiftIns ins f a)
forall (ins :: Instruction) (f :: Instruction) (m :: Instruction) a
       b.
(Traversable ins, Monad m) =>
(a -> m b) -> LiftIns ins f a -> m (LiftIns ins f b)
forall (ins :: Instruction) (f :: Instruction) (f :: Instruction) a
       b.
(Traversable ins, Applicative f) =>
(a -> f b) -> LiftIns ins f a -> f (LiftIns ins f b)
sequence :: forall (m :: Instruction) a.
Monad m =>
LiftIns ins f (m a) -> m (LiftIns ins f a)
$csequence :: forall (ins :: Instruction) (f :: Instruction) (m :: Instruction)
       a.
(Traversable ins, Monad m) =>
LiftIns ins f (m a) -> m (LiftIns ins f a)
mapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> LiftIns ins f a -> m (LiftIns ins f b)
$cmapM :: forall (ins :: Instruction) (f :: Instruction) (m :: Instruction) a
       b.
(Traversable ins, Monad m) =>
(a -> m b) -> LiftIns ins f a -> m (LiftIns ins f b)
sequenceA :: forall (f :: Instruction) a.
Applicative f =>
LiftIns ins f (f a) -> f (LiftIns ins f a)
$csequenceA :: forall (ins :: Instruction) (f :: Instruction) (f :: Instruction)
       a.
(Traversable ins, Applicative f) =>
LiftIns ins f (f a) -> f (LiftIns ins f a)
traverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> LiftIns ins f a -> f (LiftIns ins f b)
$ctraverse :: forall (ins :: Instruction) (f :: Instruction) (f :: Instruction) a
       b.
(Traversable ins, Applicative f) =>
(a -> f b) -> LiftIns ins f a -> f (LiftIns ins f b)
Traversable)

makeHFunctor ''LiftIns

-- | A type class that represents the ability to send an /instruction/ @ins@ to carrier @f@.
class SendIns (ins :: Instruction) f where
    -- | Send an /instruction/ @ins@ to carrier @f@.
    sendIns :: ins a -> f a

-- | The operator version of `SendIns`.
type (<:) = SendIns

-- | A type class that represents the ability to send a /signature/ @sig@ to carrier @f@.
class SendSig (sig :: Signature) f where
    -- | Send a /signature/ @sig@ to carrier @f@.
    sendSig :: sig f a -> f a

-- | The operator version of `SendSig`.
type (<<:) = SendIns

instance SendIns ins f => SendSig (LiftIns ins) f where
    sendSig :: forall a. LiftIns ins f a -> f a
sendSig = forall (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (ins :: Instruction) (f :: Instruction) a.
LiftIns ins f a -> ins a
unliftIns
    {-# INLINE sendSig #-}

-- | A wrapper data type to integrate a backend handler system into the classy-effects framework.
newtype EffectsVia handlerSystem (f :: Type -> Type) a = EffectsVia {forall {k} (handlerSystem :: k) (f :: Instruction) a.
EffectsVia handlerSystem f a -> f a
runEffectsVia :: f a}
    deriving newtype
        ( forall k (handlerSystem :: k) (f :: Instruction) a b.
Functor f =>
a -> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
forall k (handlerSystem :: k) (f :: Instruction) a b.
Functor f =>
(a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
forall a b.
a -> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
forall a b.
(a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem 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 -> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
$c<$ :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Functor f =>
a -> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
fmap :: forall a b.
(a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
$cfmap :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Functor f =>
(a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
Functor
        , forall a. a -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
Applicative f =>
Functor (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
Applicative f =>
a -> EffectsVia handlerSystem f a
forall k (handlerSystem :: k) (f :: Instruction) a b.
Applicative f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
forall k (handlerSystem :: k) (f :: Instruction) a b.
Applicative f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
forall k (handlerSystem :: k) (f :: Instruction) a b.
Applicative f =>
EffectsVia handlerSystem f (a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
forall k (handlerSystem :: k) (f :: Instruction) a b c.
Applicative f =>
(a -> b -> c)
-> EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b
-> EffectsVia handlerSystem f c
forall a b.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
forall a b.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
forall a b.
EffectsVia handlerSystem f (a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
forall a b c.
(a -> b -> c)
-> EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b
-> EffectsVia handlerSystem 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.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
$c<* :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Applicative f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f a
*> :: forall a b.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
$c*> :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Applicative f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
liftA2 :: forall a b c.
(a -> b -> c)
-> EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b
-> EffectsVia handlerSystem f c
$cliftA2 :: forall k (handlerSystem :: k) (f :: Instruction) a b c.
Applicative f =>
(a -> b -> c)
-> EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b
-> EffectsVia handlerSystem f c
<*> :: forall a b.
EffectsVia handlerSystem f (a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
$c<*> :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Applicative f =>
EffectsVia handlerSystem f (a -> b)
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f b
pure :: forall a. a -> EffectsVia handlerSystem f a
$cpure :: forall k (handlerSystem :: k) (f :: Instruction) a.
Applicative f =>
a -> EffectsVia handlerSystem f a
Applicative
        , forall a. EffectsVia handlerSystem f a
forall a.
EffectsVia handlerSystem f a -> EffectsVia handlerSystem f [a]
forall a.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
Alternative f =>
Applicative (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a
forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a -> EffectsVia handlerSystem f [a]
forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem 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.
EffectsVia handlerSystem f a -> EffectsVia handlerSystem f [a]
$cmany :: forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a -> EffectsVia handlerSystem f [a]
some :: forall a.
EffectsVia handlerSystem f a -> EffectsVia handlerSystem f [a]
$csome :: forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a -> EffectsVia handlerSystem f [a]
<|> :: forall a.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f a
$c<|> :: forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f a
empty :: forall a. EffectsVia handlerSystem f a
$cempty :: forall k (handlerSystem :: k) (f :: Instruction) a.
Alternative f =>
EffectsVia handlerSystem f a
Alternative
        , forall a. a -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
Monad f =>
Applicative (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
Monad f =>
a -> EffectsVia handlerSystem f a
forall k (handlerSystem :: k) (f :: Instruction) a b.
Monad f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
forall k (handlerSystem :: k) (f :: Instruction) a b.
Monad f =>
EffectsVia handlerSystem f a
-> (a -> EffectsVia handlerSystem f b)
-> EffectsVia handlerSystem f b
forall a b.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
forall a b.
EffectsVia handlerSystem f a
-> (a -> EffectsVia handlerSystem f b)
-> EffectsVia handlerSystem 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 -> EffectsVia handlerSystem f a
$creturn :: forall k (handlerSystem :: k) (f :: Instruction) a.
Monad f =>
a -> EffectsVia handlerSystem f a
>> :: forall a b.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
$c>> :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Monad f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f b -> EffectsVia handlerSystem f b
>>= :: forall a b.
EffectsVia handlerSystem f a
-> (a -> EffectsVia handlerSystem f b)
-> EffectsVia handlerSystem f b
$c>>= :: forall k (handlerSystem :: k) (f :: Instruction) a b.
Monad f =>
EffectsVia handlerSystem f a
-> (a -> EffectsVia handlerSystem f b)
-> EffectsVia handlerSystem f b
Monad
        , forall a. EffectsVia handlerSystem f a
forall a.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
MonadPlus f =>
Monad (EffectsVia handlerSystem f)
forall {k} {handlerSystem :: k} {f :: Instruction}.
MonadPlus f =>
Alternative (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
MonadPlus f =>
EffectsVia handlerSystem f a
forall k (handlerSystem :: k) (f :: Instruction) a.
MonadPlus f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem 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.
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f a
$cmplus :: forall k (handlerSystem :: k) (f :: Instruction) a.
MonadPlus f =>
EffectsVia handlerSystem f a
-> EffectsVia handlerSystem f a -> EffectsVia handlerSystem f a
mzero :: forall a. EffectsVia handlerSystem f a
$cmzero :: forall k (handlerSystem :: k) (f :: Instruction) a.
MonadPlus f =>
EffectsVia handlerSystem f a
MonadPlus
        , forall a.
(a -> EffectsVia handlerSystem f a) -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
MonadFix f =>
Monad (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
MonadFix f =>
(a -> EffectsVia handlerSystem f a) -> EffectsVia handlerSystem f a
forall (m :: Instruction).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
mfix :: forall a.
(a -> EffectsVia handlerSystem f a) -> EffectsVia handlerSystem f a
$cmfix :: forall k (handlerSystem :: k) (f :: Instruction) a.
MonadFix f =>
(a -> EffectsVia handlerSystem f a) -> EffectsVia handlerSystem f a
MonadFix
        , forall a. IO a -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
MonadIO f =>
Monad (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
MonadIO f =>
IO a -> EffectsVia handlerSystem f a
forall (m :: Instruction).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: forall a. IO a -> EffectsVia handlerSystem f a
$cliftIO :: forall k (handlerSystem :: k) (f :: Instruction) a.
MonadIO f =>
IO a -> EffectsVia handlerSystem f a
MonadIO
        , forall a. String -> EffectsVia handlerSystem f a
forall {k} {handlerSystem :: k} {f :: Instruction}.
MonadFail f =>
Monad (EffectsVia handlerSystem f)
forall k (handlerSystem :: k) (f :: Instruction) a.
MonadFail f =>
String -> EffectsVia handlerSystem f a
forall (m :: Instruction).
Monad m -> (forall a. String -> m a) -> MonadFail m
fail :: forall a. String -> EffectsVia handlerSystem f a
$cfail :: forall k (handlerSystem :: k) (f :: Instruction) a.
MonadFail f =>
String -> EffectsVia handlerSystem f a
MonadFail
        )

-- | A wrapper data type to represent sending an effect to the carrier @f@ with the specified tag.
newtype ViaTag handlerSystem tag (f :: Type -> Type) a = ViaTag {forall {k} {k} (handlerSystem :: k) (tag :: k) (f :: Instruction)
       a.
ViaTag handlerSystem tag f a -> f a
runViaTag :: f a}
    deriving newtype
        ( forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Functor f =>
a -> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Functor f =>
(a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
forall a b.
a -> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
forall a b.
(a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag 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 -> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
$c<$ :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Functor f =>
a -> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
fmap :: forall a b.
(a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
$cfmap :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Functor f =>
(a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
Functor
        , forall a. a -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
Applicative f =>
Functor (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Applicative f =>
a -> ViaTag handlerSystem tag f a
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Applicative f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Applicative f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Applicative f =>
ViaTag handlerSystem tag f (a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b
       c.
Applicative f =>
(a -> b -> c)
-> ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b
-> ViaTag handlerSystem tag f c
forall a b.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
forall a b.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
forall a b.
ViaTag handlerSystem tag f (a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
forall a b c.
(a -> b -> c)
-> ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b
-> ViaTag handlerSystem tag 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.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
$c<* :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Applicative f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f a
*> :: forall a b.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
$c*> :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Applicative f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
liftA2 :: forall a b c.
(a -> b -> c)
-> ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b
-> ViaTag handlerSystem tag f c
$cliftA2 :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b
       c.
Applicative f =>
(a -> b -> c)
-> ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b
-> ViaTag handlerSystem tag f c
<*> :: forall a b.
ViaTag handlerSystem tag f (a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
$c<*> :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Applicative f =>
ViaTag handlerSystem tag f (a -> b)
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f b
pure :: forall a. a -> ViaTag handlerSystem tag f a
$cpure :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Applicative f =>
a -> ViaTag handlerSystem tag f a
Applicative
        , forall a. ViaTag handlerSystem tag f a
forall a.
ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f [a]
forall a.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
Alternative f =>
Applicative (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f [a]
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag 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.
ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f [a]
$cmany :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f [a]
some :: forall a.
ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f [a]
$csome :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f [a]
<|> :: forall a.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f a
$c<|> :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f a
empty :: forall a. ViaTag handlerSystem tag f a
$cempty :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Alternative f =>
ViaTag handlerSystem tag f a
Alternative
        , forall a. a -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
Monad f =>
Applicative (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Monad f =>
a -> ViaTag handlerSystem tag f a
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Monad f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Monad f =>
ViaTag handlerSystem tag f a
-> (a -> ViaTag handlerSystem tag f b)
-> ViaTag handlerSystem tag f b
forall a b.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
forall a b.
ViaTag handlerSystem tag f a
-> (a -> ViaTag handlerSystem tag f b)
-> ViaTag handlerSystem tag 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 -> ViaTag handlerSystem tag f a
$creturn :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
Monad f =>
a -> ViaTag handlerSystem tag f a
>> :: forall a b.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
$c>> :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Monad f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f b -> ViaTag handlerSystem tag f b
>>= :: forall a b.
ViaTag handlerSystem tag f a
-> (a -> ViaTag handlerSystem tag f b)
-> ViaTag handlerSystem tag f b
$c>>= :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a b.
Monad f =>
ViaTag handlerSystem tag f a
-> (a -> ViaTag handlerSystem tag f b)
-> ViaTag handlerSystem tag f b
Monad
        , forall a. ViaTag handlerSystem tag f a
forall a.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
MonadPlus f =>
Monad (ViaTag handlerSystem tag f)
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
MonadPlus f =>
Alternative (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadPlus f =>
ViaTag handlerSystem tag f a
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadPlus f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag 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.
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f a
$cmplus :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadPlus f =>
ViaTag handlerSystem tag f a
-> ViaTag handlerSystem tag f a -> ViaTag handlerSystem tag f a
mzero :: forall a. ViaTag handlerSystem tag f a
$cmzero :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadPlus f =>
ViaTag handlerSystem tag f a
MonadPlus
        , forall a.
(a -> ViaTag handlerSystem tag f a) -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
MonadFix f =>
Monad (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadFix f =>
(a -> ViaTag handlerSystem tag f a) -> ViaTag handlerSystem tag f a
forall (m :: Instruction).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
mfix :: forall a.
(a -> ViaTag handlerSystem tag f a) -> ViaTag handlerSystem tag f a
$cmfix :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadFix f =>
(a -> ViaTag handlerSystem tag f a) -> ViaTag handlerSystem tag f a
MonadFix
        , forall a. IO a -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
MonadIO f =>
Monad (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadIO f =>
IO a -> ViaTag handlerSystem tag f a
forall (m :: Instruction).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: forall a. IO a -> ViaTag handlerSystem tag f a
$cliftIO :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadIO f =>
IO a -> ViaTag handlerSystem tag f a
MonadIO
        , forall a. String -> ViaTag handlerSystem tag f a
forall {k} {handlerSystem :: k} {k} {tag :: k} {f :: Instruction}.
MonadFail f =>
Monad (ViaTag handlerSystem tag f)
forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadFail f =>
String -> ViaTag handlerSystem tag f a
forall (m :: Instruction).
Monad m -> (forall a. String -> m a) -> MonadFail m
fail :: forall a. String -> ViaTag handlerSystem tag f a
$cfail :: forall k (handlerSystem :: k) k (tag :: k) (f :: Instruction) a.
MonadFail f =>
String -> ViaTag handlerSystem tag f a
MonadFail
        )

{- |
A backend identifier type tag to represent the mechanism of sending effects to a carrier using
`SendIns`/`SendSig` based on CEP-02.
-}
data EffectDataHandler

instance SendIns ins f => SendIns ins (EffectsVia EffectDataHandler f) where
    sendIns :: forall a. ins a -> EffectsVia EffectDataHandler f a
sendIns = 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 (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns

instance (SendSig sig f, HFunctor sig) => SendSig sig (EffectsVia EffectDataHandler f) where
    sendSig :: forall a.
sig (EffectsVia EffectDataHandler f) a
-> EffectsVia EffectDataHandler f a
sendSig = 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 (sig :: Instruction -> Instruction) (f :: Instruction) a.
SendSig sig f =>
sig f a -> f a
sendSig forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (h :: Instruction -> Instruction) (f :: Instruction)
       (g :: Instruction).
HFunctor h =>
(f :-> g) -> h f :-> h g
hfmap forall {k} (handlerSystem :: k) (f :: Instruction) a.
EffectsVia handlerSystem f a -> f a
runEffectsVia

-- | A type class representing the carrier @f@ capable of sending tagged effects.
class Taggable f where
    -- | A wrapper type to send to carrier @f@ with the specified tag.
    type Tagged f tag :: Type -> Type

    -- | Send all effects within the scope, tagged, to carrier @f@.
    unTagged :: Tagged f tag a -> f a

instance Taggable (EffectsVia handlerSystem f) where
    type Tagged (EffectsVia handlerSystem f) tag = EffectsVia handlerSystem (ViaTag handlerSystem tag f)
    unTagged :: forall tag a.
Tagged (EffectsVia handlerSystem f) tag a
-> EffectsVia handlerSystem f a
unTagged = coerce :: forall a b. Coercible a b => a -> b
coerce
    {-# INLINE unTagged #-}

-- | Send all effects within the scope, tagged, to carrier @f@.
tag :: forall tag f a. Taggable f => Tagged f tag a -> f a
tag :: forall tag (f :: Instruction) a.
Taggable f =>
Tagged f tag a -> f a
tag = forall (f :: Instruction) tag a.
Taggable f =>
Tagged f tag a -> f a
unTagged @_ @tag
{-# INLINE tag #-}

-- | A wrapper type to send to carrier @f@ with the specified tag.
type f @# tag = Tagged f tag

-- | Tagged /instruction class/.
newtype Tag (ins :: Instruction) tag a = Tag {forall {k} (ins :: Instruction) (tag :: k) a.
Tag ins tag a -> ins a
getTag :: ins a}
    deriving stock (forall a b. a -> Tag ins tag b -> Tag ins tag a
forall a b. (a -> b) -> Tag ins tag a -> Tag ins tag b
forall (f :: Instruction).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (ins :: Instruction) k (tag :: k) a b.
Functor ins =>
a -> Tag ins tag b -> Tag ins tag a
forall (ins :: Instruction) k (tag :: k) a b.
Functor ins =>
(a -> b) -> Tag ins tag a -> Tag ins tag b
<$ :: forall a b. a -> Tag ins tag b -> Tag ins tag a
$c<$ :: forall (ins :: Instruction) k (tag :: k) a b.
Functor ins =>
a -> Tag ins tag b -> Tag ins tag a
fmap :: forall a b. (a -> b) -> Tag ins tag a -> Tag ins tag b
$cfmap :: forall (ins :: Instruction) k (tag :: k) a b.
Functor ins =>
(a -> b) -> Tag ins tag a -> Tag ins tag b
Functor, forall a. Tag ins tag a -> Bool
forall m a. Monoid m => (a -> m) -> Tag ins tag a -> m
forall a b. (a -> b -> b) -> b -> Tag ins tag 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 (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Eq a) =>
a -> Tag ins tag a -> Bool
forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Num a) =>
Tag ins tag a -> a
forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Ord a) =>
Tag ins tag a -> a
forall (ins :: Instruction) k (tag :: k) m.
(Foldable ins, Monoid m) =>
Tag ins tag m -> m
forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
Tag ins tag a -> Bool
forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
Tag ins tag a -> Int
forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
Tag ins tag a -> [a]
forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
(a -> a -> a) -> Tag ins tag a -> a
forall (ins :: Instruction) k (tag :: k) m a.
(Foldable ins, Monoid m) =>
(a -> m) -> Tag ins tag a -> m
forall (ins :: Instruction) k (tag :: k) b a.
Foldable ins =>
(b -> a -> b) -> b -> Tag ins tag a -> b
forall (ins :: Instruction) k (tag :: k) a b.
Foldable ins =>
(a -> b -> b) -> b -> Tag ins tag a -> b
product :: forall a. Num a => Tag ins tag a -> a
$cproduct :: forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Num a) =>
Tag ins tag a -> a
sum :: forall a. Num a => Tag ins tag a -> a
$csum :: forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Num a) =>
Tag ins tag a -> a
minimum :: forall a. Ord a => Tag ins tag a -> a
$cminimum :: forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Ord a) =>
Tag ins tag a -> a
maximum :: forall a. Ord a => Tag ins tag a -> a
$cmaximum :: forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Ord a) =>
Tag ins tag a -> a
elem :: forall a. Eq a => a -> Tag ins tag a -> Bool
$celem :: forall (ins :: Instruction) k (tag :: k) a.
(Foldable ins, Eq a) =>
a -> Tag ins tag a -> Bool
length :: forall a. Tag ins tag a -> Int
$clength :: forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
Tag ins tag a -> Int
null :: forall a. Tag ins tag a -> Bool
$cnull :: forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
Tag ins tag a -> Bool
toList :: forall a. Tag ins tag a -> [a]
$ctoList :: forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
Tag ins tag a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Tag ins tag a -> a
$cfoldl1 :: forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
(a -> a -> a) -> Tag ins tag a -> a
foldr1 :: forall a. (a -> a -> a) -> Tag ins tag a -> a
$cfoldr1 :: forall (ins :: Instruction) k (tag :: k) a.
Foldable ins =>
(a -> a -> a) -> Tag ins tag a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Tag ins tag a -> b
$cfoldl' :: forall (ins :: Instruction) k (tag :: k) b a.
Foldable ins =>
(b -> a -> b) -> b -> Tag ins tag a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Tag ins tag a -> b
$cfoldl :: forall (ins :: Instruction) k (tag :: k) b a.
Foldable ins =>
(b -> a -> b) -> b -> Tag ins tag a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Tag ins tag a -> b
$cfoldr' :: forall (ins :: Instruction) k (tag :: k) a b.
Foldable ins =>
(a -> b -> b) -> b -> Tag ins tag a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Tag ins tag a -> b
$cfoldr :: forall (ins :: Instruction) k (tag :: k) a b.
Foldable ins =>
(a -> b -> b) -> b -> Tag ins tag a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Tag ins tag a -> m
$cfoldMap' :: forall (ins :: Instruction) k (tag :: k) m a.
(Foldable ins, Monoid m) =>
(a -> m) -> Tag ins tag a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Tag ins tag a -> m
$cfoldMap :: forall (ins :: Instruction) k (tag :: k) m a.
(Foldable ins, Monoid m) =>
(a -> m) -> Tag ins tag a -> m
fold :: forall m. Monoid m => Tag ins tag m -> m
$cfold :: forall (ins :: Instruction) k (tag :: k) m.
(Foldable ins, Monoid m) =>
Tag ins tag 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 {ins :: Instruction} {k} {tag :: k}.
Traversable ins =>
Functor (Tag ins tag)
forall {ins :: Instruction} {k} {tag :: k}.
Traversable ins =>
Foldable (Tag ins tag)
forall (ins :: Instruction) k (tag :: k) (m :: Instruction) a.
(Traversable ins, Monad m) =>
Tag ins tag (m a) -> m (Tag ins tag a)
forall (ins :: Instruction) k (tag :: k) (f :: Instruction) a.
(Traversable ins, Applicative f) =>
Tag ins tag (f a) -> f (Tag ins tag a)
forall (ins :: Instruction) k (tag :: k) (m :: Instruction) a b.
(Traversable ins, Monad m) =>
(a -> m b) -> Tag ins tag a -> m (Tag ins tag b)
forall (ins :: Instruction) k (tag :: k) (f :: Instruction) a b.
(Traversable ins, Applicative f) =>
(a -> f b) -> Tag ins tag a -> f (Tag ins tag b)
forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> Tag ins tag a -> f (Tag ins tag b)
sequence :: forall (m :: Instruction) a.
Monad m =>
Tag ins tag (m a) -> m (Tag ins tag a)
$csequence :: forall (ins :: Instruction) k (tag :: k) (m :: Instruction) a.
(Traversable ins, Monad m) =>
Tag ins tag (m a) -> m (Tag ins tag a)
mapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> Tag ins tag a -> m (Tag ins tag b)
$cmapM :: forall (ins :: Instruction) k (tag :: k) (m :: Instruction) a b.
(Traversable ins, Monad m) =>
(a -> m b) -> Tag ins tag a -> m (Tag ins tag b)
sequenceA :: forall (f :: Instruction) a.
Applicative f =>
Tag ins tag (f a) -> f (Tag ins tag a)
$csequenceA :: forall (ins :: Instruction) k (tag :: k) (f :: Instruction) a.
(Traversable ins, Applicative f) =>
Tag ins tag (f a) -> f (Tag ins tag a)
traverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> Tag ins tag a -> f (Tag ins tag b)
$ctraverse :: forall (ins :: Instruction) k (tag :: k) (f :: Instruction) a b.
(Traversable ins, Applicative f) =>
(a -> f b) -> Tag ins tag a -> f (Tag ins tag b)
Traversable)

-- | Tagged /instruction class/.
type (#) = Tag

-- | Tagged /instruction class/.
pattern T :: forall tag ins a. ins a -> Tag ins tag a
pattern $bT :: forall {k} (tag :: k) (ins :: Instruction) a.
ins a -> Tag ins tag a
$mT :: forall {r} {k} {tag :: k} {ins :: Instruction} {a}.
Tag ins tag a -> (ins a -> r) -> ((# #) -> r) -> r
T e = Tag e
{-# INLINE T #-}

-- | Tagged /signature class/.
newtype TagH (sig :: Signature) tag f a = TagH {forall {k} (sig :: Instruction -> Instruction) (tag :: k)
       (f :: Instruction) a.
TagH sig tag f a -> sig f a
getTagH :: sig f a}
    deriving stock (forall a b. a -> TagH sig tag f b -> TagH sig tag f a
forall a b. (a -> b) -> TagH sig tag f a -> TagH sig tag 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 (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Functor (sig f) =>
a -> TagH sig tag f b -> TagH sig tag f a
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Functor (sig f) =>
(a -> b) -> TagH sig tag f a -> TagH sig tag f b
<$ :: forall a b. a -> TagH sig tag f b -> TagH sig tag f a
$c<$ :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Functor (sig f) =>
a -> TagH sig tag f b -> TagH sig tag f a
fmap :: forall a b. (a -> b) -> TagH sig tag f a -> TagH sig tag f b
$cfmap :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Functor (sig f) =>
(a -> b) -> TagH sig tag f a -> TagH sig tag f b
Functor, forall a. TagH sig tag f a -> Bool
forall m a. Monoid m => (a -> m) -> TagH sig tag f a -> m
forall a b. (a -> b -> b) -> b -> TagH sig tag 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 (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Eq a) =>
a -> TagH sig tag f a -> Bool
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Num a) =>
TagH sig tag f a -> a
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Ord a) =>
TagH sig tag f a -> a
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) m.
(Foldable (sig f), Monoid m) =>
TagH sig tag f m -> m
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
TagH sig tag f a -> Bool
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
TagH sig tag f a -> Int
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
TagH sig tag f a -> [a]
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
(a -> a -> a) -> TagH sig tag f a -> a
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) m a.
(Foldable (sig f), Monoid m) =>
(a -> m) -> TagH sig tag f a -> m
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) b a.
Foldable (sig f) =>
(b -> a -> b) -> b -> TagH sig tag f a -> b
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Foldable (sig f) =>
(a -> b -> b) -> b -> TagH sig tag f a -> b
product :: forall a. Num a => TagH sig tag f a -> a
$cproduct :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Num a) =>
TagH sig tag f a -> a
sum :: forall a. Num a => TagH sig tag f a -> a
$csum :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Num a) =>
TagH sig tag f a -> a
minimum :: forall a. Ord a => TagH sig tag f a -> a
$cminimum :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Ord a) =>
TagH sig tag f a -> a
maximum :: forall a. Ord a => TagH sig tag f a -> a
$cmaximum :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Ord a) =>
TagH sig tag f a -> a
elem :: forall a. Eq a => a -> TagH sig tag f a -> Bool
$celem :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
(Foldable (sig f), Eq a) =>
a -> TagH sig tag f a -> Bool
length :: forall a. TagH sig tag f a -> Int
$clength :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
TagH sig tag f a -> Int
null :: forall a. TagH sig tag f a -> Bool
$cnull :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
TagH sig tag f a -> Bool
toList :: forall a. TagH sig tag f a -> [a]
$ctoList :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
TagH sig tag f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> TagH sig tag f a -> a
$cfoldl1 :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
(a -> a -> a) -> TagH sig tag f a -> a
foldr1 :: forall a. (a -> a -> a) -> TagH sig tag f a -> a
$cfoldr1 :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a.
Foldable (sig f) =>
(a -> a -> a) -> TagH sig tag f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> TagH sig tag f a -> b
$cfoldl' :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) b a.
Foldable (sig f) =>
(b -> a -> b) -> b -> TagH sig tag f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> TagH sig tag f a -> b
$cfoldl :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) b a.
Foldable (sig f) =>
(b -> a -> b) -> b -> TagH sig tag f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> TagH sig tag f a -> b
$cfoldr' :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Foldable (sig f) =>
(a -> b -> b) -> b -> TagH sig tag f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> TagH sig tag f a -> b
$cfoldr :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) a b.
Foldable (sig f) =>
(a -> b -> b) -> b -> TagH sig tag f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> TagH sig tag f a -> m
$cfoldMap' :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) m a.
(Foldable (sig f), Monoid m) =>
(a -> m) -> TagH sig tag f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> TagH sig tag f a -> m
$cfoldMap :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) m a.
(Foldable (sig f), Monoid m) =>
(a -> m) -> TagH sig tag f a -> m
fold :: forall m. Monoid m => TagH sig tag f m -> m
$cfold :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) m.
(Foldable (sig f), Monoid m) =>
TagH sig tag 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) -> TagH sig tag f a -> f (TagH sig tag f b)
forall {sig :: Instruction -> Instruction} {k} {tag :: k}
       {f :: Instruction}.
Traversable (sig f) =>
Functor (TagH sig tag f)
forall {sig :: Instruction -> Instruction} {k} {tag :: k}
       {f :: Instruction}.
Traversable (sig f) =>
Foldable (TagH sig tag f)
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (m :: Instruction) a.
(Traversable (sig f), Monad m) =>
TagH sig tag f (m a) -> m (TagH sig tag f a)
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (f :: Instruction) a.
(Traversable (sig f), Applicative f) =>
TagH sig tag f (f a) -> f (TagH sig tag f a)
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (m :: Instruction) a b.
(Traversable (sig f), Monad m) =>
(a -> m b) -> TagH sig tag f a -> m (TagH sig tag f b)
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (f :: Instruction) a b.
(Traversable (sig f), Applicative f) =>
(a -> f b) -> TagH sig tag f a -> f (TagH sig tag f b)
sequence :: forall (m :: Instruction) a.
Monad m =>
TagH sig tag f (m a) -> m (TagH sig tag f a)
$csequence :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (m :: Instruction) a.
(Traversable (sig f), Monad m) =>
TagH sig tag f (m a) -> m (TagH sig tag f a)
mapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> TagH sig tag f a -> m (TagH sig tag f b)
$cmapM :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (m :: Instruction) a b.
(Traversable (sig f), Monad m) =>
(a -> m b) -> TagH sig tag f a -> m (TagH sig tag f b)
sequenceA :: forall (f :: Instruction) a.
Applicative f =>
TagH sig tag f (f a) -> f (TagH sig tag f a)
$csequenceA :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (f :: Instruction) a.
(Traversable (sig f), Applicative f) =>
TagH sig tag f (f a) -> f (TagH sig tag f a)
traverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> TagH sig tag f a -> f (TagH sig tag f b)
$ctraverse :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (f :: Instruction) a b.
(Traversable (sig f), Applicative f) =>
(a -> f b) -> TagH sig tag f a -> f (TagH sig tag f b)
Traversable)
    deriving newtype (forall (f :: Instruction) (g :: Instruction).
(f :-> g) -> TagH sig tag f :-> TagH sig tag g
forall (h :: Instruction -> Instruction).
(forall (f :: Instruction) (g :: Instruction).
 (f :-> g) -> h f :-> h g)
-> HFunctor h
forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (g :: Instruction).
HFunctor sig =>
(f :-> g) -> TagH sig tag f :-> TagH sig tag g
hfmap :: forall (f :: Instruction) (g :: Instruction).
(f :-> g) -> TagH sig tag f :-> TagH sig tag g
$chfmap :: forall (sig :: Instruction -> Instruction) k (tag :: k)
       (f :: Instruction) (g :: Instruction).
HFunctor sig =>
(f :-> g) -> TagH sig tag f :-> TagH sig tag g
HFunctor)

-- | Tagged /signature class/.
type (##) = TagH

-- | Tagged /signature class/.
pattern TH :: forall tag sig f a. sig f a -> TagH sig tag f a
pattern $bTH :: forall {k} (tag :: k) (sig :: Instruction -> Instruction)
       (f :: Instruction) a.
sig f a -> TagH sig tag f a
$mTH :: forall {r} {k} {tag :: k} {sig :: Instruction -> Instruction}
       {f :: Instruction} {a}.
TagH sig tag f a -> (sig f a -> r) -> ((# #) -> r) -> r
TH e = TagH e

instance
    SendIns (ins # tag) (EffectsVia EffectDataHandler f) =>
    SendIns ins (ViaTag EffectDataHandler tag f)
    where
    sendIns :: forall a. ins a -> ViaTag EffectDataHandler tag f a
sendIns = forall {k} {k} (handlerSystem :: k) (tag :: k) (f :: Instruction)
       a.
f a -> ViaTag handlerSystem tag f a
ViaTag forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (handlerSystem :: k) (f :: Instruction) a.
EffectsVia handlerSystem f a -> f a
runEffectsVia @EffectDataHandler forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (ins :: Instruction) (f :: Instruction) a.
SendIns ins f =>
ins a -> f a
sendIns forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (tag :: k) (ins :: Instruction) a.
ins a -> Tag ins tag a
T @tag
    {-# INLINE sendIns #-}

instance
    (SendSig (sig ## tag) (EffectsVia EffectDataHandler f), HFunctor sig) =>
    SendSig sig (ViaTag EffectDataHandler tag f)
    where
    sendSig :: forall a.
sig (ViaTag EffectDataHandler tag f) a
-> ViaTag EffectDataHandler tag f a
sendSig =
        forall {k} {k} (handlerSystem :: k) (tag :: k) (f :: Instruction)
       a.
f a -> ViaTag handlerSystem tag f a
ViaTag
            forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (handlerSystem :: k) (f :: Instruction) a.
EffectsVia handlerSystem f a -> f a
runEffectsVia @EffectDataHandler
            forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (sig :: Instruction -> Instruction) (f :: Instruction) a.
SendSig sig f =>
sig f a -> f a
sendSig
            forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (tag :: k) (sig :: Instruction -> Instruction)
       (f :: Instruction) a.
sig f a -> TagH sig tag f a
TH @tag
            forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (h :: Instruction -> Instruction) (f :: Instruction)
       (g :: Instruction).
HFunctor h =>
(f :-> g) -> h f :-> h g
hfmap coerce :: forall a b. Coercible a b => a -> b
coerce
    {-# INLINE sendSig #-}

-- | An /effect class/ with no effects.
class Nop (f :: Type -> Type)

instance Nop f

-- | An /instruction class/ with no effects.
data NopI (a :: Type)
    deriving stock (forall a b. a -> NopI b -> NopI a
forall a b. (a -> b) -> NopI a -> NopI 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 -> NopI b -> NopI a
$c<$ :: forall a b. a -> NopI b -> NopI a
fmap :: forall a b. (a -> b) -> NopI a -> NopI b
$cfmap :: forall a b. (a -> b) -> NopI a -> NopI b
Functor, forall a. Eq a => a -> NopI a -> Bool
forall a. Num a => NopI a -> a
forall a. Ord a => NopI a -> a
forall m. Monoid m => NopI m -> m
forall a. NopI a -> Bool
forall a. NopI a -> Int
forall a. NopI a -> [a]
forall a. (a -> a -> a) -> NopI a -> a
forall m a. Monoid m => (a -> m) -> NopI a -> m
forall b a. (b -> a -> b) -> b -> NopI a -> b
forall a b. (a -> b -> b) -> b -> NopI 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 => NopI a -> a
$cproduct :: forall a. Num a => NopI a -> a
sum :: forall a. Num a => NopI a -> a
$csum :: forall a. Num a => NopI a -> a
minimum :: forall a. Ord a => NopI a -> a
$cminimum :: forall a. Ord a => NopI a -> a
maximum :: forall a. Ord a => NopI a -> a
$cmaximum :: forall a. Ord a => NopI a -> a
elem :: forall a. Eq a => a -> NopI a -> Bool
$celem :: forall a. Eq a => a -> NopI a -> Bool
length :: forall a. NopI a -> Int
$clength :: forall a. NopI a -> Int
null :: forall a. NopI a -> Bool
$cnull :: forall a. NopI a -> Bool
toList :: forall a. NopI a -> [a]
$ctoList :: forall a. NopI a -> [a]
foldl1 :: forall a. (a -> a -> a) -> NopI a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> NopI a -> a
foldr1 :: forall a. (a -> a -> a) -> NopI a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> NopI a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> NopI a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> NopI a -> b
foldl :: forall b a. (b -> a -> b) -> b -> NopI a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> NopI a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> NopI a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> NopI a -> b
foldr :: forall a b. (a -> b -> b) -> b -> NopI a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> NopI a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> NopI a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> NopI a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> NopI a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> NopI a -> m
fold :: forall m. Monoid m => NopI m -> m
$cfold :: forall m. Monoid m => NopI m -> m
Foldable, Functor NopI
Foldable NopI
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 (m :: Instruction) a. Monad m => NopI (m a) -> m (NopI a)
forall (f :: Instruction) a.
Applicative f =>
NopI (f a) -> f (NopI a)
forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> NopI a -> m (NopI b)
forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> NopI a -> f (NopI b)
sequence :: forall (m :: Instruction) a. Monad m => NopI (m a) -> m (NopI a)
$csequence :: forall (m :: Instruction) a. Monad m => NopI (m a) -> m (NopI a)
mapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> NopI a -> m (NopI b)
$cmapM :: forall (m :: Instruction) a b.
Monad m =>
(a -> m b) -> NopI a -> m (NopI b)
sequenceA :: forall (f :: Instruction) a.
Applicative f =>
NopI (f a) -> f (NopI a)
$csequenceA :: forall (f :: Instruction) a.
Applicative f =>
NopI (f a) -> f (NopI a)
traverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> NopI a -> f (NopI b)
$ctraverse :: forall (f :: Instruction) a b.
Applicative f =>
(a -> f b) -> NopI a -> f (NopI b)
Traversable)

-- | A /signature class/ with no effects.
type NopS = LiftIns NopI