LambdaCalculator 0.1 → 0.2
raw patch · 2 files changed
+7/−4 lines, 2 files
Files
- LambdaCalculator.cabal +2/−2
- LambdaCalculator.hs +5/−2
LambdaCalculator.cabal view
@@ -1,5 +1,5 @@ name: LambdaCalculator-version: 0.1+version: 0.2 license: BSD3 license-file: LICENSE copyright: Tim Sheard@@ -11,7 +11,7 @@ stability: stable build-type: Simple cabal-version: >= 1.2-tested-with: GHC == 7.6.1+tested-with: GHC == 7.10.3 Executable LambdaCalculator Main-is: LambdaCalculator.hs
LambdaCalculator.hs view
@@ -66,13 +66,16 @@ church 0 s z = z church n s z = App s (church (n-1) s z) +parse1 :: Parser a -> String -> Either ParseError a parse1 x s = parse (whiteSpace >> x) "keyboard input" s +parse2 :: Parser Exp -> String -> Exp parse2 x s = case parse1 x s of- Right(ans) -> ans+ Right ans -> ans Left message -> error (show message) +pe :: String -> Exp pe = parse2 pExp ------------------------------------------------@@ -201,7 +204,7 @@ command str = case parse1 pCom str of Right(x) -> x- Left s -> Fail (show s)+ Left s -> Fail (show s) ------------------------------------------------------