mirror of
https://github.com/github/semantic.git
synced 2024-12-29 09:55:52 +03:00
Define a Monad instance for Amb.
This commit is contained in:
parent
aeb4a65c61
commit
5ca85ec4ed
@ -18,3 +18,8 @@ instance Applicative (Amb l) where
|
||||
None l <*> _ = None l
|
||||
_ <*> None r = None r
|
||||
Some fs <*> Some as = Some (fs <*> as)
|
||||
|
||||
instance Monad (Amb l) where
|
||||
return = pure
|
||||
None a >>= _ = None a
|
||||
Some as >>= f = foldr1 (<>) (f <$> as)
|
||||
|
Loading…
Reference in New Issue
Block a user