Opened 5 months ago

Last modified 9 days ago

#8584 new feature request

Pattern synonym type signatures

Reported by: cactus Owned by:
Priority: normal Milestone:
Component: Compiler Version:
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By: #5144
Blocking: Related Tickets:

Description

Currently, the only way to specify a type signature for a pattern synonym is by adding type annotations to the right-hand side, like this:

{-# LANGUAGE PatternSynonyms, ScopedTypeVariables #-}

pattern Single x = ([x] :: [Int])

Bespoke syntax for adding type signatures for pattern synonyms would probably be useful.

Change History (2)

comment:1 Changed 2 months ago by nomeata

JFTR: The code in master already contains a PatSynSig constructor, but it is dead code...

comment:2 Changed 9 days ago by cactus

It is not dead, just dormant :) Haddock uses it. The plan for this ticket is to add frontend (parser/typechecker) support for PatSynSig, but it's not done yet.

Note: See TracTickets for help on using tickets.