aboutsummaryrefslogtreecommitdiff
path: root/src/Error/Base.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Error/Base.hs')
-rw-r--r--src/Error/Base.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Error/Base.hs b/src/Error/Base.hs
index 509377b..d7b685c 100644
--- a/src/Error/Base.hs
+++ b/src/Error/Base.hs
@@ -12,7 +12,7 @@ import Text.ParserCombinators.Parsec
12 12
13data LispError = Parse ParseError 13data LispError = Parse ParseError
14 | BadForm String Expr 14 | BadForm String Expr
15 | ArgCount Int [Expr] 15 | ArgCount String Int [Expr]
16 | UnknownFunction String 16 | UnknownFunction String
17 | TypeMismatch String Expr 17 | TypeMismatch String Expr
18 18
@@ -22,7 +22,10 @@ unwordsList = unwords . map show
22instance Show LispError where 22instance Show LispError where
23 show (Parse e) = "Parser Error: " ++ show e 23 show (Parse e) = "Parser Error: " ++ show e
24 show (BadForm s expr) = "Bad Form: " ++ s ++ ": " ++ show expr 24 show (BadForm s expr) = "Bad Form: " ++ s ++ ": " ++ show expr
25 show (ArgCount n es) = "Invalid arity, expected " ++ show n ++ ", got value(s): " ++ unwordsList es 25 -- TODO: clean this up
26 show (ArgCount fn n es)
27 | null es = "Invalid arity, `" ++ fn ++ "` expects " ++ show n ++ " or more expression(s)!"
28 | otherwise = "Invalid arity, `" ++ fn ++ "` expects " ++ show n ++ " or more expression(s), got value(s): " ++ unwordsList es
26 show (UnknownFunction fn) = "Cannot apply function: " ++ fn 29 show (UnknownFunction fn) = "Cannot apply function: " ++ fn
27 show (TypeMismatch msg got) = "Type mismatch, expected " ++ msg ++ ", got: " ++ show got 30 show (TypeMismatch msg got) = "Type mismatch, expected " ++ msg ++ ", got: " ++ show got
28 31