Commit 5a3d608f authored by simonpj's avatar simonpj
Browse files

[project @ 2001-05-03 08:52:52 by simonpj]

Add a fundep fail test
parent fec20b7d
{-# OPTIONS -fglasgow-exts #-}
module ShouldFail where
-- A stripped down functional-dependency
-- example that causes GHC 4.08.1 to crash with:
-- "basicTypes/Var.lhs:194: Non-exhaustive patterns in function readMutTyVar"
-- Reported by Thomas Hallgren Nov 00
primDup :: Int -> IO Int
primDup = undefined
dup () = call primDup
-- call :: Call c h => c -> h
-- call primDup :: {Call (Int -> IO Int) h} => h with
-- Using the instance decl gives
-- call primDup :: {Call (IO Int) h'} => Int -> h'
-- The functional dependency means that h must be constant
-- Hence program is rejected because it can't find an instance
-- for {Call (IO Int) h'}
class Call c h | c -> h where
call :: c -> h
instance Call c h => Call (Int->c) (Int->h) where
call f = call . f
No instance for `Call (IO Int) h'
arising from use of `call' at tcfail093.hs:14
In the definition of `dup': call primDup
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