feat: monad instance, some classfile constant-pool parsing

This commit is contained in:
vegowotenks 2025-07-11 20:00:30 +02:00
parent a4b5b06000
commit f504462d3c
13 changed files with 153 additions and 6 deletions

View file

@ -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