]> git.rmz.io Git - my-scheme.git/commitdiff
Add LispVal data type which can hold any Lisp value
authorSamir Benmendil <me@rmz.io>
Sat, 13 Jan 2018 23:40:49 +0000 (23:40 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 13 Jan 2018 23:40:49 +0000 (23:40 +0000)
LispVal is an algebraic type which is able to hold any of the types
given.

Not sure what the type of `DottedList` is meant to be.

app/Main.hs

index 852089135df8fa8b9ccef54f9699d95bc41d8df2..c64fd18d83b0cdf0575889388df8cfa6344619c8 100644 (file)
@@ -2,6 +2,13 @@ module Main where
 import Text.ParserCombinators.Parsec hiding (spaces)
 import System.Environment
 
+data LispVal = Atom String
+             | List [LispVal]
+             | DottedList [LispVal] LispVal
+             | Number Integer
+             | String String
+             | Bool Bool
+
 symbol :: Parser Char
 symbol = oneOf "!#$%&|*+-/:<=>?@^_~"