Thanks for your reply Mark!

On Tue, 9 Nov 1999, Mark P Jones wrote:

> | Thanks for the example. I'm not quite convinced though.
> | ...
> | ... 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.
> 
> I'm afraid you're going to have to be much more precise.
> 
OK, I'll do my best.

> - You say it didn't work for Hugs, but it worked fine for me.  If you
>   load the module Foo above with Hugs in +98 mode, then it just gives
>   an error message that is Hugs' analogue of the error produced by ghc.
>   If you run Hugs in -98 mode, without the Haskell 98 restrictions,
>   then it derives  Show (f (Fix f)) => Show (Fix f), which is also a
>   reasonable response.  In neither case did I get the cutoff error
>   that you reported.
> 
The program that didn't work with hugs (hugs98 septemeber, -98 or +98
doesn't matter) but worked with ghc was this:

newtype Show (f (Fix f)) => Fix f = In (f (Fix f))
  deriving Show

newtype Nat = MkNat (Fix Maybe)
  deriving Show

> To derive any instance of a class, you need to know what will go on
> the left of the => sign in the generated instance.  That context can
> be expressed as a fixed point, details of which I will not provide,
> and such fixed points are usually calculated by iterating until the
> desired fixed point is reached ... in finitely many steps, or so one
> might hope.  But here, the computation fails to reach a fixed point.
> It doesn't matter whether you iterate, recurse, or anything else; if
> your goal is to find a fixed point where none exists, then you'll end
> up disappointed.
> 
Ok, I was under the impression that it was the instance that was hard to
derive but it turns out that it is the context that is the problem.

So this means that there are actually undecidable stuff in the haskell
language, right?

        /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