blob: 266e01d9c0832910e6e138ab790757b4cb97e72f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
{-# LANGUAGE ImplicitParams, RankNTypes #-}
-- GHC 5.02 got this one wrong.
module Main where
-- Implicit parameters bug
-- mbs@cse.ogi.edu 24-Oct-2001 22:21:27
f :: (?x :: Int) => ((?x :: Int) => Int) -> Int -> Int
f g y = if y == 0
then g
else let ?x = ?x + 1
in f g (y - 1)
h :: (?x :: Int) => Int
h = ?x
main = print (let ?x = 0 in f h 10)
-- The result should be 10!
|