[GHC] #12164: Type signatures in patterns not (yet) handled by Template Haskell

#12164: Type signatures in patterns not (yet) handled by Template Haskell -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Template | Version: 8.0.1 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This bit me just now, so I figured I should report a feature request bug. {{{ ezyang@sabre:~/Dev/whisk$ ghc-8.0 --interactive -XTemplateHaskell GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help Prelude> Language.Haskell.TH.runQ [| \(x :: ()) -> x |] <interactive>:1:29: error: Type signatures in patterns not (yet) handled by Template Haskell x :: () }}} In the code, there is a bit of mumbling about scoped type variables. I believe it is referring to code like this: {{{ Prelude> :t (\(x :: a) -> (x :: a)) (\(x :: a) -> (x :: a)) :: a -> a }}} Described in the manual here: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts... #pattern-type-signatures This means that TH has to somehow bring the type into scope. I don't actually know how to do it. It seems a bit awful for this to be the reason why these quotes are not accepted; maybe without scoped type variables we should be able to do something cheap and cheerful. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12164 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12164: Type signatures in patterns not (yet) handled by Template Haskell -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | 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): Phab:D2490 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mikhail.vorozhtsov): * differential: => Phab:D2490 Comment: Needed this for my DSL, so I wrote a partial (for type signatures without type variables) patch: Phab:D2490 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12164#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12164: Type signatures in patterns not (yet) handled by Template Haskell -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | 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): Phab:D2490 Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Yes, I imagine without scoped type variables, this wouldn't be so hard. With them might be more challenging. Does your use-case require binding variables in the pattern type signature? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12164#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12164: Type signatures in patterns not (yet) handled by Template Haskell -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | 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): Phab:D2490 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mikhail.vorozhtsov): No, I only need type constructors. It looks like this: {{{ defState "Name" [| \(var1 :: TypeName1, "A state variable") \(var2 :: TypeName2, "Another one") -> BEHAVIOR |] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12164#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12164: Type signatures in patterns not (yet) handled by Template Haskell -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | 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): Phab:D2490 Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): OK. Let's do the easy thing now (no scoped type variables) and then we can revisit the harder thing in due course. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12164#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12164: Type signatures in patterns not (yet) handled by Template Haskell
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Template Haskell | 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): Phab:D2490
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Matthew Pickering

#12164: Type signatures in patterns not (yet) handled by Template Haskell
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Template Haskell | 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): Phab:D2490
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12164: Type signatures in patterns not (yet) handled by Template Haskell -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2490 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12164#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC