syntactic-0.5: Generic abstract syntax, and utilities for embedded languages

Language.Syntactic.Features.Symbol

Description

Simple symbols

Sym provides a simple way to make syntactic symbols for prototyping. However, note that Sym is quite unsafe as it only uses String to distinguish between different symbols. Also, Sym has a very free type that allows any number of arguments.

Synopsis

Documentation

data Sym a whereSource

Constructors

Sym :: ConsType a => String -> ConsEval a -> Sym a 

sym0 :: (Typeable a, Sym :<: dom) => String -> a -> ASTF dom aSource

A zero-argument symbol

sym1 :: (Typeable a, Sym :<: dom) => String -> (a -> b) -> ASTF dom a -> ASTF dom bSource

A one-argument symbol

sym2 :: (Typeable a, Typeable b, Sym :<: dom) => String -> (a -> b -> c) -> ASTF dom a -> ASTF dom b -> ASTF dom cSource

A two-argument symbol

sym3 :: (Typeable a, Typeable b, Typeable c, Sym :<: dom) => String -> (a -> b -> c -> d) -> ASTF dom a -> ASTF dom b -> ASTF dom c -> ASTF dom dSource

A three-argument symbol

sym4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Sym :<: dom) => String -> (a -> b -> c -> d -> e) -> ASTF dom a -> ASTF dom b -> ASTF dom c -> ASTF dom d -> ASTF dom eSource

A four-argument symbol

class IsSymbol expr whereSource

Class of expressions that can be treated as symbols

Methods

toSym :: expr a -> Sym aSource

Instances

IsSymbol (Select ctx) 
IsSymbol (Tuple ctx) 

exprEqFunc :: IsSymbol expr => expr a -> expr b -> BoolSource

Default implementation of exprEq

exprHashFunc :: IsSymbol expr => expr a -> HashSource

Default implementation of exprHash

renderPartFunc :: IsSymbol expr => [String] -> expr a -> StringSource

Default implementation of renderPart

evaluateFunc :: IsSymbol expr => expr a -> aSource

Default implementation of evaluate