File tree Expand file tree Collapse file tree 10 files changed +18
-18
lines changed Expand file tree Collapse file tree 10 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 22
22
23
23
- ` ask (local f x) = f (ask x) `
24
24
- ` extract (local _ x) = extract a `
25
- - ` extend g (local f x) = extend (g <<< local f) x `
25
+ - ` extend g (local f x) = extend (g <<< local f) x `
26
26
27
27
##### Instances
28
28
``` purescript
@@ -33,7 +33,7 @@ instance comonadEnvEnvT :: (Comonad w) => ComonadEnv e (EnvT e w)
33
33
#### ` asks `
34
34
35
35
``` purescript
36
- asks :: forall e1 e2 w a . (ComonadEnv e1 w) => (e1 -> e2) -> w e1 -> e2
36
+ asks :: forall e1 e2 w. (ComonadEnv e1 w) => (e1 -> e2) -> w e1 -> e2
37
37
```
38
38
39
39
Get a value which depends on the environment.
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ Get a value which depends on the current position.
60
60
#### ` censor `
61
61
62
62
``` purescript
63
- censor :: forall w a t b . (Functor w) => (t -> t) -> TracedT t w a -> TracedT t w a
63
+ censor :: forall w a t. (Functor w) => (t -> t) -> TracedT t w a -> TracedT t w a
64
64
```
65
65
66
66
Apply a function to the current position.
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Run a computation in the `Reader` monad.
22
22
#### ` withReader `
23
23
24
24
``` purescript
25
- withReader :: forall r1 r2 a b . (r2 -> r1) -> Reader r1 a -> Reader r2 a
25
+ withReader :: forall r1 r2 a. (r2 -> r1) -> Reader r1 a -> Reader r2 a
26
26
```
27
27
28
28
Change the type of the context in a ` Reader ` monad action.
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ Change the type of the result in a `ReaderT` monad action.
57
57
#### ` withReaderT `
58
58
59
59
``` purescript
60
- withReaderT :: forall r1 r2 m a b . (r2 -> r1) -> ReaderT r1 m a -> ReaderT r2 m a
60
+ withReaderT :: forall r1 r2 m a. (r2 -> r1) -> ReaderT r1 m a -> ReaderT r2 m a
61
61
```
62
62
63
63
Change the type of the context in a ` ReaderT ` monad action.
Original file line number Diff line number Diff line change 32
32
#### ` tell `
33
33
34
34
``` purescript
35
- tell :: forall w m a . (Monoid w, Monad m, MonadWriter w m) => w -> m Unit
35
+ tell :: forall w m. (Monoid w, Monad m, MonadWriter w m) => w -> m Unit
36
36
```
37
37
38
38
Append a value to the accumulator.
Original file line number Diff line number Diff line change @@ -22,13 +22,13 @@ import Data.Tuple
22
22
-- |
23
23
-- | - `ask (local f x) = f (ask x)`
24
24
-- | - `extract (local _ x) = extract a`
25
- -- | - `extend g (local f x) = extend (g <<< local f) x`
25
+ -- | - `extend g (local f x) = extend (g <<< local f) x`
26
26
class (Comonad w ) <= ComonadEnv e w where
27
27
ask :: forall a . w a -> e
28
28
local :: forall a . (e -> e ) -> w a -> w a
29
-
29
+
30
30
-- | Get a value which depends on the environment.
31
- asks :: forall e1 e2 w a . (ComonadEnv e1 w ) => (e1 -> e2 ) -> w e1 -> e2
31
+ asks :: forall e1 e2 w . (ComonadEnv e1 w ) => (e1 -> e2 ) -> w e1 -> e2
32
32
asks f x = f $ ask x
33
33
34
34
instance comonadEnvTuple :: ComonadEnv e (Tuple e ) where
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class (Comonad w) <= ComonadTraced t w where
34
34
-- | Extracts a value at a relative position which depends on the current value.
35
35
tracks :: forall w a t . (Comonad w , ComonadTraced t w ) => (a -> t ) -> w a -> a
36
36
tracks f w = track (f $ extract w) w
37
-
37
+
38
38
-- | Get the current position.
39
39
listen :: forall w a t . (Functor w ) => TracedT t w a -> TracedT t w (Tuple a t )
40
40
listen tr = TracedT ((\f t -> Tuple (f t) t) <$> runTracedT tr)
@@ -44,8 +44,8 @@ listens :: forall w a t b. (Functor w) => (t -> b) -> TracedT t w a -> TracedT t
44
44
listens f tr = TracedT ((\g t -> Tuple (g t) (f t)) <$> runTracedT tr)
45
45
46
46
-- | Apply a function to the current position.
47
- censor :: forall w a t b . (Functor w ) => (t -> t ) -> TracedT t w a -> TracedT t w a
47
+ censor :: forall w a t . (Functor w ) => (t -> t ) -> TracedT t w a -> TracedT t w a
48
48
censor f tr = TracedT ((>>>) f <$> runTracedT tr)
49
49
50
50
instance comonadTracedTracedT :: (Comonad w , Monoid t ) => ComonadTraced t (TracedT t w ) where
51
- track t tr = extract (runTracedT tr) t
51
+ track t tr = extract (runTracedT tr) t
Original file line number Diff line number Diff line change 1
1
-- | This module defines the `Reader` monad.
2
2
3
- module Control.Monad.Reader
3
+ module Control.Monad.Reader
4
4
( Reader ()
5
5
, runReader
6
6
, mapReader
@@ -24,7 +24,7 @@ runReader :: forall r a. Reader r a -> r -> a
24
24
runReader m = runIdentity <<< runReaderT m
25
25
26
26
-- | Change the type of the context in a `Reader` monad action.
27
- withReader :: forall r1 r2 a b . (r2 -> r1 ) -> Reader r1 a -> Reader r2 a
27
+ withReader :: forall r1 r2 a . (r2 -> r1 ) -> Reader r1 a -> Reader r2 a
28
28
withReader = withReaderT
29
29
30
30
-- | Change the type of the result in a `Reader` monad action.
Original file line number Diff line number Diff line change 1
1
-- | This module defines the reader monad transformer, `ReaderT`.
2
2
3
- module Control.Monad.Reader.Trans
3
+ module Control.Monad.Reader.Trans
4
4
( ReaderT (..), runReaderT , withReaderT , mapReaderT
5
5
, module Control.Monad.Trans
6
6
, module Control.Monad.Reader.Class
@@ -42,7 +42,7 @@ mapReaderT :: forall r m1 m2 a b. (m1 a -> m2 b) -> ReaderT r m1 a -> ReaderT r
42
42
mapReaderT f m = ReaderT $ f <<< runReaderT m
43
43
44
44
-- | Change the type of the context in a `ReaderT` monad action.
45
- withReaderT :: forall r1 r2 m a b . (r2 -> r1 ) -> ReaderT r1 m a -> ReaderT r2 m a
45
+ withReaderT :: forall r1 r2 m a . (r2 -> r1 ) -> ReaderT r1 m a -> ReaderT r2 m a
46
46
withReaderT f m = ReaderT $ runReaderT m <<< f
47
47
48
48
instance functorReaderT :: (Functor m ) => Functor (ReaderT r m ) where
@@ -90,7 +90,7 @@ instance monadReaderReaderT :: (Monad m) => MonadReader r (ReaderT r m) where
90
90
91
91
instance monadStateReaderT :: (MonadState s m ) => MonadState s (ReaderT r m ) where
92
92
state f = lift (state f)
93
-
93
+
94
94
instance monadWriterReaderT :: (Monad m , MonadWriter w m ) => MonadWriter w (ReaderT r m ) where
95
95
writer wd = lift (writer wd)
96
96
listen = mapReaderT listen
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class (Monad m) <= MonadWriter w m where
30
30
pass :: forall a . m (Tuple a (w -> w )) -> m a
31
31
32
32
-- | Append a value to the accumulator.
33
- tell :: forall w m a . (Monoid w , Monad m , MonadWriter w m ) => w -> m Unit
33
+ tell :: forall w m . (Monoid w , Monad m , MonadWriter w m ) => w -> m Unit
34
34
tell w = writer $ Tuple unit w
35
35
36
36
-- | Read a value which depends on the modifications made to the accumulator during an action.
You can’t perform that action at this time.
0 commit comments