mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Define a helper to abstract over operations on SomeTerm.
This commit is contained in:
parent
010a101de2
commit
f4eb1bbc2b
@ -3,6 +3,7 @@ module Parsing.Parser
|
|||||||
( Parser(..)
|
( Parser(..)
|
||||||
, SomeParser(..)
|
, SomeParser(..)
|
||||||
, SomeTerm(..)
|
, SomeTerm(..)
|
||||||
|
, withSomeTerm
|
||||||
, SomeAnalysisParser(..)
|
, SomeAnalysisParser(..)
|
||||||
, SomeASTParser(..)
|
, SomeASTParser(..)
|
||||||
, someParser
|
, someParser
|
||||||
@ -155,6 +156,9 @@ markdownParser = AssignmentParser MarkdownParser Markdown.assignment
|
|||||||
data SomeTerm typeclasses ann where
|
data SomeTerm typeclasses ann where
|
||||||
SomeTerm :: ApplyAll typeclasses syntax => Term syntax ann -> SomeTerm typeclasses ann
|
SomeTerm :: ApplyAll typeclasses syntax => Term syntax ann -> SomeTerm typeclasses ann
|
||||||
|
|
||||||
|
withSomeTerm :: (forall syntax . ApplyAll typeclasses syntax => Term syntax ann -> a) -> SomeTerm typeclasses ann -> a
|
||||||
|
withSomeTerm with (SomeTerm term) = with term
|
||||||
|
|
||||||
|
|
||||||
-- | A parser for producing specialized (tree-sitter) ASTs.
|
-- | A parser for producing specialized (tree-sitter) ASTs.
|
||||||
data SomeASTParser where
|
data SomeASTParser where
|
||||||
|
Loading…
Reference in New Issue
Block a user