TypeLits question, how to build a Type Application with Symbol index
ggreif at gmail.com
Sat Jun 28 08:10:34 UTC 2014
On 6/27/14, Iavor Diatchki <iavor.diatchki at gmail.com> wrote:
> I am a bit unclear on what you mean by "programatically": do you mean from
> within GHC or is that using something like Template Haskell?
Not TH, just the compiler/typecheck APIs. But the problem is mostly
solved already. N.B. I am in the process of extending the
generic-deriving mechanism to make it amenable to techniques like
propositional equality testing and type-level reasoning.
Cheers and thanks,
> On Thu, Jun 26, 2014 at 3:33 PM, Gabor Greif <ggreif at gmail.com> wrote:
>> Hello devs,
>> I have
>> data D (n :: Symbol)
>> in my module, and I want to obtain a type
>> D "YAY!"
>> programmatically. Where can I find code that performs this (or
>> something similar)?
>> 1) I have to look up |D| in the current TyEnv (what if it is in a
>> specific module?),
>> 2) I have to build the type index (of kind Symbol), this involves
>> FastString, looks non-trivial,
>> 3) Apply 1) on 2), this is easy.
>> Any hints welcome!
>> Thanks and cheers,
>> PS: some morsels I have so far:
>> for 1)
>> compiler/prelude/PrelNames.lhs:gHC_GENERICS = mkBaseModule (fsLit
>> ghc-devs mailing list
>> ghc-devs at haskell.org
More information about the ghc-devs