[GHC] #7667: Template Haskell fails to recognize type operator/function +

#7667: Template Haskell fails to recognize type operator/function + --------------------------------------+------------------------------------- Reporter: andygill | Owner: Type: bug | Status: new Priority: normal | Component: Template Haskell Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- The following message is issued for a valid TH program. {{{ Main.hs:7:1: Illegal type constructor or class name: `+' When splicing a TH declaration: type instance GHC.TypeLits.+ 1 2 = 3 Failed, modules loaded: Test1. }}} Code attached. The program is attempting to capture the name +, as used by Nat at the type level. The problem appears to be in Convert.hs {{{ -- Convert.hs okOcc :: OccName.NameSpace -> String -> Bool okOcc _ [] = False okOcc ns str@(c:_) | OccName.isVarNameSpace ns = startsVarId c || startsVarSym c | otherwise = startsConId c || startsConSym c || str == "[]" }}} + is rejected, by okOcc, even though it is acceptable, the symbol neither starts with upper-case, or ':'. I have tried using reify to extract the *actual* name from other sources (rather than use mkNameG_tc), and it fails in the same way. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7667 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7667: Template Haskell fails to recognize type operator/function + ---------------------------------+------------------------------------------ Reporter: andygill | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: GHC rejects valid program Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: OK so we could test flags etc make `okOcc` accept the type operator. Or alternatively we could simply omit the test, which would allow TH to generate names that the programmer could not right. In fact it currently only checks the name space; that is, checks that if the name claims to be a data constructor then it starts with an uppper case letter or colon. But it does ''not'' check the name is a legal one; it could be the data constructor `C$$` for example, which the programmer can't write. I'm inclined to go the whole way, and simply treat the name space in the TH name as authoritative, regardless of the string that used for the name. I'll that unless someone yells. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7667#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7667: Template Haskell fails to recognize type operator/function + ---------------------------------+------------------------------------------ Reporter: andygill | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Template Haskell | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: GHC rejects valid program Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * milestone: => 7.8.1 Comment: See also #7484 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7667#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC