[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 <matthewtpickering@…>): In [changeset:"b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2/ghc" b0121209/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2" Handle types w/ type variables in signatures inside patterns (DsMeta) The comment indicated that scoping of type variables was a large problem but Simon fixed it in e21e13fb52b99b14770cc5857df57bbcc9c85102. Thus, we can implement repP for signatures very easily in the usual way now. Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2490 GHC Trac Issues: #12164 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12164#comment:5> 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 Ben Gamari <ben@…>): In [changeset:"e8ae4dc8558b5917f6c65ad196859783e90038bd/ghc" e8ae4dc8/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="e8ae4dc8558b5917f6c65ad196859783e90038bd" Update user's guide after D2490 D2490 added support for type wildcards in TH pattern splices. The user's guide still said that they were not supported, this patch fixes this. Test Plan: build documentation Reviewers: goldfire, austin, mvv, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2686 GHC Trac Issues: #12164 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12164#comment:6> 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: 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