
Hello All, Defining a partially ordered set as: data Porder = HI | LW | NT deriving (Eq) class (Eq a) => Poset a where pcompare :: a -> a -> Porder and defining an instance for type synonym RuRe: type RuRe = ([Int],[Int]) instance Poset RuRe where pcompare (x1,y1) (x2,y2) | isSub x2 x1 = HI | isSub x1 x2 = LW | otherwise = NT causes no problems in Hugs (-98 flag) but compiling with GHC produces: [hvt@localhost Sandbox]$ ghc --make Main.hs -O [5 of 6] Compiling Abduce ( Abduce.hs, Abduce.o ) Abduce.hs:110:0: Illegal instance declaration for `Poset RuRe' (The instance type must be of form (T a b c) where T is not a synonym, and a,b,c are distinct type variables) In the instance declaration for `Poset RuRe' I've tried several changes, like not using the type synonym, but can't get it right. (I'm using the ghc 6.6.1 Fedora Core 6 package). Many thanks in advance! Hans van Thiel

On 19/05/07, Hans van Thiel
causes no problems in Hugs (-98 flag) but compiling with GHC produces:
There's the solution to your problem: type synonym instances aren't Haskell98, so you have to pass the -98 flag ('turn on extensions') to Hugs in order for it to work. The corresponding GHC flag is -fglasgow-exts. Try that. -- -David House, dmhouse@gmail.com

On Sat, 2007-05-19 at 15:30 +0100, David House wrote:
On 19/05/07, Hans van Thiel
wrote: causes no problems in Hugs (-98 flag) but compiling with GHC produces:
There's the solution to your problem: type synonym instances aren't Haskell98, so you have to pass the -98 flag ('turn on extensions') to Hugs in order for it to work. The corresponding GHC flag is -fglasgow-exts. Try that. Works like a charm! Many thanks,
Hans
participants (2)
-
David House
-
Hans van Thiel