feat: monad instance, some classfile constant-pool parsing
This commit is contained in:
parent
a4b5b06000
commit
f504462d3c
13 changed files with 153 additions and 6 deletions
|
@ -29,6 +29,14 @@ instance Applicative Extract where
|
|||
Fail -> Fail
|
||||
Fail -> Fail
|
||||
|
||||
instance Monad Extract where
|
||||
(>>=) :: Extract a -> (a -> Extract b) -> Extract b
|
||||
(>>=) (Extract computeA) f = Extract $ \ input -> case computeA input of
|
||||
Done rest a -> let
|
||||
(Extract computeB) = f a
|
||||
in computeB rest
|
||||
Fail -> Fail
|
||||
|
||||
instance Alternative Extract where
|
||||
empty :: Extract a
|
||||
empty = Extract $ const Fail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue