From 1083bb7758a2dfe3f2861bf802627cec16933861 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Tue, 4 Nov 2025 08:10:46 +0100 Subject: Default REPL to Untyped language --- lambda-calcul/haskell/test/Minilang/REPLSpec.hs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lambda-calcul/haskell/test/Minilang/REPLSpec.hs') diff --git a/lambda-calcul/haskell/test/Minilang/REPLSpec.hs b/lambda-calcul/haskell/test/Minilang/REPLSpec.hs index 5469a59..cf6ef01 100644 --- a/lambda-calcul/haskell/test/Minilang/REPLSpec.hs +++ b/lambda-calcul/haskell/test/Minilang/REPLSpec.hs @@ -13,17 +13,17 @@ import Prelude hiding (lines, readFile, writeFile) spec :: Spec spec = parallel $ describe "MiniLang REPL" $ do - it "evaluates MiniLang terms read from pure Monad" $ do + it "evaluates untyped MiniLang terms read from pure Monad" $ do let out = withInput ["((lam (x) x) y)"] out `shouldBe` [ "Bye!", - "y : b" + "y : " ] - it "defaults to try to typecheck terms" $ do + it "defaults untyped terms" $ do let out = withInput [ "(let ((Succ (lam (n z s) (s n))) \ @@ -33,13 +33,13 @@ spec = parallel $ out `shouldBe` [ "Bye!", - "Cannot unify type variable f with type (e -> f -> e) -> e due to circularity: The variable already occurs in the type." + "(lam (z s) (s ((lam (n z s) (s n)) (lam (z s) z)))) : " ] - it "do not typecheck term when language is set to 'untyped'" $ do + it "do typecheck term when language is set to 'Typed'" $ do let out = withInput - [ ":lang Untyped", + [ ":lang Typed", "(let ((Succ (lam (n z s) (s n))) \ \ (Zero (lam (z s) z))) \ \ (Succ (Succ Zero)))" @@ -47,8 +47,8 @@ spec = parallel $ out `shouldBe` [ "Bye!", - "(lam (z s) (s ((lam (n z s) (s n)) (lam (z s) z)))) : ", - "Language set to Untyped" + "Cannot unify type variable f with type (e -> f -> e) -> e due to circularity: The variable already occurs in the type.", + "Language set to Typed" ] it "shows error when trying to load a non-existent file" $ do @@ -65,7 +65,7 @@ spec = parallel $ fileName "(let ((Succ (lam (n z s) (s n))) \ \ (Zero (lam (z s) z))) \ - \ Zero)" + \ (Succ Zero))" _ <- withFile fileName ReadMode $ \hin -> withFile outputFileName AppendMode $ \hout -> @@ -74,7 +74,7 @@ spec = parallel $ out <- readFile outputFileName out - `shouldBe` "\955\928> (lam (z s) z) : c -> d -> c\n\955\928> Bye!\n" + `shouldBe` "\955\928> (lam (z s) (s (lam (z s) z))) : \n\955\928> Bye!\n" withTempFile :: (String -> IO ()) -> IO () withTempFile = -- cgit v1.3.1