From 0baa898f30514f00849057ffe2614d6dd36398d6 Mon Sep 17 00:00:00 2001 From: Basile Henry Date: Sat, 13 Jul 2019 17:52:45 +0100 Subject: [PATCH] Add tests for let/where interaction #177 --- data/examples/declaration/value/function/do-out.hs | 6 ++++++ data/examples/declaration/value/function/do.hs | 6 ++++++ .../declaration/value/function/let-single-line-out.hs | 1 + data/examples/declaration/value/function/let-single-line.hs | 1 + 4 files changed, 14 insertions(+) diff --git a/data/examples/declaration/value/function/do-out.hs b/data/examples/declaration/value/function/do-out.hs index 1275a19..22d468a 100644 --- a/data/examples/declaration/value/function/do-out.hs +++ b/data/examples/declaration/value/function/do-out.hs @@ -52,3 +52,9 @@ trickyLet = do foo let x = 5 in bar x + +-- single line let-where +samples n f = do + gen <- newQCGen + let rands g = g1 : rands g2 where (g1, g2) = split g + return $ rands gen diff --git a/data/examples/declaration/value/function/do.hs b/data/examples/declaration/value/function/do.hs index 31666ac..cadd360 100644 --- a/data/examples/declaration/value/function/do.hs +++ b/data/examples/declaration/value/function/do.hs @@ -51,3 +51,9 @@ trickyLet = do foo let x = 5 in bar x + +-- single line let-where +samples n f = do + gen <- newQCGen + let rands g = g1 : rands g2 where (g1, g2) = split g + return $ rands gen diff --git a/data/examples/declaration/value/function/let-single-line-out.hs b/data/examples/declaration/value/function/let-single-line-out.hs index 4af451e..9e4fd10 100644 --- a/data/examples/declaration/value/function/let-single-line-out.hs +++ b/data/examples/declaration/value/function/let-single-line-out.hs @@ -1,2 +1,3 @@ foo :: a -> a foo x = let x = x in x +foo x = let x = z where z = 2 in x diff --git a/data/examples/declaration/value/function/let-single-line.hs b/data/examples/declaration/value/function/let-single-line.hs index 4af451e..9e4fd10 100644 --- a/data/examples/declaration/value/function/let-single-line.hs +++ b/data/examples/declaration/value/function/let-single-line.hs @@ -1,2 +1,3 @@ foo :: a -> a foo x = let x = x in x +foo x = let x = z where z = 2 in x