diff options
Diffstat (limited to 'src/Language/Fiddle/Ast/Internal')
-rw-r--r-- | src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs index f627f15..9566ab5 100644 --- a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs +++ b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs @@ -17,7 +17,6 @@ module Language.Fiddle.Ast.Internal.SyntaxTree BitsOffset, -- Witness Types Witness (..), - WitnessType, -- AST Types Name (..), Directive (..), @@ -60,7 +59,6 @@ import Data.List.NonEmpty hiding (map) import Data.Text (Text) import Data.Type.Bool import Data.Typeable -import Data.Void (Void) import Data.Word (Word32) import GHC.Generics import Language.Fiddle.Ast.Internal.Instances @@ -107,22 +105,12 @@ type family NumberType (a :: Stage) :: Type where type family ImportInterface (stage :: Stage) :: Type where ImportInterface s = If (s < ImportsResolved) () UnitInterface --- | A way to disable or enable a subtree type based on a type-level boolean. +-- | A type which is only constructible if the type-level condition 's' holds. -- --- This is used over GADT's specific parameterization to allow for deriving --- generics and reduce boilerplate. --- --- This is a wrapper type to allow defining instances. +-- This type is used as a way to enable/disable parts of the syntax tree based +-- on type level booleans (typically incorporating the compilation 'stage') data Witness (s :: Bool) where - Witness :: (WitnessType s) -> Witness s - --- | If the type level expression is true, the witness type is the Unit type, if --- it is false, the witness type is Void, thus making whatever it touches --- uninhabitable. This is how parts of the AST is enabled or disabled during --- compilation. -type family WitnessType (s :: Bool) where - WitnessType True = () - WitnessType False = Void + Witness :: Witness True -- A Name is multiple identifiers separated by dots. It's the way of namespaces -- to different packages. |