RE: template-haskell names in 6.3
Acutally it's there already: qCurrentModule :: Q String Simon | -----Original Message----- | From: Keean Schupke [mailto:k.schupke@imperial.ac.uk] | Sent: 02 December 2004 17:37 | To: Simon Peyton-Jones | Subject: Re: template-haskell names in 6.3 | | Simon Peyton-Jones wrote: | | Okay I want a globaly unique label, so I want to prepend the module name | to the string... | | module SomeLib.MyModule where | | $(label "myLabel") -- splices: myLabel = "SomeLib.MyModule.myLabel" | | I guess what I want is a reifyModuleName? | | Keean. | | >| -----Original Message----- | >| From: MR K P SCHUPKE [mailto:k.schupke@imperial.ac.uk] | >| Sent: 22 October 2004 13:05 | >| To: glasgow-haskell-users@haskell.org; Simon Peyton-Jones | >| Subject: template-haskell names in 6.3 | >| | >| | >| I have now read most of the notes on template-haskell2, but I still | >| have a problem with naming (although I think my issues with types | >| are adequately dealt with by the '' notation. | >| | >| I wish to create a declaration in template haskell, where the funtion | >| name is supplied: something like: | >| | >| $(label "myLabel") | >| | >| However I wish the reference to this label to be globally specific | >| to the generated instance... an example of this would be a function | >| that prints its reified name: | >| | >| $(example "myLabel") would splice: | >| | >| myLabel :: String | >| myLabel = "This_module.myLabel" | >| | >| mkName only returns the 'local' namem | >| how can I get a global name from a string? | >| | >| Keean. | > | >
Simon Peyton-Jones wrote: Right... I had a good look through the library source, but must have missed it... It seems the functions to build and extract the 'module' part of Names is not exported... is there any reason why it can't be? Keean.
Acutally it's there already: qCurrentModule :: Q String
Simon
| -----Original Message----- | From: Keean Schupke [mailto:k.schupke@imperial.ac.uk] | Sent: 02 December 2004 17:37 | To: Simon Peyton-Jones | Subject: Re: template-haskell names in 6.3 | | Simon Peyton-Jones wrote: | | Okay I want a globaly unique label, so I want to prepend the module name | to the string... | | module SomeLib.MyModule where | | $(label "myLabel") -- splices: myLabel = "SomeLib.MyModule.myLabel" | | I guess what I want is a reifyModuleName? | | Keean. | | >| -----Original Message----- | >| From: MR K P SCHUPKE [mailto:k.schupke@imperial.ac.uk] | >| Sent: 22 October 2004 13:05 | >| To: glasgow-haskell-users@haskell.org; Simon Peyton-Jones | >| Subject: template-haskell names in 6.3 | >| | >| | >| I have now read most of the notes on template-haskell2, but I still | >| have a problem with naming (although I think my issues with types | >| are adequately dealt with by the '' notation. | >| | >| I wish to create a declaration in template haskell, where the funtion | >| name is supplied: something like: | >| | >| $(label "myLabel") | >| | >| However I wish the reference to this label to be globally specific | >| to the generated instance... an example of this would be a function | >| that prints its reified name: | >| | >| $(example "myLabel") would splice: | >| | >| myLabel :: String | >| myLabel = "This_module.myLabel" | >| | >| mkName only returns the 'local' namem | >| how can I get a global name from a string? | >| | >| Keean. | > | >
participants (2)
-
Keean Schupke -
Simon Peyton-Jones