Commit 63241844 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

MonadFail forward-compat

It turns out that the `fail` method was unused to begin with.
parent 212451d7
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment