File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,11 +213,11 @@ instance (Monad m) => Applicative (RWST r w s m) where
213213 return (f x, s'', w'')
214214 {-# INLINE (<*>) #-}
215215
216- instance (MonadPlus m ) => Alternative (RWST r w s m ) where
217- empty = RWST $ \ _ _ _ -> mzero
216+ instance (Functor m , Alternative m , Monad m ) => Alternative (RWST r w s m ) where
217+ empty = RWST $ \ _ _ _ -> empty
218218 {-# INLINE empty #-}
219219
220- RWST m <|> RWST n = RWST $ \ r s w -> m r s w `mplus` n r s w
220+ RWST m <|> RWST n = RWST $ \ r s w -> m r s w <|> n r s w
221221 {-# INLINE (<|>) #-}
222222
223223instance (Monad m ) => Monad (RWST r w s m ) where
Original file line number Diff line number Diff line change @@ -108,10 +108,10 @@ instance (Monad m) => Applicative (SelectT r m) where
108108 m *> k = m >>= \ _ -> k
109109 {-# INLINE (*>) #-}
110110
111- instance (MonadPlus m ) => Alternative (SelectT r m ) where
112- empty = mzero
111+ instance (Functor m , Alternative m , Monad m ) => Alternative (SelectT r m ) where
112+ empty = empty
113113 {-# INLINE empty #-}
114- (<|>) = mplus
114+ (<|>) = (<|>)
115115 {-# INLINE (<|>) #-}
116116
117117instance (Monad m ) => Monad (SelectT r m ) where
Original file line number Diff line number Diff line change @@ -215,10 +215,10 @@ instance (Monad m) => Applicative (StateT s m) where
215215 m *> k = m >>= \ _ -> k
216216 {-# INLINE (*>) #-}
217217
218- instance (MonadPlus m ) => Alternative (StateT s m ) where
219- empty = StateT $ \ _ -> mzero
218+ instance (Functor m , Alternative m , Monad m ) => Alternative (StateT s m ) where
219+ empty = StateT $ \ _ -> empty
220220 {-# INLINE empty #-}
221- StateT m <|> StateT n = StateT $ \ s -> m s `mplus` n s
221+ StateT m <|> StateT n = StateT $ \ s -> m s <|> n s
222222 {-# INLINE (<|>) #-}
223223
224224instance (Monad m ) => Monad (StateT s m ) where
Original file line number Diff line number Diff line change @@ -208,10 +208,10 @@ instance (Monad m) => Applicative (StateT s m) where
208208 m *> k = m >>= \ _ -> k
209209 {-# INLINE (*>) #-}
210210
211- instance (MonadPlus m ) => Alternative (StateT s m ) where
212- empty = StateT $ \ _ -> mzero
211+ instance (Functor m , Alternative m , Monad m ) => Alternative (StateT s m ) where
212+ empty = StateT $ \ _ -> empty
213213 {-# INLINE empty #-}
214- StateT m <|> StateT n = StateT $ \ s -> m s `mplus` n s
214+ StateT m <|> StateT n = StateT $ \ s -> m s <|> n s
215215 {-# INLINE (<|>) #-}
216216
217217instance (Monad m ) => Monad (StateT s m ) where
Original file line number Diff line number Diff line change @@ -168,11 +168,11 @@ instance (Monad m) => Applicative (WriterT w m) where
168168 return (f x, w'')
169169 {-# INLINE (<*>) #-}
170170
171- instance (MonadPlus m ) => Alternative (WriterT w m ) where
172- empty = WriterT $ const mzero
171+ instance (Functor m , Alternative m , Monad m ) => Alternative (WriterT w m ) where
172+ empty = WriterT $ const empty
173173 {-# INLINE empty #-}
174174
175- WriterT m <|> WriterT n = WriterT $ \ w -> m w `mplus` n w
175+ WriterT m <|> WriterT n = WriterT $ \ w -> m w <|> n w
176176 {-# INLINE (<|>) #-}
177177
178178instance (Monad m ) => Monad (WriterT w m ) where
You can’t perform that action at this time.
0 commit comments