[Haskell-cafe] TH to generate imports?
Corentin Dupont
corentin.dupont at gmail.com
Thu Jun 11 10:08:55 UTC 2015
Thanks!
So, at the moment it's not possible?
So is it possible instead to do:
$(genPackage "MyPackage")
import MyPackage
The template Haskell expression would just create the Haskell package in a
corresponding file, so we can import it.
Nothing would be spliced in.
On Thu, Jun 11, 2015 at 11:45 AM, Adam Bergmark <adam at bergmark.nl> wrote:
> https://ghc.haskell.org/trac/ghc/ticket/1475
>
>
> On Thu, Jun 11, 2015 at 11:12 AM, Corentin Dupont <
> corentin.dupont at gmail.com> wrote:
>
>> Hi guys,
>> I wanted to know if it's possible to use TH on an "import" statement.
>> What I want to do is to generate the names of the packages I need to
>> import.
>> For example:
>>
>> import $(genImport "MyPackage")
>>
>> genImport :: String -> Q TH.Exp
>> genImport s = ...
>>
>>
>> Is that possible?
>> Thanks!
>> Corentin
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150611/48b1bd80/attachment.html>
More information about the Haskell-Cafe
mailing list