Opened 7 years ago

Last modified 7 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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


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 7 years ago by LouisWasserman

Component: Compiler (Parser)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 7 years ago by igloo

difficulty: Unknown
Milestone: 6.14.1

comment:3 Changed 7 years ago by simonmar

Milestone: 6.14.1_|_

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

Note: See TracTickets for help on using tickets.