From 9822c85709b3685efd83407c7244ee54c1ca7e2a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sat, 22 Jul 2017 13:47:08 -0400 Subject: [PATCH] :fire: assignAllFrom. --- src/Data/Syntax/Assignment.hs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index 5c089ba2f..44634d569 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -243,19 +243,6 @@ assignBy :: (Symbol grammar, Enum grammar, Eq grammar, Recursive ast, Foldable ( -> Either (Error grammar) a assignBy toNode assignment source = fmap fst . (>>= requireExhaustive toNode) . runAssignment source toNode assignment . makeState . pure -assignAllFrom :: (Symbol grammar, Enum grammar, Eq grammar, Recursive ast, Foldable (Base ast), HasCallStack) - => Source.Source - -> (forall x. Base ast x -> Node grammar) - -> Assignment ast grammar a - -> AssignmentState ast grammar - -> Either (Error grammar) (a, AssignmentState ast grammar) -assignAllFrom source toNode assignment state = do - (a, state) <- runAssignment source toNode assignment state - case stateNodes (dropAnonymous toNode state) of - [] -> Right (a, state) - node : _ -> let Node nodeSymbol _ (Info.Span spanStart _) = toNode (F.project node) in - Left $ fromMaybe (Error spanStart (UnexpectedSymbol [] nodeSymbol)) (stateError state) - -- | Run an assignment of nodes in a grammar onto terms in a syntax. runAssignment :: forall grammar a ast. (Symbol grammar, Enum grammar, Eq grammar, Recursive ast, Foldable (Base ast), HasCallStack) => Source.Source -- ^ The source for the parse tree.