Skip to content

allow implicit parameter bindings in patterns

It could work like such:

main = do
    ?conts <- getContents
    fun

fun :: (?conts :: String) -> IO ()
fun = ...

becoming something like

main = do
    conts <- getContents
    let ?conts = conts
    fun

Of course there are still questions regarding interactions with pattern guards and view patterns (whether those variables should be in scope for other guards, or for view patterns that follow).

This interaction with view patterns (and pattern guards), should likely elicit a warning:

   let ?x = 1 in
   let f ?x ((?x +) -> y) = y in
   f 0 0

As it might be expected that this expression should be 1, while I think it should evaluate to 0.

This probably would lead to more syntax stealing, but it seems unlikely that there would be code that enables -XImplicitParams that does stuff like:

x ?y = ...

Expecting to define the function `?', rather than binding the implicit parameter ?y.

Trac metadata
Trac field Value
Version 6.12.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by aavogt
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information