Ticket #4091 (new feature request)

Opened 3 years ago

Last modified 3 years ago

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 Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

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

Changed 3 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

Changed 3 years ago by igloo

  • status changed from new to infoneeded
  • milestone set to 6.14.1

Changed 3 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.

Changed 3 years ago by igloo

  • status changed from infoneeded to new

Changed 3 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.