tc201.hs 793 Bytes
Newer Older
1 2
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
             ExistentialQuantification, FlexibleContexts #-}
Simon Peyton Jones's avatar
Simon Peyton Jones committed
3

thomie's avatar
thomie committed
4
{-      Email 30 Jan 2006
Simon Peyton Jones's avatar
Simon Peyton Jones committed
5 6 7 8 9 10 11 12 13 14 15 16

> the attached program compiles under GHC, but not with Hugs. as far as
> i see, Hugs don't use dependencies in class headers to figure out that
> there is only one "vMkIOError" that can be called in the last
> definition

OK, I think it's a bug (though the example is bizarre).  Sadly Hugs's
support for FDs is rough around the edges (and unlikely to improve
soon).

-}

17
module ShouldCompile where
Simon Peyton Jones's avatar
Simon Peyton Jones committed
18

thomie's avatar
thomie committed
19 20
        class (Monad m) => Stream m h | h->m where
                vMkIOError :: h -> Int
Simon Peyton Jones's avatar
Simon Peyton Jones committed
21

thomie's avatar
thomie committed
22
        data BinHandle = forall h . Stream IO h => BinH h
Simon Peyton Jones's avatar
Simon Peyton Jones committed
23

thomie's avatar
thomie committed
24 25
        instance Stream IO BinHandle where
                vMkIOError (BinH h) = vMkIOError h