1
1
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:
Rob Rix 2018-05-11 16:58:35 -04:00
parent 010a101de2
commit f4eb1bbc2b

View File

@ -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