hint 0.3.2.1 → 0.3.2.2
raw patch · 4 files changed
+16/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Changes +4/−0
- hint.cabal +1/−1
- src/Hint/Eval.hs +3/−3
- unit-tests/run-unit-tests.hs +8/−1
Changes view
@@ -1,3 +1,7 @@+-ver 0.3.2.2+ * Fixed a bug that would make expressions using heavy use of the layout+ rule to fail to be interpreted (see parens)+ - ver 0.3.2.1 * hint.cabal includes version bounds for package ghc-mtl. This is to avoid the accidental selection of the completely unrelated ghc-mtl
hint.cabal view
@@ -1,5 +1,5 @@ name: hint-version: 0.3.2.1+version: 0.3.2.2 description: This library defines an @Interpreter@ monad. It allows to load Haskell modules, browse them, type-check and evaluate strings with Haskell
src/Hint/Eval.hs view
@@ -56,15 +56,15 @@ let show_expr = unwords [in_scope_show, parens expr] unsafeInterpret show_expr in_scope_String --- | Conceptually, @parens s = \"(\" ++ s ++ \")\"@, where s is some valid haskell+-- | Conceptually, @parens s = \"(\" ++ s ++ \")\"@, where s is any valid haskell -- expression. In practice, it is harder than this. -- Observe that if @s@ ends with a trailing comment, then @parens s@ would -- be a malformed expression. The straightforward solution for this is to -- put the closing parenthesis in a different line. However, now we are -- messing with the layout rules and we don't know where @s@ is going to -- be used!--- Solution: @parens s = \"(let {foo = \" ++ s ++ \"\\n ;} in foo)\"@ where @foo@ does not occur in @s@+-- Solution: @parens s = \"(let {foo =\n\" ++ s ++ \"\\n ;} in foo)\"@ where @foo@ does not occur in @s@ parens :: String -> String-parens s = concat ["(let {", foo, " = ", s, "\n",+parens s = concat ["(let {", foo, " =\n", s, "\n", " ;} in ", foo, ")"] where foo = safeBndFor s
unit-tests/run-unit-tests.hs view
@@ -108,6 +108,13 @@ test_basic_eval = TestCase "basic_eval" [] $ do eval "()" @@?= "()" +test_eval_layout :: TestCase+test_eval_layout = TestCase "eval_layout" [] $ do+ eval layout_expr @@?= "10"+ where layout_expr = unlines $ ["let x = let y = 10",+ " in y",+ "in x"]+ test_show_in_scope :: TestCase test_show_in_scope = TestCase "show_in_scope" [] $ do setImports ["Prelude"]@@ -188,7 +195,6 @@ return $! s - tests :: [TestCase] tests = [test_reload_modified, test_lang_exts,@@ -196,6 +202,7 @@ test_comments_in_expr, test_qual_import, test_basic_eval,+ test_eval_layout, test_show_in_scope, test_installed_not_in_scope, test_priv_syms_in_scope,