From: Samir Benmendil Date: Sat, 20 Jan 2018 22:12:51 +0000 (+0000) Subject: `deriving` from `Show` is a really easy way to print values X-Git-Url: https://git.rmz.io/my-scheme.git/commitdiff_plain/5988ad89d4dd34b63abf5512ce3308ed86ff279d?ds=inline `deriving` from `Show` is a really easy way to print values Probably only works for type that can already be shown. --- diff --git a/app/Main.hs b/app/Main.hs index 67ec8dd..01fd038 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -9,6 +9,7 @@ data LispVal = Atom String | Number Integer | String String | Bool Bool + deriving Show symbol :: Parser Char symbol = oneOf "!#$%&|*+-/:<=>?@^_~" @@ -46,7 +47,7 @@ parseExpr = parseString readExpr :: String -> String readExpr input = case parse parseExpr "lisp" input of Left err -> "No match: " ++ show err - Right val -> "Found value" + Right val -> "Found value: " ++ show val main :: IO () main = do