
I'd like to see something resembling as-patterns in type signatures. Specifically, there are cases where I'm inclined to use (m ~ pat) in a type context when m isn't otherwise constrained, just so I can use m as an abbreviation for pat. To reduce these cases, I'd like to see the syntax m@pat allowed for use in type signatures, with m becoming simply an alias for pat. Thoughts? I've added a ticket here http://hackage.haskell.org/trac/ghc/ticket/3545. Louis Wasserman wasserman.louis@gmail.com http://profiles.google.com/wasserman.louis

On Sun, Sep 27, 2009 at 5:29 PM, Louis Wasserman
I'd like to see something resembling as-patterns in type signatures. Specifically, there are cases where I'm inclined to use (m ~ pat) in a type context when m isn't otherwise constrained, just so I can use m as an abbreviation for pat. To reduce these cases, I'd like to see the syntax m@pat allowed for use in type signatures, with m becoming simply an alias for pat. Thoughts?
I've added a ticket here.
Louis Wasserman wasserman.louis@gmail.com http://profiles.google.com/wasserman.louis
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
I was looking for a feature like this just the other day, for more succinctly defining a type class that made use of several associated type synonyms. Sincerely, Bradford Larsen

Louis Wasserman wrote:
I'd like to see something resembling as-patterns in type signatures. Specifically, there are cases where I'm inclined to use (m ~ pat) in a type context when m isn't otherwise constrained, just so I can use m as an abbreviation for pat. To reduce these cases, I'd like to see the syntax m@pat allowed for use in type signatures, with m becoming simply an alias for pat. Thoughts?
I've added a ticket here http://hackage.haskell.org/trac/ghc/ticket/3545.
+1. I've often wanted this when doing type-level programming. Another nice thing this suggests is the ability to use underscore as a pattern for when you know the compiler will infer the type but it's too complex to want to write out (e.g. while experimenting). With x@_ you could even share the complex type in multiple places, since x will be bound to some actual type rather than being universally quantified. (Of course, ISTR someone's suggested the underscores in the past and had it rejected. Alas.) -- Live well, ~wren

Martijn van Steenbergen wrote:
wren ng thornton wrote:
Another nice thing this suggests is the ability to use underscore as a pattern for when you know the compiler will infer the type but it's too complex to want to write out (e.g. while experimenting).
I'd love this!
F# has this and I find it very useful. Ganesh =============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ===============================================================================

Hello Martijn, Monday, September 28, 2009, 1:42:10 PM, you wrote:
Another nice thing this suggests is the ability to use underscore as a pattern for when you know the compiler will infer the type but it's too complex to want to write out (e.g. while experimenting).
in case you not seen this and may be interested: http://okmij.org/ftp/Haskell/types.html#partial-sigs -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Bulat Ziganshin wrote:
in case you not seen this and may be interested: http://okmij.org/ftp/Haskell/types.html#partial-sigs
Yes, I know there are workarounds (and I use them sometimes). It'd be nice if there was direct support for them. :-) Thanks, Martijn.
participants (6)
-
Brad Larsen
-
Bulat Ziganshin
-
Louis Wasserman
-
Martijn van Steenbergen
-
Sittampalam, Ganesh
-
wren ng thornton