Skip to content

Commit 64bc521

Browse files
committed
Revert "[resolves agda#1333] writer transformer (agda#1850)"
This reverts commit f7bfeba.
1 parent 1c9859c commit 64bc521

13 files changed

+8
-502
lines changed

CHANGELOG.md

-14
Original file line numberDiff line numberDiff line change
@@ -591,15 +591,6 @@ Non-backwards compatible changes
591591
This is needed because `MonadState S M` does not pack a `Monad M` instance anymore
592592
and so we cannot define `modify f` as `get >>= λ s → put (f s)`.
593593

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-
603594
* New modules:
604595
```
605596
Data.List.Effectful.Transformer
@@ -622,11 +613,6 @@ Non-backwards compatible changes
622613
Effect.Monad.State.Instances
623614
Effect.Monad.State.Transformer
624615
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
630616
IO.Effectful
631617
IO.Instances
632618
```

src/Effect/Monad/Error/Transformer.agda

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ private
2121
variable
2222
f ℓ : Level
2323
A B : Set
24-
M : Set f Set
24+
M : Set f Set f
2525

2626
------------------------------------------------------------------------
2727
-- Error monad operations
2828

2929
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
3232
field
3333
throw : E M A
3434
catch : M A (E M A) M A

src/Effect/Monad/IO.agda

+1-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ record RawMonadIO
3232
liftIO : IO A M A
3333

3434
------------------------------------------------------------------------
35-
-- IO monad specifics
35+
-- Reader monad specifics
3636

3737
monadIO : RawMonadIO {f} IO
3838
monadIO = record { liftIO = id }
@@ -50,10 +50,3 @@ liftReaderT : ∀ {R} → RawMonadIO M → RawMonadIO (ReaderT R M)
5050
liftReaderT MIO = record
5151
{ liftIO = λ io mkReaderT (λ r liftIO io)
5252
} 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

src/Effect/Monad/IO/Instances.agda

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ instance
1414
ioMonadIO = monadIO
1515
stateTMonadIO = λ {s} {S} {M} {{m}} {{mio}} liftStateT {s} {S} {M} m mio
1616
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

src/Effect/Monad/Reader/Instances.agda

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ instance
2222
readerTMonadPlus = λ {s} {S} {f} {M} {{mpl}} monadPlus {s} {S} {f} {M} mpl
2323
readerTMonadT = λ {s} {S} {f} {M} {{mon}} monadT {s} {S} {f} {M} mon
2424
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
2726
-- the following instance conflicts with readerTMonadReader so we don't include it
2827
-- readerTLiftReaderT = λ {R} {s} {S} {f} {M} {{ms}} → liftReaderT {R} {s} {S} {f} {M} ms

src/Effect/Monad/Reader/Transformer.agda

+1-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
module Effect.Monad.Reader.Transformer where
1111

12-
open import Algebra using (RawMonoid)
1312
open import Effect.Choice
1413
open import Effect.Empty
1514
open import Effect.Functor
@@ -116,19 +115,7 @@ liftReaderT MRead = record
116115
; local = λ f mx mkReaderT (λ r₂ local f (runReaderT mx r₂))
117116
} where open RawMonadReader MRead
118117

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 (_,_)
132119
open import Effect.Monad.State.Transformer.Base
133120

134121
liftStateT : RawFunctor M

src/Effect/Monad/State/Instances.agda

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ instance
2222
stateTMonadPlus = λ {s} {S} {f} {M} {{mpl}} monadPlus {s} {S} {f} {M} mpl
2323
stateTMonadT = λ {s} {S} {f} {M} {{mon}} monadT {s} {S} {f} {M} mon
2424
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
2826
-- 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

src/Effect/Monad/State/Transformer.agda

-13
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ open import Level using (Level; suc; _⊔_)
1010

1111
module Effect.Monad.State.Transformer where
1212

13-
open import Algebra using (RawMonoid)
1413
open import Data.Product using (_×_; _,_; map₂; proj₁; proj₂)
1514
open import Data.Unit.Polymorphic.Base
1615
open import Effect.Choice
@@ -137,15 +136,3 @@ liftReaderT Mon = record
137136
{ gets = λ f mkReaderT (const (gets f))
138137
; modify = λ f mkReaderT (const (modify f))
139138
} 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

src/Effect/Monad/Writer.agda

-62
This file was deleted.

src/Effect/Monad/Writer/Indexed.agda

-122
This file was deleted.

src/Effect/Monad/Writer/Instances.agda

-26
This file was deleted.

0 commit comments

Comments
 (0)