From 10a11b41adb2405dc4744ce2c52e21b20a09fb8f Mon Sep 17 00:00:00 2001 From: Ayman Nadeem Date: Mon, 27 Jan 2020 19:21:48 -0500 Subject: [PATCH] add contents to Token --- semantic-ast/src/AST/Token.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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