cleff-0.3.2.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) 

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.

fromAny :: Any -> a Source #

Coerce Any to a boxed value. This is generally unsafe and it is your responsibility to ensure that the type you're coercing into is the original type that the Any is coerced from.

toAny :: a -> Any Source #

Coerce any boxed value into Any.