summaryrefslogtreecommitdiff
path: root/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-10-03 17:14:46 -0600
committerJosh Rahm <joshuarahm@gmail.com>2024-10-03 17:14:46 -0600
commit72eeba5fd6178409b4aab5eb8dbfaf4460f6841c (patch)
treeabbadf258331b38a9d7c4e04b925cef4e3f94a1d /src/Language/Fiddle/Ast/Internal/SyntaxTree.hs
parent5d0b8e6371d1e365ff9b10e0160a39f0f1d9f359 (diff)
downloadfiddle-72eeba5fd6178409b4aab5eb8dbfaf4460f6841c.tar.gz
fiddle-72eeba5fd6178409b4aab5eb8dbfaf4460f6841c.tar.bz2
fiddle-72eeba5fd6178409b4aab5eb8dbfaf4460f6841c.zip
Wip: added -Wall
Diffstat (limited to 'src/Language/Fiddle/Ast/Internal/SyntaxTree.hs')
-rw-r--r--src/Language/Fiddle/Ast/Internal/SyntaxTree.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs
index 9c6718c..6aa0793 100644
--- a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs
+++ b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs
@@ -43,7 +43,6 @@ module Language.Fiddle.Ast.Internal.SyntaxTree
EnumBody (..),
EnumConstantDecl (..),
PackageBody (..),
- TreeType (..),
-- Helper Functions
mapDirected,
mapDirectedM,
@@ -51,6 +50,7 @@ module Language.Fiddle.Ast.Internal.SyntaxTree
undirected,
-- Utility Functions
squeeze,
+ nameToList,
)
where
@@ -58,7 +58,7 @@ import Control.Monad (forM_)
import Data.Coerce
import Data.Functor.Identity
import Data.Kind (Type)
-import Data.List.NonEmpty
+import Data.List.NonEmpty hiding (map)
import Data.Proxy
import Data.Text (Text)
import Data.Traversable
@@ -73,14 +73,19 @@ import Language.Fiddle.Ast.Internal.Instances
import Language.Fiddle.Ast.Internal.Kinds
import Language.Fiddle.Ast.Internal.Stage
import Language.Fiddle.Internal.UnitInterface (UnitInterface)
+import qualified Data.Text as Text
-type TreeType t stage = t stage (StageFunctor stage) (StageAnnotation stage)
-
-type FullyQualifiedName = String
+-- | Common data for each qualified element.
+newtype CommonQualifcationData
+ = CommonQualifcationData
+ { -- The fully qualified path to this qualified element.
+ fullyQualifiedPath :: [String]
+ }
+ deriving (Eq, Ord, Show)
type family QualificationMetadata stage t where
QualificationMetadata stage t =
- If (stage < Qualified) () t
+ If (stage < Qualified) () (CommonQualifcationData, t)
-- | The type attached to import statements which describe the imported file's
-- unit interface
@@ -718,3 +723,6 @@ data PackageBody (stage :: Stage) (f :: Type -> Type) a where
squeeze :: (Alter t, Traversable f, Monad f) => t f a -> f (t Identity a)
squeeze = alter (fmap Identity) return
+
+nameToList :: Name f a -> [String]
+nameToList (Name ids _) = map (Text.unpack . identifierName) (toList ids)