GenericsPropositionalEquality [Was: Resolved+new Q: TypeLits question, how to build a Type Application with Symbol index]
Gabor Greif
ggreif at gmail.com
Wed Jul 2 12:42:19 UTC 2014
[added Pedro and Richard to "to:"]
On 6/30/14, Simon Peyton Jones <simonpj at microsoft.com> wrote:
> | Yes I have a branch, and it works! A bunch of things is still missing
> | (notably record selectors), but I have a proof-of-concept with a gdiff
> | library hooked up to GHC.Generics, and by appealing to type-level
> | reasoning I can obtain a difference tree from True to False (which
> | looks good) by using the reflection (i.e. class Generic) only, no need
> | for TH or hand-coding. Comparing bigger trees (and then 'patch'ing
> | them) appears to be SMOP from here.
>
> Do you have a wiki page explaining what "it" is (the thing that works).
Here is a wiki page
https://ghc.haskell.org/trac/ghc/wiki/GenericsPropositionalEquality
you all are invited to make suggestions, ask questions and generally beautify.
>
> | instance Datatype (Dat "MyModule" "Foo") ...
> |
> | I get an 'orphan instance' warning. I believe that these are harmless,
>
> The downside of orphan instances is that GHC must visit every .hi file that
> has an orphan instance, just in case it contains a relevant instance decl.
> That slows down *every* compilation, whether or not it uses the instance.
>
> The best way to get rid of it is to declare something local that is "from
> this module". Something like
>
> data MyModule_Foo
> instance DataType (Dat MyModule_Foo) where ...
>
> Now MyModule_Foo is a data type from the module currently being compiled.
> That tells GHC which .hi file to look in, and means the instance isn't
> orphan.
Yes I see, I noted it in the discussion and came up with a
conservative approach (to be implemented).
Furter opinions? Please add to the wiki.
Thanks and cheers,
Gabor
>
> Simon
>
> | so is there a way to suppress them? Since I never insert tyvars in the
> | instance head, there should never be any overlap too.
> |
> | Cheers,
> |
> | Gabor
> |
> | On 6/30/14, Simon Peyton Jones <simonpj at microsoft.com> wrote:
> | > You'll need to give a lot more info than this before I can help Gabor.
> | > Currently I have only the vaguest idea about what you are trying to
> | > accomplish. Is there a wiki page that describes the design (user's eye
> | > view) in detail?
> | >
> | > I see you have a branch. If you are stuck, and give me repro
> | instructions,
> | > I can attempt to help.
> | >
> | > Simon
> | >
> | > | -----Original Message-----
> | > | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of
> | Gabor
> | > | Greif
> | > | Sent: 27 June 2014 17:51
> | > | To: ghc-devs
> | > | Subject: Resolved+new Q: TypeLits question, how to build a Type
> | > | Application with Symbol index
> | > |
> | > | 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")
> | > | >
> | > | _______________________________________________
> | > | 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