On Thu, 4 Nov 1999, Mark P Jones wrote:

> | I'm still curious about the hint in the errormessage that the problem
> | might be undecidable. Can you comment on that?
> 
> You might get a better understanding of this if you try to find a value
> for the cutoff parameter that will allow the following program to load:
> 
>   newtype Fix f = In (f (Fix f))
>    deriving Show
> 
>   newtype Nat = MkNat (Fix Maybe)
>    deriving Show
> 
> (Hugs limits the -c value to a maximum of 1024, but that should be enough
> to persuade you ...)
> 
Thanks for the example. I'm not quite convinced though. In the haskell
report there are five rules (but only three apply in this example) saying
when deriving is possible. If I understand it correctly the above example
does not fulfil condition 2 which says that Fix needs a context(cxt) so
that cxt => Show f (Fix f) to holds. The empty context will not do here so
it's not possible to derive Show for Fix according to the report.
Suppose we want to fill in the context ourselves. One might try Show f as
a context but that would be incorrect because instances of Show has kind *
and f has kind * -> *. So one might try Show (f (Fix f)). This still
doesn't work with hugs (it complains about the cutoff again) but it works
with ghc.

So, the question remains; is there really a need for iterating when
deriving Show? Or am I missing something obvious here?

Best wishes
        /Josef

----------------------------------------------------------
|Josef Svenningsson|http://www.dtek.chalmers.se/~d95josef|
|Rubingatan 39     |  email: [EMAIL PROTECTED]   |
|421 62 G�teborg   |          tel: 031-7090774           |
----------------------------------------------------------
What is a magician but a practising theorist?
                -- Obi-Wan Kenobi

Reply via email to