husk-scheme-2.4: R5RS Scheme interpreter program and library.

Language.Scheme.Types

Synopsis

Documentation

data Env Source

A Scheme environment containing variable bindings of form (namespaceName, variableName), variableValue

Constructors

Environment 

nullEnv :: IO EnvSource

An empty environment

data LispError Source

Types of errors that may occur when evaluating Scheme code

Constructors

NumArgs Integer [LispVal]

Invalid number of function arguments

TypeMismatch String LispVal

Type error

Parser ParseError

Parsing error

BadSpecialForm String LispVal

Invalid special (built-in) form

NotFunction String String 
UnboundVar String String 
DivideByZero

Divide by Zero error

NotImplemented String 
InternalError String

An internal error within husk; in theory user (Scheme) code should never allow one of these errors to be triggered.

Default String

Default error

showError :: LispError -> StringSource

Create a textual description for a LispError

data LispVal Source

Scheme data types

Constructors

Atom String

Symbol

List [LispVal]

List

DottedList [LispVal] LispVal

Pair

Vector (Array Int LispVal)

Vector

HashTable (Map LispVal LispVal)

Hash table. Technically this could be a derived data type instead of being built-in to the interpreter. And perhaps in the future it will be. But for now, a hash table is too important of a data type to not be included.

Map is technically the wrong structure to use for a hash table since it is based on a binary tree and hence operations tend to be O(log n) instead of O(1). However, according to http://www.opensubscriber.com/message/haskell-cafe@haskell.org/10779624.html Map has good performance characteristics compared to the alternatives. So it stays for the moment...

Number Integer

Integer

Float Double

Floating point

Complex (Complex Double)

Complex number

Rational Rational

Rational number

String String

String

Char Char

Character

Bool Bool

Boolean

PrimitiveFunc ([LispVal] -> ThrowsError LispVal)

Primitive function

Func

Function

Fields

params :: [String]
 
vararg :: Maybe String
 
body :: [LispVal]
 
closure :: Env
 
IOFunc ([LispVal] -> IOThrowsError LispVal)

Primitive function within the IO monad

EvalFunc ([LispVal] -> IOThrowsError LispVal)

Function within the IO monad with access to the current environment and continuation.

Port Handle

I/O port

Continuation

Continuation

EOF 
Nil String

Internal use only; do not use this type directly.

Instances

Eq LispVal 
Ord LispVal 
Show LispVal

Allow conversion of lispval instances to strings

data DeferredCode Source

Container to hold code that is passed to a continuation for deferred execution

Constructors

SchemeBody [LispVal]

A block of Scheme code

HaskellBody

A Haskell function

data DynamicWinders Source

Container to store information from a dynamic-wind

Constructors

DynamicWinders 

Fields

before :: LispVal

Function to execute when resuming continuation within extent of dynamic-wind

after :: LispVal

Function to execute when leaving extent of dynamic-wind

Instances

eqv :: [LispVal] -> ThrowsError LispValSource

Compare two LispVal instances

showVal :: LispVal -> StringSource

Create a textual description of a LispVal