Skip to content

Commit dd131c0

Browse files
committed
Updating module documentation
1 parent c8b4780 commit dd131c0

File tree

1 file changed

+80
-2
lines changed

1 file changed

+80
-2
lines changed

README.md

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1-
# purescript-free
1+
# Module Documentation
22

3-
Free monads based on the Haskell [implementation](https://github.com/ekmett/free).
3+
## Module Control.Monad.Free
4+
5+
### Types
6+
7+
data Free f a where
8+
Return :: a -> Free f a
9+
Suspend :: f (Free f a) -> Free f a
10+
Gosub :: forall s. (forall r. ({} -> Free f r) -> (r -> Free f a) -> s) -> s -> Free f a
11+
12+
13+
### Type Classes
14+
15+
class MonadFree f m where
16+
wrap :: forall a. f (m a) -> m a
17+
18+
19+
### Type Class Instances
20+
21+
instance applicativeFree :: (Functor f) => Applicative (Free f)
22+
23+
instance applyFree :: (Functor f) => Apply (Free f)
24+
25+
instance bindFree :: (Functor f) => Bind (Free f)
26+
27+
instance functorFree :: (Functor f) => Functor (Free f)
28+
29+
instance monadFree :: (Functor f) => Monad (Free f)
30+
31+
instance monadTransFree :: MonadTrans Free
32+
33+
instance monadFreeFree :: (Functor f) => MonadFree f (Free f)
34+
35+
36+
### Values
37+
38+
bindFree :: forall f a b. (a -> Free f b) -> Free f a -> Free f b
39+
40+
go :: forall f a. (Functor f) => (f (Free f a) -> Free f a) -> Free f a -> a
41+
42+
liftF :: forall f a. (Functor f) => f a -> Free f a
43+
44+
pureF :: forall f a. (Applicative f) => a -> Free f a
45+
46+
-- Note: can blow the stack!
47+
iterM :: forall f m a. (Functor f, Monad m) => (f (m a) -> m a) -> Free f a -> m a
48+
49+
resume :: forall f a. (Functor f) => Free f a -> Either (f (Free f a)) a
50+
51+
resumeGosub :: forall f a. (Functor f) => (forall s. (forall r. ({ } -> Free f r) -> (r -> Free f a) -> s) -> s) -> Either (f (Free f a)) (Free f a)
52+
53+
54+
## Module Control.Monad.Trampoline
55+
56+
### Types
57+
58+
data Delay a where
59+
Delay :: { } -> a -> Delay a
60+
61+
type Trampoline a = Free Delay a
62+
63+
64+
### Type Class Instances
65+
66+
instance delayApplicative :: Applicative Delay
67+
68+
instance delayApply :: Apply Delay
69+
70+
instance delayFunctor :: Functor Delay
71+
72+
73+
### Values
74+
75+
delay :: forall a. ({ } -> a) -> Trampoline a
76+
77+
done :: forall a. a -> Trampoline a
78+
79+
runTrampoline :: forall a. Trampoline a -> a
80+
81+
suspend :: forall a. Trampoline a -> Trampoline a

0 commit comments

Comments
 (0)