[GHC] #3993: allow implicit parameter bindings in patternseee
GHC
cvs-ghc at haskell.org
Fri Apr 16 21:07:10 EDT 2010
#3993: allow implicit parameter bindings in patternseee
---------------------------------+------------------------------------------
Reporter: aavogt | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 6.12.1 | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3993>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list