glambda-1.0.2: A simply typed lambda calculus interpreter, written with GADTs

Copyright(C) 2015 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (rae@cs.brynmawr.edu)
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Language.Glambda.Token

Contents

Description

Defines a lexical token

Synopsis

Arithmetic operators

data ArithOp ty where Source #

An ArithOp ty is an operator on numbers that produces a result of type ty

Instances

Eq (ArithOp ty) Source # 

Methods

(==) :: ArithOp ty -> ArithOp ty -> Bool #

(/=) :: ArithOp ty -> ArithOp ty -> Bool #

Show (ArithOp ty) Source # 

Methods

showsPrec :: Int -> ArithOp ty -> ShowS #

show :: ArithOp ty -> String #

showList :: [ArithOp ty] -> ShowS #

Pretty (ArithOp ty) Source # 

Methods

pretty :: ArithOp ty -> Doc #

prettyList :: [ArithOp ty] -> Doc #

data UArithOp where Source #

UArithOp ("unchecked ArithOp") is an existential package for an ArithOp

Constructors

UArithOp :: ITy ty => ArithOp ty -> UArithOp 

eqArithOp :: ArithOp ty1 -> ArithOp ty2 -> Bool Source #

Compare two ArithOps (potentially of different types) for equality

Unchecked synonyms for arithmetic operators

Tokens

data Token Source #

A lexed token

Instances

data LToken Source #

A lexed token with location information attached

Constructors

L SourcePos Token 

unLoc :: LToken -> Token Source #

Remove location information from an LToken

unArithOp :: Token -> Maybe UArithOp Source #

Perhaps extract a UArithOp

unInt :: Token -> Maybe Int Source #

Perhaps extract an Int

unBool :: Token -> Maybe Bool Source #

Perhaps extract an Bool

unName :: Token -> Maybe String Source #

Perhaps extract a String