Skip to content

Commit 2aaff1f

Browse files
authored
Merge pull request #172 from sjshuck/product-instance-methods
Explicit method impls for MonadState and MonadWriter Product instances
2 parents da92fb9 + 91d17d7 commit 2aaff1f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Control/Monad/State/Class.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,4 @@ instance MonadState s m => MonadState s (SelectT r m) where
197197
instance (MonadState s m, MonadState s n) => MonadState s (Product m n) where
198198
get = Pair get get
199199
put s = Pair (put s) (put s)
200+
state sas = Pair (state sas) (state sas)

Control/Monad/Writer/Class.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ instance
208208
pass = Accum.liftPass pass
209209

210210
instance (MonadWriter w m, MonadWriter w n) => MonadWriter w (Product m n) where
211-
tell w = Pair (tell w) (tell w)
211+
writer aw = Pair (writer aw) (writer aw)
212+
tell w = Pair (tell w) (tell w)
212213
listen (Pair ma na) = Pair (listen ma) (listen na)
213214
pass (Pair maf naf) = Pair (pass maf) (pass naf)

0 commit comments

Comments
 (0)