diff --git a/semantic-ast/src/AST/Token.hs b/semantic-ast/src/AST/Token.hs index 4725c3271..7d3aa3644 100644 --- a/semantic-ast/src/AST/Token.hs +++ b/semantic-ast/src/AST/Token.hs @@ -1 +1,17 @@ -module Token () where \ No newline at end of file +{-# LANGUAGE DataKinds, DeriveGeneric, DeriveTraversable, KindSignatures #-} +module AST.Token +( Token(..) +) where + +import GHC.Generics (Generic, Generic1) +import GHC.TypeLits (Symbol, Nat) + +-- | An AST node representing a token, indexed by its name and numeric value. +-- +-- For convenience, token types are typically used via type synonyms, e.g.: +-- +-- @ +-- type AnonymousPlus = Token "+" 123 +-- @ +newtype Token (symName :: Symbol) (symVal :: Nat) a = Token { ann :: a } + deriving (Eq, Foldable, Functor, Generic, Generic1, Ord, Show, Traversable) \ No newline at end of file