Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#8584 closed feature request (fixed)

Pattern synonym type signatures

Reported by: cactus Owned by: cactus
Priority: normal Milestone: 7.10.1
Component: Compiler (Type checker) Version:
Keywords: PatternSynonyms Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: #5144 Blocking: #8968
Related Tickets: 8581 Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

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.

Link to PatternSynonyms for pattern synonym signatures for specification.

Change History (8)

comment:1 Changed 4 years ago by nomeata

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

comment:2 Changed 4 years 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.

comment:3 Changed 3 years ago by cactus

Component: CompilerCompiler (Type checker)
Keywords: pattern synonyms added
Milestone: 7.10.1
Owner: set to cactus

comment:4 Changed 3 years ago by cactus

Blocking: 8968 added

comment:5 Changed 3 years ago by cactus

comment:7 Changed 3 years ago by simonpj

Description: modified (diff)

comment:8 Changed 3 years ago by cactus

Resolution: fixed
Status: newclosed

comment:9 Changed 3 years ago by cactus

Keywords: PatternSynonyms added; pattern synonyms removed
Note: See TracTickets for help on using tickets.