magicDict

Edward Kmett ekmett at gmail.com
Thu Apr 22 20:17:11 UTC 2021


Happy to see progress being made here. I think Ryan and others have spoken
to any issues I would otherwise raise with the implementation itself.
Currently I find myself reaching for unsafeCoerce over magicDict in most
situations, and I'd really like to be able to stop doing that!

I'm +1 on the name being something `reify`-ish, to avoid flipping the
direction on the vocabulary. It is reifying a value as a dictionary.
Something like `reifyValue` or `reifyAsDict` would avoid confusion as the
dict isn't being reified, the value is. Both are a little clunky, but it is
a very rare operation. It is also worth considering possibly mangling the
name with a # or an 'unsafe' in the name to give casual users pause.

-Edward

On Thu, Apr 22, 2021 at 12:18 PM Krzysztof Gogolewski <
krz.gogolewski at gmail.com> wrote:

> How about 'reifyDict'? The reflection library uses 'reify' to create a
> dictionary and 'reflect' to extract a value out of it.
>
>
> https://hackage.haskell.org/package/reflection-2.1.6/docs/Data-Reflection.html#v:reify
>
> On Thu, Apr 22, 2021 at 3:27 PM Spiwack, Arnaud <arnaud.spiwack at tweag.io>
> wrote:
> >
> > Let me upvote `reflectDict`.
> >
> > On Thu, Apr 22, 2021 at 12:41 PM Simon Peyton Jones via ghc-devs <
> ghc-devs at haskell.org> wrote:
> >>
> >> Ed, and other ghc-devs
> >>
> >> We are busy tidying up magicDict, and making it much more type-safe: see
> >>
> >> https://gitlab.haskell.org/ghc/ghc/-/issues/16646
> >> https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5573
> >>
> >> As part of that change we’re think of changing its
> currently-rather-obscure name.  I rather favour “reflectDict”.  Any other
> views?
> >>
> >> Simon
> >>
> >> _______________________________________________
> >> ghc-devs mailing list
> >> ghc-devs at haskell.org
> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> >
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210422/352f9f43/attachment.html>


More information about the ghc-devs mailing list