unlambda 0.1.2 → 0.1.3
raw patch · 3 files changed
+14/−4 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- Language/Unlambda.hs +7/−1
- Main.hs +6/−2
- unlambda.cabal +1/−1
Language/Unlambda.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP, ScopedTypeVariables #-} {- Uses pattern guards @@ -24,6 +25,11 @@ module Language.Unlambda where +#if !MIN_VERSION_base(4,6,0)+import Prelude hiding(catch)+#endif+import Control.Exception (catch, IOException)+ ------------------------------------------------------------------------ -- Abstract syntax @@ -131,7 +137,7 @@ apply (Dot c) x = step >> io (putChar c) >> return x apply E x = exit x apply At f = do- dat <- io $ catch (fmap Just getChar) (const $ return Nothing)+ dat <- io $ catch (fmap Just getChar) (\(_ :: IOException) -> return Nothing) setCurrentChar dat apply f (case dat of Nothing -> V ; Just _ -> I) apply (Ques c) f = do
Main.hs view
@@ -1,9 +1,13 @@-{-# LANGUAGE PatternGuards #-}+{-# LANGUAGE CPP, PatternGuards, ScopedTypeVariables #-} module Main where -- A time- and output-limited unlambda +#if !MIN_VERSION_base(4,6,0)+import Prelude hiding(catch)+#endif+import Control.Exception (catch, IOException) import System.Posix.Resource import Data.Char (toLower) import System.IO (hGetChar, hGetLine, stdin, Handle())@@ -28,7 +32,7 @@ -- parse :: Handle -> IO Exp parse h = do- c <- catch (hGetChar h) (\_ -> error "Parse error at end of file")+ c <- catch (hGetChar h) (\(_ :: IOException) -> error "Parse error at end of file") case toLower c of d | d `elem` " \t\n" -> parse h '`' -> do e1 <- parse h
unlambda.cabal view
@@ -1,5 +1,5 @@ name: unlambda-version: 0.1.2+version: 0.1.3 license: GPL license-file: LICENSE