Resolved+new Q: TypeLits question, how to build a Type Application with Symbol index

Gabor Greif ggreif at gmail.com
Fri Jun 27 16:50:33 UTC 2014


I succeeded to solve all of them :-)

But now I am blocked on on a panic

"not in scope during type checking, but it passed the renamer".

I suspect that while "deriving Generic" some instances are defined in
some empty TcEnv, which does not contain my definition in context.

Is there a way to inject some type constructor into the TcEnv?

Thanks,

    Gabor

On 6/27/14, 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")
>


More information about the ghc-devs mailing list