Opened 7 years ago

Last modified 7 years ago

#4091 new feature request

Parse error on curried context of instance declaration

Reported by: basvandijk Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.12.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Assume we have the following classes:

class C1 a; class C2 a; class C3 a; class C4 a

GHC allows you to write a type with an uncurried context, as in:

foo :: (C1 a, C2 b, C3 c) => a -> b -> c

It also allows you to write a type with a curried context, as in:

foo :: C1 a => C2 b => C3 c => a -> b -> c

However it is not allowed to use this curried style of contexts in instance declarations, as in:

instance C1 a => C2 b => C3 c => C4 (SomeType a b c) 

Is this intentional?

Change History (5)

comment:1 Changed 7 years ago by simonpj

Type: bugfeature request

Well, the Haskell 98 syntax is uncurried. GHC allows the uncurried form in type signatures as a convenience, because it can make a big difference when type synonyms are involved:

type T b = forall a. Eq a => a -> a -> b
f :: Int -> T Int

But no one has sought it in instances before, so I have not thought about supporting it.

I've changed the ticket to a feature request. If you want it, perhaps you can articulate why. Currently I'd see it as low priority.


comment:2 Changed 7 years ago by igloo

Milestone: 6.14.1
Status: newinfoneeded

comment:3 Changed 7 years ago by basvandijk

I don't really need this syntax. I just like having a consistent type language in both type signatures and class/instance declarations.

comment:4 Changed 7 years ago by igloo

Status: infoneedednew

comment:5 Changed 7 years ago by simonpj

Milestone: 6.14.1_|_

Fair enough. It's a reasonable idea but we have a lot else to do, so I'll put this on the back burner.


Note: See TracTickets for help on using tickets.