Skip to content

Commit c6007b0

Browse files
committed
Merge no-t1 branch
2 parents 86f3c5c + c3df82d commit c6007b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+407
-736
lines changed

docs/Control/Monad/Cont/Class.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@ This module defines the `MonadCont` type class and its instances.
55
#### `MonadCont`
66

77
``` purescript
8-
class MonadCont m where
8+
class (Monad m) <= MonadCont m where
99
callCC :: forall a b. ((a -> m b) -> m a) -> m a
1010
```
1111

1212
The `MonadCont` type class represents those monads which support the
13-
`callCC` operation.
13+
`callCC`, or _call-with-current-continuation_ operation.
1414

15-
An implementation is provided for `ContT`, and for other monad transformers
16-
defined in this library.
15+
This action makes the current continuation available to the caller.
1716

18-
##### Instances
19-
``` purescript
20-
instance monadContContT :: (Monad m) => MonadCont (ContT r m)
21-
instance monadContErrorT :: (MonadCont m) => MonadCont (ErrorT e m)
22-
instance monadContMaybeT :: (MonadCont m) => MonadCont (MaybeT m)
23-
instance monadContReaderT :: (MonadCont m) => MonadCont (ReaderT r m)
24-
instance monadContStateT :: (MonadCont m) => MonadCont (StateT s m)
25-
instance monadWriterT :: (Monoid w, MonadCont m) => MonadCont (WriterT w m)
17+
For example:
18+
19+
```purescript
20+
delay :: forall eff. Number -> ContT Unit (Eff (timeout :: Timeout | eff)) Unit
21+
delay n = callCC \cont ->
22+
lift $ setTimeout n (runContT (cont unit) (\_ -> return unit))
2623
```
24+
An implementation is provided for `ContT`, and for other monad transformers
25+
defined in this library.
2726

2827

docs/Control/Monad/Cont/Trans.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ This monad transformer extends the base monad with the operation `callCC`.
1515

1616
##### Instances
1717
``` purescript
18+
instance monadContContT :: (Monad m) => MonadCont (ContT r m)
1819
instance functorContT :: (Monad m) => Functor (ContT r m)
19-
instance applyContT :: (Functor m, Monad m) => Apply (ContT r m)
20-
instance applicativeContT :: (Functor m, Monad m) => Applicative (ContT r m)
20+
instance applyContT :: (Monad m) => Apply (ContT r m)
21+
instance applicativeContT :: (Monad m) => Applicative (ContT r m)
2122
instance bindContT :: (Monad m) => Bind (ContT r m)
2223
instance monadContT :: (Monad m) => Monad (ContT r m)
2324
instance monadTransContT :: MonadTrans (ContT r)
24-
instance monadEffContT :: (Monad m, MonadEff eff m) => MonadEff eff (ContT r m)
25+
instance monadEffContT :: (MonadEff eff m) => MonadEff eff (ContT r m)
26+
instance monadReaderContT :: (MonadReader r1 m) => MonadReader r1 (ContT r m)
27+
instance monadStateContT :: (MonadState s m) => MonadState s (ContT r m)
2528
```
2629

2730
#### `runContT`
@@ -48,22 +51,4 @@ withContT :: forall r m a b. ((b -> m r) -> a -> m r) -> ContT r m a -> ContT r
4851

4952
Modify the continuation in a `ContT` monad action
5053

51-
#### `callCC`
52-
53-
``` purescript
54-
callCC :: forall r m a b. ((a -> ContT r m b) -> ContT r m a) -> ContT r m a
55-
```
56-
57-
`callCC`, or _call-with-current-continuation_.
58-
59-
This action makes the current continuation available to the caller.
60-
61-
For example:
62-
63-
```purescript
64-
delay :: forall eff. Number -> ContT Unit (Eff (timeout :: Timeout | eff)) Unit
65-
delay n = callCC \cont ->
66-
lift $ setTimeout n (runContT (cont unit) (\_ -> return unit))
67-
```
68-
6954

docs/Control/Monad/Error/Class.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This module defines the `MonadError` type class and its instances.
55
#### `MonadError`
66

77
``` purescript
8-
class MonadError e m where
8+
class (Monad m) <= MonadError e m where
99
throwError :: forall a. e -> m a
1010
catchError :: forall a. m a -> (e -> m a) -> m a
1111
```
@@ -31,12 +31,6 @@ Laws:
3131
``` purescript
3232
instance monadErrorEither :: MonadError e (Either e)
3333
instance monadErrorMaybe :: MonadError Unit Maybe
34-
instance monadErrorErrorT :: (Monad m) => MonadError e (ErrorT e m)
35-
instance monadErrorExceptT :: (Monad m) => MonadError e (ExceptT e m)
36-
instance monadErrorMaybeT :: (Monad m, MonadError e m) => MonadError e (MaybeT m)
37-
instance monadErrorReaderT :: (Monad m, MonadError e m) => MonadError e (ReaderT r m)
38-
instance monadErrorWriterT :: (Monad m, Monoid w, MonadError e m) => MonadError e (WriterT w m)
39-
instance monadErrorStateT :: (Monad m, MonadError e m) => MonadError e (StateT s m)
4034
```
4135

4236
#### `catchJust`

docs/Control/Monad/Except.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ type Except e a = ExceptT e Identity a
77
```
88

99
A parametrizable exception monad; computations are either exceptions or
10-
pure values. If an exception is thrown (see `throwE`), the computation
11-
terminates with that value. Exceptions may also be caught with `catchE`,
10+
pure values. If an exception is thrown (see `throwError`), the computation
11+
terminates with that value. Exceptions may also be caught with `catchError`,
1212
allowing the computation to resume and exit successfully.
1313

1414
The type parameter `e` is the type of exceptions, and `a` is the type

docs/Control/Monad/Except/Trans.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Module Control.Monad.Except.Trans
22

3+
This module defines the _exception monad transformer_ `ExceptT`.
4+
35
#### `ExceptT`
46

57
``` purescript
@@ -19,13 +21,19 @@ instance applyExceptT :: (Apply m) => Apply (ExceptT e m)
1921
instance applicativeExceptT :: (Applicative m) => Applicative (ExceptT e m)
2022
instance bindExceptT :: (Monad m) => Bind (ExceptT e m)
2123
instance monadExceptT :: (Monad m) => Monad (ExceptT e m)
22-
instance monadRecErrorT :: (Semigroup e, MonadRec m) => MonadRec (ExceptT e m)
24+
instance monadRecExceptT :: (MonadRec m) => MonadRec (ExceptT e m)
2325
instance altExceptT :: (Semigroup e, Monad m) => Alt (ExceptT e m)
2426
instance plusExceptT :: (Monoid e, Monad m) => Plus (ExceptT e m)
2527
instance alternativeExceptT :: (Monoid e, Monad m) => Alternative (ExceptT e m)
2628
instance monadPlusExceptT :: (Monoid e, Monad m) => MonadPlus (ExceptT e m)
2729
instance monadTransExceptT :: MonadTrans (ExceptT e)
28-
instance monadEffExceptT :: (Monad m, MonadEff eff m) => MonadEff eff (ExceptT e m)
30+
instance monadEffExceptT :: (MonadEff eff m) => MonadEff eff (ExceptT e m)
31+
instance monadContExceptT :: (MonadCont m) => MonadCont (ExceptT e m)
32+
instance monadErrorExceptT :: (Monad m) => MonadError e (ExceptT e m)
33+
instance monadReaderExceptT :: (MonadReader r m) => MonadReader r (ExceptT e m)
34+
instance monadStateExceptT :: (MonadState s m) => MonadState s (ExceptT e m)
35+
instance monadWriterExceptT :: (MonadWriter w m) => MonadWriter w (ExceptT e m)
36+
instance monadRWSExceptT :: (Monoid w, MonadRWS r w s m) => MonadRWS r w s (ExceptT e m)
2937
```
3038

3139
#### `runExceptT`
@@ -52,20 +60,4 @@ mapExceptT :: forall e e' m n a b. (m (Either e a) -> n (Either e' b)) -> Except
5260

5361
Transform the unwrapped computation using the given function.
5462

55-
#### `throwE`
56-
57-
``` purescript
58-
throwE :: forall e m a. (Applicative m) => e -> ExceptT e m a
59-
```
60-
61-
Throw an exception in an `ExceptT` computation.
62-
63-
#### `catchE`
64-
65-
``` purescript
66-
catchE :: forall e e' m a. (Monad m) => ExceptT e m a -> (e -> ExceptT e' m a) -> ExceptT e' m a
67-
```
68-
69-
Catch an exception in an `ExceptT` computation.
70-
7163

docs/Control/Monad/List/Trans.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ instance altListT :: (Applicative f) => Alt (ListT f)
2929
instance plusListT :: (Monad f) => Plus (ListT f)
3030
instance alternativeListT :: (Monad f) => Alternative (ListT f)
3131
instance monadPlusListT :: (Monad f) => MonadPlus (ListT f)
32-
instance monadEffListT :: (Monad m, MonadEff eff m) => MonadEff eff (ListT m)
32+
instance monadEffListT :: (MonadEff eff m) => MonadEff eff (ListT m)
3333
```
3434

3535
#### `nil`

docs/Control/Monad/Maybe/Trans.md

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ instance plusMaybeT :: (Monad m) => Plus (MaybeT m)
2727
instance alternativeMaybeT :: (Monad m) => Alternative (MaybeT m)
2828
instance monadPlusMaybeT :: (Monad m) => MonadPlus (MaybeT m)
2929
instance monadRecMaybeT :: (MonadRec m) => MonadRec (MaybeT m)
30-
instance monadEffMaybe :: (Monad m, MonadEff eff m) => MonadEff eff (MaybeT m)
30+
instance monadEffMaybe :: (MonadEff eff m) => MonadEff eff (MaybeT m)
31+
instance monadContMaybeT :: (MonadCont m) => MonadCont (MaybeT m)
32+
instance monadErrorMaybeT :: (MonadError e m) => MonadError e (MaybeT m)
33+
instance monadReaderMaybeT :: (MonadReader r m) => MonadReader r (MaybeT m)
34+
instance monadStateMaybeT :: (MonadState s m) => MonadState s (MaybeT m)
35+
instance monadWriterMaybeT :: (Monad m, MonadWriter w m) => MonadWriter w (MaybeT m)
36+
instance monadRWSMaybeT :: (Monoid w, MonadRWS r w s m) => MonadRWS r w s (MaybeT m)
3137
```
3238

3339
#### `runMaybeT`
@@ -46,28 +52,4 @@ mapMaybeT :: forall m1 m2 a b. (m1 (Maybe a) -> m2 (Maybe b)) -> MaybeT m1 a ->
4652

4753
Change the result type of a `MaybeT` monad action.
4854

49-
#### `liftCatchMaybe`
50-
51-
``` purescript
52-
liftCatchMaybe :: forall m e a. (m (Maybe a) -> (e -> m (Maybe a)) -> m (Maybe a)) -> MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a
53-
```
54-
55-
#### `liftListenMaybe`
56-
57-
``` purescript
58-
liftListenMaybe :: forall m a w. (Monad m) => (m (Maybe a) -> m (Tuple (Maybe a) w)) -> MaybeT m a -> MaybeT m (Tuple a w)
59-
```
60-
61-
#### `liftPassMaybe`
62-
63-
``` purescript
64-
liftPassMaybe :: forall m a w. (Monad m) => (m (Tuple (Maybe a) (w -> w)) -> m (Maybe a)) -> MaybeT m (Tuple a (w -> w)) -> MaybeT m a
65-
```
66-
67-
#### `liftCallCCMaybe`
68-
69-
``` purescript
70-
liftCallCCMaybe :: forall m a b. (((Maybe a -> m (Maybe b)) -> m (Maybe a)) -> m (Maybe a)) -> ((a -> MaybeT m b) -> MaybeT m a) -> MaybeT m a
71-
```
72-
7355

docs/Control/Monad/RWS.md

Lines changed: 1 addition & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ to the `Identity` monad.
1717
rws :: forall r w s a. (r -> s -> See s a w) -> RWS r w s a
1818
```
1919

20-
Create an action in the `RWS` monad from a function which uses the
20+
Create an action in the `RWS` monad from a function which uses the
2121
global context and state explicitly.
2222

2323
#### `runRWS`
@@ -60,116 +60,4 @@ withRWS :: forall r1 r2 w s a. (r2 -> s -> Tuple r1 s) -> RWS r1 w s a -> RWS r2
6060

6161
Change the type of the context in a `RWS` action
6262

63-
#### `ask`
64-
65-
``` purescript
66-
ask :: forall r w s m. (Applicative m, Monoid w) => RWST r w s m r
67-
```
68-
69-
Get the context of a `RWS` action
70-
71-
#### `local`
72-
73-
``` purescript
74-
local :: forall r w s m a. (r -> r) -> RWST r w s m a -> RWST r w s m a
75-
```
76-
77-
Locally change the context of a `RWS` action.
78-
79-
#### `reader`
80-
81-
``` purescript
82-
reader :: forall r w s m a. (Applicative m, Monoid w) => (r -> a) -> RWST r w s m a
83-
```
84-
85-
Read a value which depends on the context in a `RWS` action.
86-
87-
#### `writer`
88-
89-
``` purescript
90-
writer :: forall r w s m a. (Applicative m) => Tuple a w -> RWST r w s m a
91-
```
92-
93-
Write to the accumulator in a `RWS` action
94-
95-
#### `listen`
96-
97-
``` purescript
98-
listen :: forall r w s m a. (Monad m) => RWST r w s m a -> RWST r w s m (Tuple a w)
99-
```
100-
101-
Execute a `RWS` action, and return the changes to the accumulator along with the return value
102-
103-
#### `pass`
104-
105-
``` purescript
106-
pass :: forall r w s m a. (Monad m) => RWST r w s m (Tuple a (w -> w)) -> RWST r w s m a
107-
```
108-
109-
Execute a `RWS` action and modify the accumulator
110-
111-
#### `tell`
112-
113-
``` purescript
114-
tell :: forall r w s m. (Applicative m) => w -> RWST r w s m Unit
115-
```
116-
117-
Append a value to the accumulator in a `RWS` action
118-
119-
#### `listens`
120-
121-
``` purescript
122-
listens :: forall r w s m a b. (Monad m) => (w -> b) -> RWST r w s m a -> RWST r w s m (Tuple a b)
123-
```
124-
125-
Execute a `RWS` action, and return a value which depends on the accumulator along with the return value
126-
127-
#### `censor`
128-
129-
``` purescript
130-
censor :: forall r w s m a. (Monad m) => (w -> w) -> RWST r w s m a -> RWST r w s m a
131-
```
132-
133-
Modify the accumulator in a `RWS` action
134-
135-
#### `state`
136-
137-
``` purescript
138-
state :: forall r w s m a. (Applicative m, Monoid w) => (s -> Tuple a s) -> RWST r w s m a
139-
```
140-
141-
Get or modify the state in a `RWS` action
142-
143-
#### `get`
144-
145-
``` purescript
146-
get :: forall r w s m. (Applicative m, Monoid w) => RWST r w s m s
147-
```
148-
149-
Get the state in a `RWS` action
150-
151-
#### `gets`
152-
153-
``` purescript
154-
gets :: forall r w s m a. (Applicative m, Monoid w) => (s -> a) -> RWST r w s m a
155-
```
156-
157-
Get a value which depends on the state in a `RWS` action
158-
159-
#### `put`
160-
161-
``` purescript
162-
put :: forall r w s m. (Applicative m, Monoid w) => s -> RWST r w s m Unit
163-
```
164-
165-
Set the state in a `RWS` action
166-
167-
#### `modify`
168-
169-
``` purescript
170-
modify :: forall r w s m. (Applicative m, Monoid w) => (s -> s) -> RWST r w s m Unit
171-
```
172-
173-
Modify the state in a `RWS` action
174-
17563

docs/Control/Monad/RWS/Class.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This module defines the `MonadRWS` type class and its instances.
55
#### `MonadRWS`
66

77
``` purescript
8-
class (Monad m, Monoid w, MonadReader r m, MonadWriter w m, MonadState s m) <= MonadRWS r w s m
8+
class (Monoid w, MonadReader r m, MonadWriter w m, MonadState s m) <= MonadRWS r w s m
99
```
1010

1111
`MonadRWS r w s` combines the operations and laws of the `MonadReader r`,
@@ -14,11 +14,4 @@ class (Monad m, Monoid w, MonadReader r m, MonadWriter w m, MonadState s m) <= M
1414
An implementation is provided for `RWST`, and for other monad transformers
1515
defined in this library.
1616

17-
##### Instances
18-
``` purescript
19-
instance monadRWSRWST :: (Monad m, Monoid w) => MonadRWS r w s (RWST r w s m)
20-
instance monadRWSErrorT :: (Monad m, Monoid w, MonadRWS r w s m, MonadReader r m, MonadWriter w m, MonadState s m) => MonadRWS r w s (ErrorT e m)
21-
instance monadRWSMaybeT :: (Monad m, Monoid w, MonadRWS r w s m, MonadReader r m, MonadWriter w m, MonadState s m) => MonadRWS r w s (MaybeT m)
22-
```
23-
2417

docs/Control/Monad/RWS/Trans.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ instance applicativeRWST :: (Monad m, Monoid w) => Applicative (RWST r w s m)
3333
instance monadRWST :: (Monad m, Monoid w) => Monad (RWST r w s m)
3434
instance monadTransRWST :: (Monoid w) => MonadTrans (RWST r w s)
3535
instance monadEffRWS :: (Monad m, Monoid w, MonadEff eff m) => MonadEff eff (RWST r w s m)
36+
instance monadReaderRWST :: (Monad m, Monoid w) => MonadReader r (RWST r w s m)
37+
instance monadStateRWST :: (Monad m, Monoid w) => MonadState s (RWST r w s m)
38+
instance monadWriterRWST :: (Monad m, Monoid w) => MonadWriter w (RWST r w s m)
39+
instance monadRWSRWST :: (Monad m, Monoid w) => MonadRWS r w s (RWST r w s m)
3640
```
3741

3842
#### `runRWST`

0 commit comments

Comments
 (0)