cleff-0.3.3.0: Fast and concise extensible effects
Copyright(c) 2021 Xy Ren
LicenseBSD3
Maintainerxy.r@outlook.com
Stabilityunstable
Portabilitynon-portable (GHC only)
Safe HaskellNone
LanguageHaskell2010

Cleff.Internal

Description

This module contains common definitions for the cleff internals.

This is an internal module and its API may change even between minor versions. Therefore you should be extra careful if you're to depend on this module.

Synopsis

Basic types

type Effect = (Type -> Type) -> Type -> Type Source #

The type of effects. An effect e m a takes an effect monad type m :: Type -> Type and a result type a :: Type.

type (~>) f g = forall a. f a -> g a Source #

A natural transformation from f to g. With this, instead of writing

runSomeEffect :: Eff (SomeEffect : es) a -> Eff es a

you can write:

runSomeEffect :: Eff (SomeEffect : es) ~> Eff es

type family xs ++ ys where ... infixr 5 Source #

Type level list concatenation.

Equations

'[] ++ ys = ys 
(x ': xs) ++ ys = x ': (xs ++ ys) 

newtype HandlerPtr (e :: Effect) Source #

A pointer to an effect handler.

Constructors

HandlerPtr 

Fields

The Any type

type family Any :: k where ... #

The type constructor Any is type to which you can unsafely coerce any lifted type, and back. More concretely, for a lifted type t and value x :: t, -- unsafeCoerce (unsafeCoerce x :: Any) :: t is equivalent to x.

pattern Any :: forall a. a -> Any Source #

A pattern synonym for coercing values to and from Any. This is not any less unsafe but prevents possivle misuses.

fromAny :: (Any :: Type) -> a Source #

Miscellaneous

noinline :: a -> a Source #

Magic function that tells the compiler not to inline the argument.