-
Notifications
You must be signed in to change notification settings - Fork 2
/
effect-handlers.cabal
112 lines (99 loc) · 3.9 KB
/
effect-handlers.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: effect-handlers
version: 0.1.0.8
synopsis: A library for writing extensible algebraic effects and handlers. Similar to extensible-effects but with deep handlers.
homepage: https://github.com/edofic/effect-handlers
bug-reports: https://github.com/edofic/effect-handlers/issues
license: MIT
license-file: LICENSE
author: Andraz Bajt, Blaz Repas
maintainer: Andraz Bajt <[email protected]>
category: Control
build-type: Simple
stability: experimental
extra-source-files: README.md
cabal-version: >=1.10
description:
This is an extensible effects library for Haskell taking inspiration from the Eff language <http://www.eff-lang.org/>.
.
See these papers for the ideas and theory behind the library:
.
- O. Kammar et al: Handlers in Action! <http://homepages.inf.ed.ac.uk/slindley/papers/handlers.pdf>
- A. Bauer, M. Pretnar: Programming with Algebraic Effects and Handlers <http://arxiv.org/abs/1203.1539>
- O Kiselyov, A Sabry, C Swords: Extensible Effects <http://dl.acm.org/citation.cfm?id=2503791>
.
Implementation wise it's most close to @extensible-effects@ <http://hackage.haskell.org/package/extensible-effects> (also see the Extensible Effects paper) but it implements deep handlers instead of shallow.
.
@
import Control.Effects.Cont.Eff
import Control.Effects.Cont.Reader
import Control.Effects.Cont.Exception
.
program = do
  v <- ask
  if v < 15
  then throw $ show v
  else return (v+1)
.
run n = runPure . handle exceptionHandler . handle (readerHandler n)
.
res :: Integer -> Either String Integer
res n = run n program
@
library
exposed-modules: Data.Union
, Control.Effects.Eff
, Control.Effects.Reader
, Control.Effects.Writer
, Control.Effects.State
, Control.Effects.Exception
, Control.Effects.IO
, Control.Effects.Search
-- other-extensions:
build-depends: base >=4.7 && <5
, free >=4.9 && <5
, mtl >=2.1 && <3
, kan-extensions >=4.1 && <6
hs-source-dirs: src
default-language: Haskell2010
default-extensions: RankNTypes
, KindSignatures
, DataKinds
, GADTs
, TypeOperators
, MultiParamTypeClasses
, FlexibleInstances
, FlexibleContexts
, NoMonomorphismRestriction
, DeriveFunctor
, DeriveDataTypeable
, GeneralizedNewtypeDeriving
test-suite spec
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: test
main-is: Main.hs
build-depends: base >=4.7 && <5
, effect-handlers
, hspec >= 2.1 && <3
, QuickCheck
, HUnit
, hspec-discover
other-modules: Main
, Spec
default-extensions: DataKinds
, FlexibleContexts
, NoMonomorphismRestriction
benchmark benchm
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: bench, test
main-is: TestBench.hs
other-modules: Examples.Combined
Examples.Reader
build-depends: base >=4.7 && <5
, effect-handlers
, criterion >= 1.0 && <2
ghc-options: -O3
default-extensions: DataKinds
, FlexibleContexts
, NoMonomorphismRestriction