summaryrefslogtreecommitdiff
path: root/src/Language/Fiddle/Ast/FileInterface.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-09-25 22:51:32 -0600
committerJosh Rahm <joshuarahm@gmail.com>2024-09-25 22:51:32 -0600
commit0274c964874801d7cbde8f13fa13e11ed7948660 (patch)
tree97d72203edc5f7c4f4ea073166a35d3191a4c06a /src/Language/Fiddle/Ast/FileInterface.hs
parentfffe42ce4861f53dd86113ab8320e4754f2c570c (diff)
downloadfiddle-0274c964874801d7cbde8f13fa13e11ed7948660.tar.gz
fiddle-0274c964874801d7cbde8f13fa13e11ed7948660.tar.bz2
fiddle-0274c964874801d7cbde8f13fa13e11ed7948660.zip
feat: Add AdvanceStage typeclass and refactor code to use it
Introduced the `AdvanceStage` typeclass, which provides a mechanism to transition AST elements between different compilation stages. This abstraction facilitates easier traversal and modification of the syntax tree as it progresses through various compilation phases.
Diffstat (limited to 'src/Language/Fiddle/Ast/FileInterface.hs')
-rw-r--r--src/Language/Fiddle/Ast/FileInterface.hs55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/Language/Fiddle/Ast/FileInterface.hs b/src/Language/Fiddle/Ast/FileInterface.hs
index d29fc9d..c1cfac8 100644
--- a/src/Language/Fiddle/Ast/FileInterface.hs
+++ b/src/Language/Fiddle/Ast/FileInterface.hs
@@ -6,28 +6,33 @@ module Language.Fiddle.Ast.FileInterface where
-- the import statements should supply an fdi (fiddle interface) file to speed
-- up subsequent compilations.
--- import Data.Text
---
--- data ObjectType = ObjectType
--- { objectTypeSize :: Word32
--- }
---
--- data Metatype
--- = Object
--- { objectLocation :: Word64,
--- objectType :: Text
--- }
--- | Type
--- { typeSizeBytes :: Word32
--- }
---
--- data Element a = Element
--- { elementFullyQualifiedSymbol :: Text,
--- elementDocumentation :: Maybe Text,
--- elementMetatype :: Metatype,
--- elementAnnotation :: a
--- }
---
--- data FileInterface a = FiddleInterface
--- { exportedElements :: [Element a]
--- }
+import Data.Text
+import Data.Word
+
+data ObjectType = ObjectType
+ { objectTypeSize :: Word32
+ }
+
+data Metatype
+ = Object
+ { objectLocation :: Word64,
+ objectType :: Text
+ }
+ | Type
+ { typeSizeBytes :: Word32
+ }
+
+data Element a = Element
+ { elementFullyQualifiedSymbol :: Text,
+ elementDocumentation :: Maybe Text,
+ elementMetatype :: Metatype,
+ elementAnnotation :: a
+ }
+
+data ResolvedImport a = ResolvedImport {
+ dependencies :: [String]
+}
+
+data FileInterface a = FiddleInterface
+ { exportedElements :: [Element a]
+ }