[GHC] #11350: Allow visible type application in patterns
GHC
ghc-devs at haskell.org
Tue Apr 18 10:31:01 UTC 2017
#11350: Allow visible type application in patterns
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
| TypeApplications PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #11385, #13159, | Differential Rev(s):
#13158 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
Using the types from
[https://github.com/goldfirere/glambda/blob/master/src/Language/Glambda/Type.hs
Glambda], can we use this to implement
{{{#!hs
refineTy_ :: Ty -> (forall ty. ITy ty => Proxy ty -> r) -> r
refineTy_ IntTy k = k @Int Proxy
refineTy_ BoolTy k = k @Bool Proxy
refineTy_ (Arr a b) k =
refineTy a $ \(Proxy :: Proxy a_ty) ->
refineTy a $ \(Proxy :: Proxy b_ty) ->
k @(a_ty -> b_ty) Proxy
}}}
without `Proxy ty`?
{{{#!hs
refineTy_ :: Ty -> (forall ty. ITy ty => r) -> r
refineTy_ IntTy k = k @Int
refineTy_ BoolTy k = k @Bool
refineTy_ (Arr a b) k =
refineTy a $ \@a_ty ->
refineTy a $ \@b_ty ->
k @(a_ty -> b_ty)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11350#comment:17>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list