Commit dfc32cd5 authored by Austin Seipp's avatar Austin Seipp
Browse files

genprimopcode: Applicative instance for ParserM

Signed-off-by: default avatarAustin Seipp <>
parent b9b94ec8
......@@ -16,13 +16,21 @@ module ParserM (
-- Other
) where
import Control.Applicative
import Control.Monad (ap, liftM)
import Data.Word (Word8)
import Data.Char (ord)
-- Parser Monad
newtype ParserM a = ParserM (AlexInput -> St -> Either String (AlexInput, St, a))
instance Functor ParserM where
fmap = liftM
instance Applicative ParserM where
pure = return
(<*>) = ap
instance Monad ParserM where
ParserM m >>= k = ParserM $ \i s -> case m i s of
Right (i', s', x) ->
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