eveff-0.1.0.0: Efficient effect handlers based on evidence translation.

Copyright(c) 2020 Microsoft Research; Daan Leijen; Ningning Xie
LicenseMIT
Maintainerxnning@hku.hk; daan@microsoft.com
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Examples

Description

Examples from "Effect Handlers in Haskell, Evidently", Ningning Xie and Daan Leijen, Haskell 2020.

Documentation

data Reader a e ans Source #

Constructors

Reader 

Fields

hr :: a -> Reader a e ans Source #

reader :: a -> Eff (Reader a :* e) ans -> Eff e ans Source #

data Exn e ans Source #

Constructors

Exn 

Fields

toMaybe :: Eff (Exn :* e) a -> Eff e (Maybe a) Source #

exceptDefault :: a -> Eff (Exn :* e) a -> Eff e a Source #

safeDiv :: Exn :? e => Int -> Int -> Eff e Int Source #

data State a e ans Source #

Constructors

State 

Fields

state :: a -> Eff (State a :* e) ans -> Eff e ans Source #

add :: State Int :? e => Int -> Eff e () Source #

data Output e ans Source #

Constructors

Output 

Fields

output :: Eff (Output :* e) ans -> Eff e (ans, String) Source #

data Amb e ans Source #

Constructors

Amb 

Fields

xor :: Amb :? e => Eff e Bool Source #

allResults :: Eff (Amb :* e) a -> Eff e [a] Source #

firstResult :: Eff (Amb :* e) (Maybe a) -> Eff e (Maybe a) Source #

solutions :: Eff (Exn :* (Amb :* e)) a -> Eff e [a] Source #

eager :: Eff (Exn :* (Amb :* e)) a -> Eff e (Maybe a) Source #

choice :: Amb :? e => Eff e a -> Eff e a -> Eff e a Source #

many :: Amb :? e => Eff e a -> Eff e [a] Source #

many1 :: Amb :? e => Eff e a -> Eff e [a] Source #

data Parse e ans Source #

Constructors

Parse 

Fields

parse :: Exn :? e => String -> Eff (Parse :* e) b -> Eff e (b, String) Source #

expr :: (Parse :? e, Amb :? e) => Eff e Int Source #

term :: (Parse :? e, Amb :? e) => Eff e Int Source #

factor :: (Parse :? e, Amb :? e) => Eff e Int Source #

number :: (Parse :? e, Amb :? e) => Eff e Int Source #

data Evil e ans Source #

Constructors

Evil 

Fields

hevil :: Eff (Evil :* e) a -> Eff e (() -> Eff e a) Source #

ebody :: (Reader Int :? e, Evil :? e) => Eff e Int Source #