Hets - the Heterogeneous Tool Set

Copyright(c) Christian Maeder and Uni Bremen 2003-2005
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerChristian.Maeder@dfki.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe

HasCASL.AsUtils

Description

utility functions and computations of meaningful positions for various data types of the abstract syntax

Synopsis

Documentation

typeUniverseS :: String Source #

the string for the universe type

universeId :: Id Source #

the id of the universe type

universe :: Kind Source #

the type universe

universeWithRange :: Range -> Kind Source #

the type universe

unitTypeS :: String Source #

the name for the Unit type

unitTypeId :: Id Source #

the identifier for the Unit type

redStep :: Type -> Maybe Type Source #

single step beta reduce type abstractions

getTypeAppl :: Type -> (Type, [Type]) Source #

get top-level type constructor and its arguments and beta reduce

getTypeApplAux :: Bool -> Type -> (Type, [Type]) Source #

get top-level type constructor and its arguments and beta reduce if True

data Arrow Source #

the builtin function arrows

Instances

Eq Arrow Source # 

Methods

(==) :: Arrow -> Arrow -> Bool

(/=) :: Arrow -> Arrow -> Bool

Ord Arrow Source # 

Methods

compare :: Arrow -> Arrow -> Ordering

(<) :: Arrow -> Arrow -> Bool

(<=) :: Arrow -> Arrow -> Bool

(>) :: Arrow -> Arrow -> Bool

(>=) :: Arrow -> Arrow -> Bool

max :: Arrow -> Arrow -> Arrow

min :: Arrow -> Arrow -> Arrow

Show Arrow Source # 

Methods

showsPrec :: Int -> Arrow -> ShowS

show :: Arrow -> String

showList :: [Arrow] -> ShowS

arrowId :: Arrow -> Id Source #

construct an infix identifier for a function arrow

isArrow :: Id -> Bool Source #

test for a function identifier

isPartialArrow :: Id -> Bool Source #

test for a partial function identifier

productId :: Int -> Range -> Id Source #

construct a mixfix product identifier with n places

isProductId :: Id -> Bool Source #

test for a product identifier

isProductIdWithArgs :: Id -> Int -> Bool Source #

test for a product identifier

mapKindV :: (Variance -> Variance) -> (a -> b) -> AnyKind a -> AnyKind b Source #

map a kind and its variance

mapKind :: (a -> b) -> AnyKind a -> AnyKind b Source #

map a kind and keep variance the same

nonVarRawKind :: RawKind -> RawKind Source #

ignore variances of raw kinds

toRaw :: Kind -> RawKind Source #

compute raw kind (if class ids or no higher kinds)

rStar :: RawKind Source #

the type universe as raw kind

unitType :: Type Source #

the Unit type (name)

unitTypeWithRange :: Range -> Type Source #

the Unit type (name)

lazyTypeId :: Id Source #

the prefix name for lazy types

coKind :: Kind Source #

the kind of the lazy type constructor

lazyTypeConstr :: Type Source #

the lazy type constructor

mkLazyType :: Type -> Type Source #

make a type lazy

mkFunArrType :: Type -> Arrow -> Type -> Type Source #

function type

mkProductType :: [Type] -> Type Source #

construct a product type

mkProductTypeWithRange :: [Type] -> Range -> Type Source #

construct a product type

simpleTypeScheme :: Type -> TypeScheme Source #

convert a type with unbound variables to a scheme

predType :: Range -> Type -> Type Source #

add the unit type as result type or convert a parsed empty tuple to the unit type

predTypeScheme :: Range -> TypeScheme -> TypeScheme Source #

change the type of the scheme to a predType

unPredType :: Type -> (Bool, Type) Source #

check for and remove predicate arrow

isPredType :: Type -> Bool Source #

test if type is a predicate type

unPredTypeScheme :: TypeScheme -> TypeScheme Source #

remove predicate arrow in a type scheme

funKind :: Kind Source #

the kind of the function type

mkFunKind :: Range -> [(Variance, AnyKind a)] -> AnyKind a -> AnyKind a Source #

construct higher order kind from arguments and result kind

prodKind1 :: Int -> Range -> Kind -> Kind Source #

the Kind of the product type

prodKind :: Int -> Range -> Kind Source #

toType :: Id -> Type Source #

a type name with a universe kind

toFunType :: Arrow -> Type Source #

the type name for a function arrow

toProdType :: Int -> Range -> Type Source #

the type name for a function arrow

mkBracketToken :: BracketKind -> Range -> [Token] Source #

the brackets as tokens with positions

mkTupleTerm :: [Term] -> Range -> Term Source #

construct a tuple from non-singleton lists

getTupleArgs :: Term -> Maybe [Term] Source #

try to extract tuple arguments

getAppl :: Term -> Maybe (Id, TypeScheme, [Term]) Source #

decompose an ApplTerm into an application of an operation and a list of arguments

splitVars :: [GenVarDecl] -> ([VarDecl], [TypeArg]) Source #

split the list of generic variables into values and type variables

extractVars :: Term -> [VarDecl] Source #

extract bindings from an analysed pattern

mkOpTerm :: Id -> TypeScheme -> Term Source #

construct term from id

mkForall :: [GenVarDecl] -> Term -> Term Source #

bind a term

mkApplTerm :: Term -> [Term] -> Term Source #

construct application with curried arguments

addPartiality :: [a] -> Type -> Type Source #

make function arrow partial after some arguments

typeArgToType :: TypeArg -> Type Source #

convert a type argument to a type

patToType :: Id -> [TypeArg] -> RawKind -> Type Source #

convert a parameterized type identifier with a result raw kind to a type application

typeArgsListToRawKind :: [TypeArg] -> RawKind -> RawKind Source #

create the (raw if True) kind from type arguments

typeArgsListToKind :: [TypeArg] -> Kind -> Kind Source #

create the kind from type arguments

getFunType :: Type -> Partiality -> [Type] -> Type Source #

get the type of a constructor with given curried argument types

getSelType :: Type -> Partiality -> Type -> Type Source #

get the type of a selector given the data type as first arguemnt

nonVarTypeArg :: TypeArg -> TypeArg Source #

make type argument non-variant

getTypeVar :: TypeArg -> Id Source #

get the type variable

mkTypeAppl :: Type -> [Type] -> Type Source #

construct application left-associative

toKind :: VarKind -> Kind Source #

get the kind of an analyzed type variable

reparseAsId :: Pretty a => a -> Maybe Id Source #

try to reparse the pretty printed input as an identifier

expected :: Pretty a => a -> a -> String Source #

generate a comparison string