Opened 5 years ago

Last modified 4 years ago

#3545 new feature request

As-patterns for type signatures

Reported by: LouisWasserman Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.11
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The proposal: in any type signature, the presence of type variable

x@pat

matches the type specified by pat, and replaces any occurrences of the type variable x with pat. In particular, this might be comparable to defining

type x (free variables in pat) = pat

with scope solely to the right of the as-pattern. Alternately, it might be compared to an equality constraint (x ~ pat).

Change History (3)

comment:1 Changed 5 years ago by LouisWasserman

  • Component changed from Compiler (Parser) to Compiler (Type checker)

In particular, if x isn't constrained in any other way, I believe it's precisely equivalent to a constraint x ~ pat.

comment:2 Changed 4 years ago by igloo

  • Difficulty set to Unknown
  • Milestone set to 6.14.1

comment:3 Changed 4 years ago by simonmar

  • Milestone changed from 6.14.1 to _|_

Let's leave this as an unmilestoned feature request. It needs a lot more discussion.

Note: See TracTickets for help on using tickets.