On Thu, Sep 06, 2007 at 06:49:21AM -0400, [EMAIL PROTECTED] wrote:
> For completeness, here's the final solution, courtesy of int-e (whose
> real name I don't know; sorry), which is much more elegant than I
Bertram Felgenhauer
> bindString :: (forall s. StringAsType s => Mark s a) -> String -> a
G'day all.
Quoting Simon Peyton-Jones <[EMAIL PROTECTED]>:
| -- GHC rejects this. Hugs compiles it, but I can't call it as
| -- let ?foo = "Hello" in show Foo
| --
| -- Is there a good reason to disallow this?
| data Foo = Foo
|
| instance (?foo :: String) => Show Foo where
| showsPrec _ F
| -- Hugs allows this. GHC rejects it on the grounds that "a" is unused
| -- on the right-hand side of the (=>). I think this is arguably a bug
| -- in GHC.
| f3 :: (Show a, ?foo :: a) => String
| f3 = show ?foo
Hugs is right here. GHC 6.8 accepts this too, and has done for some time;
there's
{-# OPTIONS -fglasgow-exts #-}
-- G'day everyone.
-- This is okay.
f1 :: (?foo :: String) => String
f1 = ?foo
-- So is this.
f2 :: (Show a, ?foo :: a) => a -> String
f2 _ = show ?foo
-- Hugs allows this. GHC rejects it on the grounds that "a" is unused
-- on the right-hand side of the (=>). I