diff options
Diffstat (limited to 'src/Language/Fiddle/Ast/Internal/SyntaxTree.hs')
-rw-r--r-- | src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | 20 |
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) |