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

Copyright(C) 2015 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (eir@cis.upenn.edu)
Stabilityexperimental
Safe HaskellNone
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) 
Show (ArithOp ty) 
Pretty (ArithOp ty) 

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 LToken Source

A lexed token with location information attached

Constructors

L SourcePos Token 

Instances

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