Portability | portable |
---|---|
Stability | experimental |
Maintainer | github.com/justinethier |
Safe Haskell | Safe-Infered |
This module contains top-level data type definitions, environments, error types, and associated functions.
- data Env = Environment {}
- nullEnv :: IO Env
- macroNamespace :: [Char]
- varNamespace :: [Char]
- data LispError
- showError :: LispError -> String
- type ThrowsError = Either LispError
- trapError :: (MonadError e m, Show e) => m String -> m String
- extractValue :: ThrowsError a -> a
- type IOThrowsError = ErrorT LispError IO
- liftThrows :: ThrowsError a -> IOThrowsError a
- runIOThrowsREPL :: IOThrowsError String -> IO String
- runIOThrows :: IOThrowsError String -> IO (Maybe String)
- data LispVal
- = Atom String
- | List [LispVal]
- | DottedList [LispVal] LispVal
- | Vector (Array Int LispVal)
- | HashTable (Map LispVal LispVal)
- | Number Integer
- | Float Double
- | Complex (Complex Double)
- | Rational Rational
- | String String
- | Char Char
- | Bool Bool
- | PrimitiveFunc ([LispVal] -> ThrowsError LispVal)
- | Func { }
- | HFunc { }
- | IOFunc ([LispVal] -> IOThrowsError LispVal)
- | EvalFunc ([LispVal] -> IOThrowsError LispVal)
- | Port Handle
- | Continuation { }
- | Syntax {
- synClosure :: Maybe Env
- synRenameClosure :: Maybe Env
- synDefinedInMacro :: Bool
- synIdentifiers :: [LispVal]
- synRules :: [LispVal]
- | EOF
- | Nil String
- data DeferredCode
- = SchemeBody [LispVal]
- | HaskellBody {
- contFunction :: Env -> LispVal -> LispVal -> Maybe [LispVal] -> IOThrowsError LispVal
- contFunctionArgs :: Maybe [LispVal]
- data DynamicWinders = DynamicWinders {}
- showDWVal :: DynamicWinders -> String
- makeNullContinuation :: Env -> LispVal
- makeCPS :: Env -> LispVal -> (Env -> LispVal -> LispVal -> Maybe [LispVal] -> IOThrowsError LispVal) -> LispVal
- makeCPSWArgs :: Env -> LispVal -> (Env -> LispVal -> LispVal -> Maybe [LispVal] -> IOThrowsError LispVal) -> [LispVal] -> LispVal
- eqv :: [LispVal] -> ThrowsError LispVal
- eqvList :: ([LispVal] -> ThrowsError LispVal) -> [LispVal] -> ThrowsError LispVal
- eqVal :: LispVal -> LispVal -> Bool
- showVal :: LispVal -> String
- unwordsList :: [LispVal] -> String
Documentation
A Scheme environment containing variable bindings of form (namespaceName, variableName), variableValue
macroNamespace :: [Char]Source
varNamespace :: [Char]Source
Types of errors that may occur when evaluating Scheme code
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 |
type ThrowsError = Either LispErrorSource
extractValue :: ThrowsError a -> aSource
type IOThrowsError = ErrorT LispError IOSource
liftThrows :: ThrowsError a -> IOThrowsError aSource
runIOThrowsREPL :: IOThrowsError String -> IO StringSource
Execute an IO action and return result or an error message. This is intended for use by a REPL, where a result is always needed regardless of type.
runIOThrows :: IOThrowsError String -> IO (Maybe String)Source
Execute an IO action and return error or Nothing if no error was thrown.
Scheme data types
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. |
Number Integer | |
Float Double | |
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 |
HFunc | Function formed from a Haskell function |
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 |
| |
Syntax | Type to hold a syntax object that is created by a macro definition. Syntax objects are not used like regular types in that they are not passed around within variables. In other words, you cannot use set! to assign a variable to a syntax object. But they are used during function application. In any case, it is convenient to define the type here because syntax objects are stored in the same environments and manipulated by the same functions as regular variables. |
| |
EOF | |
Nil String | Internal use only; do not use this type directly. |
data DeferredCode Source
Container to hold code that is passed to a continuation for deferred execution
SchemeBody [LispVal] | A block of Scheme code |
HaskellBody | A Haskell function |
|
makeCPS :: Env -> LispVal -> (Env -> LispVal -> LispVal -> Maybe [LispVal] -> IOThrowsError LispVal) -> LispValSource
makeCPSWArgs :: Env -> LispVal -> (Env -> LispVal -> LispVal -> Maybe [LispVal] -> IOThrowsError LispVal) -> [LispVal] -> LispValSource
eqvList :: ([LispVal] -> ThrowsError LispVal) -> [LispVal] -> ThrowsError LispValSource
Compare two lists of haskell values, using the given comparison function
unwordsList :: [LispVal] -> StringSource
Convert a list of Lisp objects into a space-separated string