mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
add contents to Token
This commit is contained in:
parent
3e25491053
commit
10a11b41ad
@ -1 +1,17 @@
|
|||||||
module Token () where
|
{-# 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)
|
Loading…
Reference in New Issue
Block a user