As a co-author of the paper that came from this: yes, please! :)

On Jul 26, 2018, at 6:17 AM, Simon Peyton Jones via ghc-steering-committee <ghc-steering-committee@haskell.org> wrote:

I’m a strong supporter.  I think the proposal itself (which will have longevity) could be improved significantly, and have commented to that effect.
 
Simon
 
From: ghc-steering-committee <ghc-steering-committee-bounces@haskell.org> On Behalf Of Iavor Diatchki
Sent: 26 July 2018 09:09
To: ghc-steering-committee@haskell.org
Subject: [ghc-steering-committee] Discussion about "Type Application in Patterns" (#126)
 

Hello,

 

let's also start the discussion on feature request 126.   The idea here is that we allow the @ notation for explicit type applications to also be used on constructors in patterns.  Using @ with a constructor in a pattern has the same meaning as it does it an expression:  the provided type is used to instantiate the corresponding type parameter of the constructor.   If the type contains variables, those are treated in the same way as in #128, where "unbound" variables name the matching types.   Here are some examples:

 

    f1 (Just @Int x) = x    -- This has type `Maybe Int -> Int`

 

    f2 (Just @[a] x) = x == "c"   -- `a` is an alias for `Char`

 

    f3 (SomeException @e ex) = ...  -- `e` is a name for the existentially hidden exception type

 

Overall I think that is a simple and natural extension to the way @ already works, and I propose that we accept it.

 

Thoughts?

 

-Iavor

 

 

_______________________________________________
ghc-steering-committee mailing list
ghc-steering-committee@haskell.org
https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee