From 7433b7e6b16c0b2d8d215ceb00b615579e41e7f1 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 2 Oct 2019 15:16:35 -0400 Subject: [PATCH] =?UTF-8?q?:memo:=20parseWith=20&=20parsePairWith=E2=80=99?= =?UTF-8?q?s=20parameters.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Control/Effect/Parse.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Control/Effect/Parse.hs b/src/Control/Effect/Parse.hs index c16bae020..07be28411 100644 --- a/src/Control/Effect/Parse.hs +++ b/src/Control/Effect/Parse.hs @@ -40,9 +40,9 @@ parse parser blob = send (Parse parser blob pure) -- | Parse a 'Blob' with one of the provided parsers, and run an action on the abstracted term. parseWith :: (Carrier sig m, Member (Error SomeException) sig, Member Parse sig) - => Map.Map Language (SomeParser c ann) - -> (forall term . c term => term ann -> m a) - -> Blob + => Map.Map Language (SomeParser c ann) -- ^ The set of parsers to select from. + -> (forall term . c term => term ann -> m a) -- ^ A function to run on the parsed term. Note that the term is abstract, but constrained by @c@, allowing you to do anything @c@ allows, and requiring that all the input parsers produce terms supporting @c@. + -> Blob -- ^ The blob to parse. -> m a parseWith parsers with blob = case Map.lookup (blobLanguage blob) parsers of Just (SomeParser parser) -> parse parser blob >>= with @@ -51,9 +51,9 @@ parseWith parsers with blob = case Map.lookup (blobLanguage blob) parsers of -- | Parse a 'BlobPair' with one of the provided parsers, and run an action on the abstracted term pair. parsePairWith :: (Carrier sig m, Member (Error SomeException) sig, Member Parse sig) - => Map.Map Language (SomeParser c ann) - -> (forall term . c term => These (term ann) (term ann) -> m a) - -> BlobPair + => Map.Map Language (SomeParser c ann) -- ^ The set of parsers to select from. + -> (forall term . c term => These (term ann) (term ann) -> m a) -- ^ A function to run on the parsed terms. Note that the terms are abstract, but constrained by @c@, allowing you to do anything @c@ allows, and requiring that all the input parsers produce terms supporting @c@. + -> BlobPair -- ^ The blob pair to parse. -> m a parsePairWith parsers with blobPair = case Map.lookup (languageForBlobPair blobPair) parsers of Just (SomeParser parser) -> traverse (parse parser) blobPair >>= with . runJoin