TypeLits question, how to build a Type Application with Symbol index

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")

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?
-Iavor
On Thu, Jun 26, 2014 at 3:33 PM, Gabor Greif
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@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

On 6/27/14, Iavor Diatchki
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
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@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

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
On 6/27/14, Iavor Diatchki
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
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@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
participants (2)
-
Gabor Greif
-
Iavor Diatchki