File tree 13 files changed +8
-502
lines changed
13 files changed +8
-502
lines changed Original file line number Diff line number Diff line change @@ -591,15 +591,6 @@ Non-backwards compatible changes
591
591
This is needed because ` MonadState S M ` does not pack a ` Monad M ` instance anymore
592
592
and so we cannot define ` modify f ` as ` get >>= λ s → put (f s) ` .
593
593
594
- * ` MonadWriter 𝕎 M ` is defined similarly:
595
- ``` agda
596
- writer : W × A → M A
597
- listen : M A → M (W × A)
598
- pass : M ((W → W) × A) → M A
599
- ```
600
- with ` tell ` defined as a derived notion.
601
- Note that ` 𝕎 ` is a ` RawMonoid ` , not a ` Set ` and ` W ` is the carrier of the monoid.
602
-
603
594
* New modules:
604
595
```
605
596
Data.List.Effectful.Transformer
@@ -622,11 +613,6 @@ Non-backwards compatible changes
622
613
Effect.Monad.State.Instances
623
614
Effect.Monad.State.Transformer
624
615
Effect.Monad.State.Transformer.Base
625
- Effect.Monad.Writer
626
- Effect.Monad.Writer.Indexed
627
- Effect.Monad.Writer.Instances
628
- Effect.Monad.Writer.Transformer
629
- Effect.Monad.Writer.Transformer.Base
630
616
IO.Effectful
631
617
IO.Instances
632
618
```
Original file line number Diff line number Diff line change @@ -21,14 +21,14 @@ private
21
21
variable
22
22
f ℓ : Level
23
23
A B : Set ℓ
24
- M : Set f → Set ℓ
24
+ M : Set f → Set f
25
25
26
26
------------------------------------------------------------------------
27
27
-- Error monad operations
28
28
29
29
record RawMonadError
30
- (M : Set (e ⊔ a) → Set ℓ )
31
- : Set (suc (e ⊔ a) ⊔ ℓ ) where
30
+ (M : Set (e ⊔ a) → Set (e ⊔ a) )
31
+ : Set (suc (e ⊔ a)) where
32
32
field
33
33
throw : E → M A
34
34
catch : M A → (E → M A) → M A
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ record RawMonadIO
32
32
liftIO : IO A → M A
33
33
34
34
------------------------------------------------------------------------
35
- -- IO monad specifics
35
+ -- Reader monad specifics
36
36
37
37
monadIO : RawMonadIO {f} IO
38
38
monadIO = record { liftIO = id }
@@ -50,10 +50,3 @@ liftReaderT : ∀ {R} → RawMonadIO M → RawMonadIO (ReaderT R M)
50
50
liftReaderT MIO = record
51
51
{ liftIO = λ io → mkReaderT (λ r → liftIO io)
52
52
} where open RawMonadIO MIO
53
-
54
- open import Effect.Monad.Writer.Transformer.Base using (WriterT; mkWriterT)
55
-
56
- liftWriterT : ∀ {f 𝕎} → RawFunctor M → RawMonadIO M → RawMonadIO (WriterT {f = f} 𝕎 M)
57
- liftWriterT M MIO = record
58
- { liftIO = λ io → mkWriterT (λ w → (w ,_) <$> liftIO io)
59
- } where open RawFunctor M; open RawMonadIO MIO
Original file line number Diff line number Diff line change @@ -14,4 +14,3 @@ instance
14
14
ioMonadIO = monadIO
15
15
stateTMonadIO = λ {s} {S} {M} {{m}} {{mio}} → liftStateT {s} {S} {M} m mio
16
16
readerTMonadIO = λ {r} {R} {M} {{mio}} → liftReaderT {r} {R} {M} mio
17
- writerTMonadIO = λ {f} {w} {W} {M} {{m}} {{mio}} → liftWriterT {f} {w} {W} {M} m mio
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ instance
22
22
readerTMonadPlus = λ {s} {S} {f} {M} {{mpl}} → monadPlus {s} {S} {f} {M} mpl
23
23
readerTMonadT = λ {s} {S} {f} {M} {{mon}} → monadT {s} {S} {f} {M} mon
24
24
readerTMonadReader = λ {s} {S} {f} {M} {{mon}} → monadReader {s} {S} {f} {M} mon
25
- readerTLiftWriterT = λ {s} {S₁} {S₂} {f} {M} {{mo}} {{fun}} {{mr}} → liftWriterT {s} {S₁} {S₂} {f} {M} mo fun mr
26
- readerTLiftStateT = λ {s} {S₁} {S₂} {f} {M} {{fun}} {{mr}} → liftStateT {s} {S₁} {S₂} {f} {M} fun mr
25
+ readerTLiftStateT = λ {s} {S₁} {S₂} {f} {M} {{mon}} {{ms}} → liftStateT {s} {S₁} {S₂} {f} {M} mon ms
27
26
-- the following instance conflicts with readerTMonadReader so we don't include it
28
27
-- readerTLiftReaderT = λ {R} {s} {S} {f} {M} {{ms}} → liftReaderT {R} {s} {S} {f} {M} ms
Original file line number Diff line number Diff line change 9
9
10
10
module Effect.Monad.Reader.Transformer where
11
11
12
- open import Algebra using (RawMonoid)
13
12
open import Effect.Choice
14
13
open import Effect.Empty
15
14
open import Effect.Functor
@@ -116,19 +115,7 @@ liftReaderT MRead = record
116
115
; local = λ f mx → mkReaderT (λ r₂ → local f (runReaderT mx r₂))
117
116
} where open RawMonadReader MRead
118
117
119
- open import Data.Product using (_×_; _,_)
120
- open import Effect.Monad.Writer.Transformer.Base
121
-
122
- liftWriterT : (MR : RawMonoid r g) →
123
- RawFunctor M →
124
- RawMonadReader R M →
125
- RawMonadReader R (WriterT MR M)
126
- liftWriterT MR M MRead = record
127
- { reader = λ k → mkWriterT λ w → ((w ,_) <$> reader k)
128
- ; local = λ f mx → mkWriterT λ w → (local f (runWriterT mx w))
129
- } where open RawMonadReader MRead
130
- open RawFunctor M
131
-
118
+ open import Data.Product using (_,_)
132
119
open import Effect.Monad.State.Transformer.Base
133
120
134
121
liftStateT : RawFunctor M →
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ instance
22
22
stateTMonadPlus = λ {s} {S} {f} {M} {{mpl}} → monadPlus {s} {S} {f} {M} mpl
23
23
stateTMonadT = λ {s} {S} {f} {M} {{mon}} → monadT {s} {S} {f} {M} mon
24
24
stateTMonadState = λ {s} {S} {f} {M} {{mon}} → monadState {s} {S} {f} {M} mon
25
- stateTLiftReaderT = λ {R} {s} {S} {f} {M} {{ms}} → liftReaderT {R} {s} {S} {f} {M} ms
26
- stateTLiftWriterT = λ {R} {s} {S} {f} {M} {{fun}} {{mo}} {{ms}} → liftWriterT {R} {s} {S} {f} {M} mo fun ms
27
- -- the following instances conflicts with stateTMonadState so we don't include it
25
+ -- the following instance conflicts with stateTMonadState so we don't include it
28
26
-- stateTLiftStateT = λ {s} {S₁} {S₂} {f} {M} {{mon}} {{ms}} → liftStateT {s} {S₁} {S₂} {f} {M} mon ms
27
+ stateTLiftReaderT = λ {R} {s} {S} {f} {M} {{ms}} → liftReaderT {R} {s} {S} {f} {M} ms
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ open import Level using (Level; suc; _⊔_)
10
10
11
11
module Effect.Monad.State.Transformer where
12
12
13
- open import Algebra using (RawMonoid)
14
13
open import Data.Product using (_×_; _,_; map₂; proj₁; proj₂)
15
14
open import Data.Unit.Polymorphic.Base
16
15
open import Effect.Choice
@@ -137,15 +136,3 @@ liftReaderT Mon = record
137
136
{ gets = λ f → mkReaderT (const (gets f))
138
137
; modify = λ f → mkReaderT (const (modify f))
139
138
} where open RawMonadState Mon
140
-
141
- open import Effect.Monad.Writer.Transformer.Base
142
-
143
- liftWriterT : (MS : RawMonoid s f) →
144
- RawFunctor M →
145
- RawMonadState S M →
146
- RawMonadState S (WriterT MS M)
147
- liftWriterT MS M Mon = record
148
- { gets = λ f → mkWriterT λ w → (gets ((w ,_) ∘′ f))
149
- ; modify = λ f → mkWriterT λ w → (const (w , tt) <$> modify f)
150
- } where open RawMonadState Mon
151
- open RawFunctor M
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments