License | GPL-3 |
---|---|
Maintainer | jaredforthdev@gmail.com |
Stability | experimental |
Safe Haskell | Safe |
- symbol :: Parser Char
- readExpr :: String -> ThrowsError LispVal
- readExprList :: String -> ThrowsError [LispVal]
- spaces :: Parser ()
- data LispVal
- parseString :: Parser LispVal
- parseAtom :: Parser LispVal
- parseNumber :: Parser LispVal
- parseList :: Parser LispVal
- parseDottedList :: Parser LispVal
- parseQuoted :: Parser LispVal
- parseExpr :: Parser LispVal
- type Env = IORef [(String, IORef LispVal)]
- nullEnv :: IO Env
- type IOThrowsError = ExceptT LispError IO
- liftThrows :: ThrowsError a -> IOThrowsError a
- runIOThrows :: IOThrowsError String -> IO String
- isBound :: Env -> String -> IO Bool
- getVar :: Env -> String -> IOThrowsError LispVal
- setVar :: Env -> String -> LispVal -> IOThrowsError LispVal
- defineVar :: Env -> String -> LispVal -> IOThrowsError LispVal
- data LispError
- = NumArgs Integer [LispVal]
- | TypeMismatch String LispVal
- | Parser ParseError
- | BadSpecialForm String LispVal
- | NotFunction String String
- | UnboundVar String String
- | Default String
- showError :: LispError -> String
- type ThrowsError = Either LispError
- trapError :: (Show a, MonadError a m) => m String -> m String
- extractValue :: ThrowsError a -> a
- readOrThrow :: Parser a -> String -> ThrowsError a
- makeFunc :: Monad m => Maybe String -> Env -> [LispVal] -> [LispVal] -> m LispVal
- makeNormalFunc :: Env -> [LispVal] -> [LispVal] -> ExceptT LispError IO LispVal
- makeVarArgs :: LispVal -> Env -> [LispVal] -> [LispVal] -> ExceptT LispError IO LispVal
- load :: String -> IOThrowsError [LispVal]
- apply :: LispVal -> [LispVal] -> IOThrowsError LispVal
- bindVars :: Env -> [(String, LispVal)] -> IO Env
- eval :: Env -> LispVal -> IOThrowsError LispVal
- showVal :: LispVal -> String
- unwordsList :: [LispVal] -> String
Documentation
readExpr :: String -> ThrowsError LispVal #
Define a function to call parser and handle errors
readExprList :: String -> ThrowsError [LispVal] #
A datatype that can hold any Lisp value
Atom String | |
List [LispVal] | |
DottedList [LispVal] LispVal | |
Number Integer | |
String String | |
Bool Bool | |
PrimitiveFunc ([LispVal] -> ThrowsError LispVal) | |
Func | |
IOFunc ([LispVal] -> IOThrowsError LispVal) | |
Port Handle |
parseString :: Parser LispVal #
Function for string parsing
Function for parsing an atom, which is is a letter or symbol, followed by any number of letters, digits, or symbols.
parseNumber :: Parser LispVal #
Function for parsing a number
parseDottedList :: Parser LispVal #
Function for parsing a dotted list
parseQuoted :: Parser LispVal #
Function for parsing a single-quoted value
Function for parsing an expression, which can be am atom, string, number, quoted, list, or dotted list.
type IOThrowsError = ExceptT LispError IO #
Error handling functionality on top of IO monad
liftThrows :: ThrowsError a -> IOThrowsError a #
Lift errors of upper type into monad See: https://wiki.haskell.org/All_About_Monads#Lifting
runIOThrows :: IOThrowsError String -> IO String #
Catch errors
getVar :: Env -> String -> IOThrowsError LispVal #
Retrieve current value of a variable
defineVar :: Env -> String -> LispVal -> IOThrowsError LispVal #
Define a new variable, regardless of if it is already bound
Define datatype to represent an error
NumArgs Integer [LispVal] | |
TypeMismatch String LispVal | |
Parser ParseError | |
BadSpecialForm String LispVal | |
NotFunction String String | |
UnboundVar String String | |
Default String |
type ThrowsError = Either LispError #
Type to represent functions that may throw an error or return a value
trapError :: (Show a, MonadError a m) => m String -> m String #
Helper function to convert error to string representation
extractValue :: ThrowsError a -> a #
Extract error value
readOrThrow :: Parser a -> String -> ThrowsError a #
makeFunc :: Monad m => Maybe String -> Env -> [LispVal] -> [LispVal] -> m LispVal #
Helper function to create a function
makeNormalFunc :: Env -> [LispVal] -> [LispVal] -> ExceptT LispError IO LispVal #
Specialization of makeFunc
for a normal function
makeVarArgs :: LispVal -> Env -> [LispVal] -> [LispVal] -> ExceptT LispError IO LispVal #
Specialization of makeFunc
for a variable argument
load :: String -> IOThrowsError [LispVal] #
Read and parse a file full of statements
eval :: Env -> LispVal -> IOThrowsError LispVal #
Create the evaluator. This maps a code
datatype to a 'data' datatype.
unwordsList :: [LispVal] -> String #
Helper function to glue a list of words together with spaces