husk-scheme-3.6: R5RS Scheme interpreter, compiler, and library.

CopyrightJustin Ethier
LicenseMIT (see LICENSE in the distribution)
Maintainergithub.com/justinethier
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

Language.Scheme.Core

Contents

Description

This module contains Core functionality, primarily Scheme expression evaluation.

Synopsis

Scheme code evaluation

evalLisp :: Env -> LispVal -> IOThrowsError LispVal Source

Evaluate lisp code that has already been loaded into haskell

evalString :: Env -> String -> IO String Source

Evaluate a string containing Scheme code.

For example:

env <- primitiveBindings

evalString env "(+ x x x)"
"3"

evalString env "(+ x x x (* 3 9))"
"30"

evalString env "(* 3 9)"
"27"

evalAndPrint :: Env -> String -> IO () Source

Evaluate a string and print results to console

apply :: LispVal -> LispVal -> [LispVal] -> IOThrowsError LispVal Source

Call into a Scheme function

continueEval Source

Arguments

:: Env

Current environment

-> LispVal

Current continuation

-> LispVal

Value of previous computation

-> IOThrowsError LispVal

Final value of computation

A support function for eval; eval calls into this function instead of returning values directly. continueEval then uses the continuation argument to manage program control flow.

Core data

primitiveBindings :: IO Env Source

Environment containing the primitive forms that are built into the Scheme language. Note that this only includes forms that are implemented in Haskell; derived forms implemented in Scheme (such as let, list, etc) are available in the standard library which must be pulled into the environment using (load).

version :: String Source

husk version number

Utility functions

escapeBackslashes :: String -> String Source

A utility function to escape backslashes in the given string

showBanner :: IO () Source

A utility function to display the husk console banner

substr :: (LispVal, LispVal, LispVal) -> IOThrowsError LispVal Source

A helper function for the special form (string-set!)

updateVector :: LispVal -> LispVal -> LispVal -> IOThrowsError LispVal Source

A helper function for the special form (vector-set!)