- Various babel extensions
I tried to model the “core” with an open variant
-- x is additions to Expression -- s is additions to Statement -- p is additions to Pattern newtype Statement (x :: # Type) (s :: # Type) (p :: # Type) = Statement (Variant ( "ExpressionStatement" :: ExpressionStatement x s p , "BlockStatement" :: BlockStatement x s p , "EmptyStatement" :: Node () , "DebuggerStatement" :: Node () , "WithStatement" :: WithStatement x s p , "ReturnStatement" :: ReturnStatement x s p , "LabeledStatement" :: LabeledStatement x s p , "BreakStatement" :: BreakStatement , "ContinueStatement" :: ContinueStatement , "IfStatement" :: IfStatement x s p , "ThrowStatement" :: ThrowStatement x s p , "WhileStatement" :: WhileStatement x s p , "DoWhileStatement" :: DoWhileStatement x s p , "ForStatement" :: ForStatement x s p , "FunctionDeclaration" :: FunctionDeclaration x s p , "VariableDeclaration" :: VariableDeclaration x s p | s ))
but then I literally don’t know how to populate those variables with anything other than
Is this a bad approach? Is this a solved problem?
Any help is appreciated.