Skip to content
Snippets Groups Projects
Verified Commit 63241844 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel :man_dancing:
Browse files

MonadFail forward-compat

It turns out that the `fail` method was unused to begin with.
parent 212451d7
No related branches found
No related tags found
No related merge requests found
......@@ -38,14 +38,16 @@ instance Monad Parser where
Success pos'' (out1++out2) imp'' b
Failure pos'' msg -> Failure pos'' msg
Failure pos' msg -> Failure pos' msg
fail msg = Parser $ \pos _ -> Failure pos msg
failp :: String -> Parser a
failp msg = Parser $ \pos _ -> Failure pos msg
instance Alternative Parser where
empty = mzero
(<|>) = mplus
instance MonadPlus Parser where
mzero = fail "mzero"
mzero = failp "mzero"
Parser m `mplus` Parser n =
Parser $ \pos s -> case m pos s of
success@(Success _ _ _ _) -> success
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment