summaryrefslogtreecommitdiff
path: root/src/Language/Fiddle/GenericTree.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/Fiddle/GenericTree.hs')
-rw-r--r--src/Language/Fiddle/GenericTree.hs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/Language/Fiddle/GenericTree.hs b/src/Language/Fiddle/GenericTree.hs
index 00824ed..46c0594 100644
--- a/src/Language/Fiddle/GenericTree.hs
+++ b/src/Language/Fiddle/GenericTree.hs
@@ -28,7 +28,12 @@ import Language.Fiddle.Types
import Text.Parsec.Pos
import Text.Printf (printf)
-type Context stage = (Show (NumberType stage), Typeable stage)
+type Context stage =
+ ( Show (NumberType stage),
+ Typeable stage,
+ ToGenericSyntaxTree (ImportType stage),
+ Typeable (ImportType stage)
+ )
data GenericSyntaxTree f a where
{- GenericSyntaxtTree with a name and children. -}
@@ -94,7 +99,7 @@ instance ToGenericSyntaxTreeValue Data.Text.Text where
type GenericContext t f a = (Traversable f, ToGenericSyntaxTree t, Typeable t, Typeable f, Typeable a)
-class ToGenericSyntaxTree (t :: (Type -> Type) -> Type -> Type) where
+class ToGenericSyntaxTree (t :: SynTreeKind) where
toGenericSyntaxTree :: (Traversable f, Typeable f, Typeable t, Typeable a) => t f a -> GenericSyntaxTree f a
default toGenericSyntaxTree ::
(GenericContext t f a, Generic (t f a), (GToGenericSyntaxTree (Rep (t f a)) f a)) =>
@@ -176,6 +181,20 @@ deriving instance (ToGenericSyntaxTree Identifier)
deriving instance (ToGenericSyntaxTree BodyType)
+deriving instance (ToGenericSyntaxTree Directive)
+
+deriving instance (ToGenericSyntaxTree DirectiveBody)
+
+deriving instance (ToGenericSyntaxTree DirectiveElement)
+
+deriving instance (ToGenericSyntaxTree DirectiveExpression)
+
+deriving instance (ToGenericSyntaxTree ImportList)
+
+deriving instance (ToGenericSyntaxTree ImportStatement)
+
+deriving instance (ToGenericSyntaxTree t, Typeable t) => (ToGenericSyntaxTree (Directed t))
+
deriving instance (Context stage) => (ToGenericSyntaxTree (FiddleUnit stage))
deriving instance (Context stage) => (ToGenericSyntaxTree (FiddleDecl stage))