Commit 2fb53d59 authored by simonpj's avatar simonpj
Browse files

[project @ 2002-06-07 16:26:58 by simonpj]

Use let syntax instead of with for implicit params
parent 248ef3d2
......@@ -7,8 +7,8 @@ module Main where
foo :: ((?x :: Int) => IO a) -> Int -> IO a
-- Note the rank2 type
foo s z = do s with ?x = z
s with ?x = z+3
foo s z = do let ?x = z in s
let ?x = z+3 in s
main = foo (print ?x) 42
......@@ -10,11 +10,12 @@ module Main where
f :: (?x :: Int) => ((?x :: Int) => Int) -> Int -> Int
f g y = if y == 0
then g
else (f g (y - 1) with ?x = ?x + 1)
else let ?x = ?x + 1
in f g (y - 1)
h :: (?x :: Int) => Int
h = ?x
main = print (f h 10 with ?x = 0)
main = print (let ?x = 0 in f h 10)
-- The result should be 10!
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment