From 0961ef6728abea4f3926fbf34539f4a98583d0c7 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 20 Aug 2022 22:07:57 +0100 Subject: Refactor expectError We expect a specific error in a list of errors. Added case for call on non callable symbol. --- src/Error.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Error.hs') diff --git a/src/Error.hs b/src/Error.hs index 93c5bd4..724f57c 100644 --- a/src/Error.hs +++ b/src/Error.hs @@ -4,13 +4,14 @@ import Data.List (sort) import Text.Parsec (SourcePos, errorPos) import Text.Parsec.Error (ParseError, errorMessages, showErrorMessages) -data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined +data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined | NonCallable deriving (Show) instance Enum ErrorType where fromEnum GenericError = 0 fromEnum TypeError = 1 fromEnum UnexpectedReturn = 2 fromEnum AlreadyDefined = 3 + fromEnum NonCallable = 4 toEnum _ = error "toEnum is undefined for Error" data Error = Error ErrorType String SourcePos -- cgit v1.2.3