Opened 5 years ago

Last modified 5 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 Revisions:

Description

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 5 years ago by simonpj

  • Type changed from bug to feature 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.

Simon

comment:2 Changed 5 years ago by igloo

  • Milestone set to 6.14.1
  • Status changed from new to infoneeded

comment:3 Changed 5 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 5 years ago by igloo

  • Status changed from infoneeded to new

comment:5 Changed 5 years ago by simonpj

  • Milestone changed from 6.14.1 to _|_

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

Simon

Note: See TracTickets for help on using tickets.