[GHC] #13451: Bind implicit parameter in patterns
GHC
ghc-devs at haskell.org
Sun Mar 19 03:49:33 UTC 2017
#13451: Bind implicit parameter in patterns
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
ImplicitParams |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Is there any reason why variables for `ImplicitParams` can't be bound in
patterns, so you can write
{{{#!hs
data Exp = Val Int | Op Op Exp Exp
data Op = Add | Mul
data Protect where
Protect :: (?op :: Op) => Protect
protectOp :: Exp -> Maybe Protect
protectOp (Op ?op _ _) = Just Protect
protectOp _ = Nothing
}}}
instead of
{{{#!hs
protectOp :: Exp -> Maybe Protect
protectOp (Op op _ _) = Just Protect where ?op = op
protectOp _ = Nothing
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13451>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list