Ticket #3699 (new feature request)

Opened 3 years ago

Last modified 8 months ago

Wildcards in type functions

Reported by: MartijnVanSteenbergen Owned by:
Priority: low Milestone: 7.6.2
Component: Compiler Version: 6.10.4
Keywords: Cc: eir@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I would like to be able to use wildcards in type synonym family instances, so that I can write:

type instance ErrorAlg (f :>: _) e a = ErrorAlg f e a

Change History

Changed 3 years ago by simonpj

  • milestone set to 6.14 branch

Very reasonable idea. I've added it to our list of type-function feature requests at  http://hackage.haskell.org/trac/ghc/wiki/TypeFunctionsStatus

Simon

Changed 3 years ago by MartijnVanSteenbergen

Continuing this line of thought, instances for this family go hand in hand with instances for this type class:

class MkErrorAlgebra f where
  mkErrorAlgebra :: ErrorAlg f e a -> ErrorAlgPF f e a

Would it then also make sense to write:

instance MkErrorAlgebra f => MkErrorAlgebra (f :>: _) where
  mkErrorAlgebra alg         (Tag f)           = mkErrorAlgebra alg f

?

Just a wild idea which I'm not sure yet I like or dislike. It does fit in with the idea of not making up names if you don't have to. For that reason I also prefer writing data D :: <kind> where for GADTs rather than making up arbitrary names for the type arguments. Going even further, this idea can be extended to e.g. data Const a _ = Const a for normal ADTs.

Okay, enough wild ideas for now. :-)

Changed 3 years ago by igloo

  • milestone changed from 6.14 branch to 6.14.1

Changed 2 years ago by igloo

  • milestone changed from 7.0.1 to 7.0.2

Changed 2 years ago by igloo

  • milestone changed from 7.0.2 to 7.2.1

Changed 20 months ago by igloo

  • milestone changed from 7.2.1 to 7.4.1

Changed 16 months ago by igloo

  • priority changed from normal to low
  • milestone changed from 7.4.1 to 7.6.1

Changed 13 months ago by goldfire

  • cc eir@… added

Changed 8 months ago by igloo

  • milestone changed from 7.6.1 to 7.6.2
Note: See TracTickets for help on using tickets.