Opened 13 years ago

Closed 13 years ago

Last modified 46 years ago

#102 closed bug (Rejected)

can't declare instance for type synonim

Reported by: alar Owned by: nobody
Priority: normal Milestone:
Component: Compiler (Type checker) Version: None
Keywords: Cc:
Operating System: Architecture:
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Trying to load into GHCi simple program (in attached 
file) I receive error stating I can declare class instances 
only for types defined using "data". I beleive it is a bug 
because Hugs handles this situation normally.
Error message:
/igor/tst.hs:1:
    No instance for `Eq (Stack -> Stack)'
    When deriving the `Eq' instance for type `Object'

/igor/tst.hs:1:
    No instance for `Show (Stack -> Stack)'
    When deriving the `Show' instance for type `Object'

/igor/tst.hs:4:
    Illegal instance declaration for `Eq Operator'
        (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 `Eq Operator'

/igor/tst.hs:6:
    Illegal instance declaration for `Show Operator'
        (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 `Show Operator'

Attachments (1)

Tst.2.hs (733 bytes) - added by alar 13 years ago.

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by alar

comment:1 Changed 13 years ago by simonmar

Logged In: YES 
user_id=48280

Hugs is wrong on this one, the H98 report states that an 
instance type cannot refer to a type synonym (section 4.3.2).

comment:2 Changed 13 years ago by sigbjorn

  • Status changed from assigned to closed
Logged In: YES 
user_id=232905

To get at the 'wrong' behaviour with GHC(i), use -fglasgow-
exts.
Note: See TracTickets for help on using tickets.