
#12360: Extend support for binding implicit parameters -------------------------------------+------------------------------------- Reporter: MichaelBurge | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Iceland_jack: I could not parse your comments. But currently GHC does allow this: {{{ data X where MkX :: (?x :: Int) => X f :: X -> Int -> Int f MkX y = ?x + y -- The pattern match on MkX binds an -- implicit parameter ?x g = let ?x = 7 in f MkX 5 -- Here the MkX needs a ?x constraint, which it gets from -- the let-binding. So g = 12 }}} Function `f` looks a bit odd because it has a use of `?x` but it is far from clear where it is bound: you have to look at the captured constraints for the pattern-matched constructors. But there is nothing technically complicated or unsound about this. Pattern synonyms are just sugar on top of this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12360#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler