summaryrefslogtreecommitdiff
path: root/old/stdlib.hs
blob: 6f7334fb30b5b230eaa140b022607cbccc92c799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Stdlib(stdlib) where

import AST
import Parser


stdlib :: Program
stdlib = fromRight $ parseProgram
    "(define not (x) (= x 0))\n\
    \(define id (x) x)\n\
    \(define nil (x) (= x '()))\n\
    \(define . (f g) (lambda (x) (f (g x))))\n"

fromRight :: Show a => Either a b -> b
fromRight (Right b) = b
fromRight (Left a) = error $ "fromRight on Left: " ++ show a