feat(users/Profpatsch/whatcd-resolver): start checking musicbrainz

Ideally we can figure out how to search for single songs by grepping
through musicbrainz. For this we kinda need the jsonld results, so
this is a first step which visualizes the structure and makes it
easy-ish to lazily traverse it.

Change-Id: Ieca21674dee8e8c2dacbab4f2f15ccbe067da647
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9743
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
This commit is contained in:
Profpatsch 2023-10-16 00:48:45 +02:00 committed by clbot
parent df43454dc5
commit 81b790af1d
3 changed files with 232 additions and 22 deletions

View file

@ -67,6 +67,16 @@ showContext (Context context) = context & fromMaybe [] & List.reverse & Text.int
addContext :: Text -> Context -> Context
addContext x (Context mxs) = Context (Just $ x : (mxs & fromMaybe []))
mkParsePushContext :: Text -> ((Context, from) -> Either ErrorTree to) -> Parse from to
mkParsePushContext toPush f = Parse $ \(ctx, from) -> case f (ctx, from) of
Right to -> Success (addContext toPush ctx, to)
Left err -> Failure $ singleton err
mkParseNoContext :: (from -> Either ErrorTree to) -> Parse from to
mkParseNoContext f = Parse $ \(ctx, from) -> case f from of
Right to -> Success (ctx, to)
Left err -> Failure $ singleton err
-- | Accept only exactly the given value
exactly :: (Eq from) => (from -> Text) -> from -> Parse from from
exactly errDisplay from = Parse $ \(ctx, from') ->