Skip to content

Commit

Permalink
defined Alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
BebeSparkelSparkel committed Dec 22, 2023
1 parent 6412fcb commit 30b13ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Control/Monad/ST/Trans/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ instance (Monad m, Functor m) => Applicative (STT s m) where
(STTRet s3 x) <- n s2
return (STTRet s3 (f x))

instance (Monad m, Alternative m) => Alternative (STT s m) where
empty = STT $ \_ -> empty
STT m <|> STT n = STT $ \s# -> m s# <|> n s#

-- Instances of other monad classes

instance (MonadError e m, Functor m) => MonadError e (STT s m) where
Expand Down

0 comments on commit 30b13ae

Please sign in to comment.