TypeLits question, how to build a Type Application with Symbol index
Gabor Greif
ggreif at gmail.com
Sat Jun 28 14:21:44 UTC 2014
For the record, I have started branch 'wip/generics-propeq' and
documented it here:
https://ghc.haskell.org/trac/ghc/wiki/ActiveBranches
Cheers,
Gabor
On 6/28/14, Gabor Greif <ggreif at gmail.com> wrote:
> On 6/27/14, Iavor Diatchki <iavor.diatchki at gmail.com> wrote:
>> Hello,
>>
>> 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,
>
> Gabor
>
>>
>> -Iavor
>>
>>
>> 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,
>>>
>>> Gabor
>>>
>>>
>>> PS: some morsels I have so far:
>>>
>>> for 1)
>>> compiler/prelude/PrelNames.lhs:gHC_GENERICS = mkBaseModule (fsLit
>>> "GHC.Generics")
>>> _______________________________________________
>>> ghc-devs mailing list
>>> ghc-devs at haskell.org
>>> http://www.haskell.org/mailman/listinfo/ghc-devs
>>>
>>
>
More information about the ghc-devs
mailing list