feat(users/Profpatsch/jbovlaste-sqlite): add XML parser
nice. Change-Id: Iea90578742bfb689cd0508dbaf641c31aed577ad Reviewed-on: https://cl.tvl.fyi/c/depot/+/8709 Tested-by: BuildkiteCI Autosubmit: Profpatsch <mail@profpatsch.de> Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
parent
c2baefbecc
commit
9a91669ba7
4 changed files with 299 additions and 22 deletions
|
@ -32,6 +32,15 @@ newtype Parse from to
|
|||
((,) [Text])
|
||||
)
|
||||
|
||||
instance Semigroupoid Parse where
|
||||
o p2 p1 = Parse $ \from -> case runParse' p1 from of
|
||||
Failure err -> Failure err
|
||||
Success to1 -> runParse' p2 to1
|
||||
|
||||
instance Category Parse where
|
||||
(.) = Semigroupoid.o
|
||||
id = Parse $ \t -> Success t
|
||||
|
||||
runParse :: Error -> Parse from to -> from -> Either ErrorTree to
|
||||
runParse errMsg parser t =
|
||||
(["$"], t)
|
||||
|
@ -43,15 +52,6 @@ runParse errMsg parser t =
|
|||
runParse' :: Parse from to -> ([Text], from) -> Validation (NonEmpty ErrorTree) ([Text], to)
|
||||
runParse' (Parse f) from = f from
|
||||
|
||||
instance Semigroupoid Parse where
|
||||
o p2 p1 = Parse $ \from -> case runParse' p1 from of
|
||||
Failure err -> Failure err
|
||||
Success to1 -> runParse' p2 to1
|
||||
|
||||
instance Category Parse where
|
||||
(.) = Semigroupoid.o
|
||||
id = Parse $ \t -> Success t
|
||||
|
||||
parseEither :: (([Text], from) -> Either ErrorTree ([Text], to)) -> Parse from to
|
||||
parseEither f = Parse $ \from -> f from & eitherToListValidation
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue