Re: [Haskell-beginners] A few really short beginners questions

Yea, Hugs tells me:
ERROR (filepath):3 - Syntax error in instance head (constructor expected)
But since I'm trying to understand Haskell and have nothing particular
in mind with this program, I'm not stressed finding a solution for
this. I'm happy if the code is principally correct.
fweth
2010/10/3, Brent Yorgey
On Sun, Oct 03, 2010 at 08:32:31PM +0200, Klaus Gy wrote:
Thank You very much for the fast reply! I think I expressed myself badly in the first question. What does not work is the following:
class Test a
instance Num a => Test a
What do you mean "doesn't work"? Do you get an error? Or it doesn't have the behavior you expect? This ought to work fine.
-Brent

On Sun, Oct 03, 2010 at 09:44:28PM +0200, Klaus Gy wrote:
Yea, Hugs tells me:
ERROR (filepath):3 - Syntax error in instance head (constructor expected)
But since I'm trying to understand Haskell and have nothing particular in mind with this program, I'm not stressed finding a solution for this. I'm happy if the code is principally correct.
Ah, I see, you are using Hugs. As I mention in my other email, GHC has an extension (FlexibleInstances) to allow this. Hugs might support this extension as well (I am not sure) but it unfortunately doesn't mention the possibility in the error message, like GHC does. -Brent

On Monday 04 October 2010 15:44:53, Brent Yorgey wrote:
On Sun, Oct 03, 2010 at 09:44:28PM +0200, Klaus Gy wrote:
Yea, Hugs tells me:
ERROR (filepath):3 - Syntax error in instance head (constructor expected)
But since I'm trying to understand Haskell and have nothing particular in mind with this program, I'm not stressed finding a solution for this. I'm happy if the code is principally correct.
Ah, I see, you are using Hugs. As I mention in my other email, GHC has an extension (FlexibleInstances) to allow this. Hugs might support this extension as well (I am not sure)
It does, but AFAIK, hugs offers less fine-grained control over which extensions to enable, you need the -98 command line option, which turns on almost all extensions hugs has (I think the only extension individually controllable is overlapping instances, +o or +O for unsafe overlapping instances).
but it unfortunately doesn't mention the possibility in the error message, like GHC does.
-Brent
participants (3)
-
Brent Yorgey
-
Daniel Fischer
-
Klaus Gy