summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc127.hs
blob: 58ccca7a5e855fafd95532fdfce5c63753b1d551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{-# LANGUAGE ImplicitParams #-}

-- !!! Another implicit parameter test, from Alastair Reid

module ShouldCompile where

import Data.Maybe

type Env = ([(String,Int)],Int)

ident1 :: (?env :: Env) => String -> Int
ident1 x = y
 where
  env = ?env
  y   = fromJust (lookup x (fst env))

ident2 :: (?env :: Env) => String -> Int
ident2 x = y
 where
  y   = fromJust (lookup x (fst ?env))


-- Two more tests from Jeff Lewis
x () = y where y = ?wibble

f () = ?wibble :: Int
g () = f ()