
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

Let me upvote `reflectDict`. On Thu, Apr 22, 2021 at 12:41 PM Simon Peyton Jones via ghc-devs < ghc-devs@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

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.ht...
On Thu, Apr 22, 2021 at 3:27 PM Spiwack, Arnaud
Let me upvote `reflectDict`.
On Thu, Apr 22, 2021 at 12:41 PM Simon Peyton Jones via ghc-devs
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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

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@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.ht...
On Thu, Apr 22, 2021 at 3:27 PM Spiwack, Arnaud
wrote: Let me upvote `reflectDict`.
On Thu, Apr 22, 2021 at 12:41 PM Simon Peyton Jones via ghc-devs <
ghc-devs@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Ah, yes... I can never remember which is reify and which is reflect. I'm fine either way. Maybe reifyDict is better.
S
| -----Original Message-----
| From: Krzysztof Gogolewski

While I do value consistency, let me pet-peeve for a minute here (sorry in advance Edward for the rant). The word “reify” comes from the latin “res”, which means object/thing. It should always mean something along the line of “making more concrete”. In normalisation by evaluation, for instance, you reify a semantic value as syntax (an object of the language of study), and you reflect values of the language into the semantic domain. To me, the reflection library uses the terms inconsistently. For instance you have the type ReifiedMonoid for the concrete type representing a monoid instance. This is, in my opinion, the right terminology. However, a ReifiedMonoid should be the product of reification, but in the reflection library it actually gets reify-d further. This doesn’t seem to work at the grammar level. I contend that the function should have been reflect all along: you reflect a concrete dictionary object into the nebulous, untouchable world of type class instances. It’s probably too late to fix the reflection library, hence me never complaining about it (in public :-) ). But I vote we don’t perpetuate this situation, and still call the function reflectDict.

This makes sense to me, and provides a good explanation for why I mix up
the terms.
So usual parlance is reify brings stuff back down/ reflect bounces it up?
On Fri, Apr 23, 2021 at 2:16 AM Spiwack, Arnaud
While I do value consistency, let me pet-peeve for a minute here (sorry in advance Edward for the rant). The word “reify” comes from the latin “res”, which means object/thing. It should always mean something along the line of “making more concrete”. In normalisation by evaluation, for instance, you reify a semantic value as syntax (an object of the language of study), and you reflect values of the language into the semantic domain.
To me, the reflection library uses the terms inconsistently. For instance you have the type ReifiedMonoid for the concrete type representing a monoid instance. This is, in my opinion, the right terminology. However, a ReifiedMonoid should be the product of reification, but in the reflection library it actually gets reify-d further. This doesn’t seem to work at the grammar level. I contend that the function should have been reflect all along: you reflect a concrete dictionary object into the nebulous, untouchable world of type class instances.
It’s probably too late to fix the reflection library, hence me never complaining about it (in public :-) ). But I vote we don’t perpetuate this situation, and still call the function reflectDict. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

I speak to much this same point in this old stack overflow response, though
to exactly the opposite conclusion, and to exactly the opposite pet peeve.
https://stackoverflow.com/a/5316014/34707
Let me see if I can try to explain why I think reasonable people can
disagree here and why I ultimately adopted the "wrong" vocabulary from your
perspective.
To be explicit:
Viewing a type as a space, 'reify' in the reflection library takes some
space 'a' and splits it into individual fibers for each term in 'a',
finding the appropriate one and handing it back to you as a fresh type 's'
that captures just that singular value. The result is significantly less
abstract, as we gained detail on the type, now every point in the original
space 'a' is a new space. At the type level the fresh 's' in s `Reifies` a
now concretely names exactly one inhabitant of 'a'.
On the flip side, 'reflect' in the reflection library forgets this finer
fibration / structure on space, losing the information about which fiber
the answer came from, being forgetful is precisely the justification of it
being the 'reflect' half of the reify -| reflect pairing.
I confess I don't necessarily anticipate this changing your mind but it was
not chosen blindly, reflect is the forgetful mapping here, reification is
free and left adjoint to it, at least in the context of
reflection-the-library, *where a quantifier is being injected to track the
particular member*.
This gets more muddled when you remove the quantifier, like here, now
everything becomes the same size, nothing is being forgotten when you use
"magicDict" to transform 5 :: Natural into dictionary for KnownNat (5 ::
Nat) or use the single member of the dictionary to get your value back. If
anything it goes the other way, because you _could_ evilly produce a
dictionary from 6 :: Natural and nothing but your conscience stops you. But
when used in a way that doesn't violate coherence of instance resolution,
no finer fibration was introduced, reflect isn't forgetful, neither is
reify, you produce singleton instances in a thin category from singleton
types. In that framework, really neither term seems fully appropriate here
-- or rather both do depending on your chosen perspective. This is where I
believe the religious wars about which is concrete and which is abstract
start up, because both uses satisfy that definition in this narrow case of
isomorphism, no information is lost on either end.
It is only when you actually introduce a quantifier to ensure 's' is fresh
(as it is used in the reflection library to ensure this doesn't compromise
instance resolution safety in general) that there is a bias introduced and
'reflect' forgets this hallucinated structure, finally forcing a
'handedness' on the terminology to use.
I do not feel that I chose the vocabulary without due consideration of the
precise meaning of the words used.
-Edward
On Thu, Apr 22, 2021 at 11:16 PM Spiwack, Arnaud
While I do value consistency, let me pet-peeve for a minute here (sorry in advance Edward for the rant). The word “reify” comes from the latin “res”, which means object/thing. It should always mean something along the line of “making more concrete”. In normalisation by evaluation, for instance, you reify a semantic value as syntax (an object of the language of study), and you reflect values of the language into the semantic domain.
To me, the reflection library uses the terms inconsistently. For instance you have the type ReifiedMonoid for the concrete type representing a monoid instance. This is, in my opinion, the right terminology. However, a ReifiedMonoid should be the product of reification, but in the reflection library it actually gets reify-d further. This doesn’t seem to work at the grammar level. I contend that the function should have been reflect all along: you reflect a concrete dictionary object into the nebulous, untouchable world of type class instances.
It’s probably too late to fix the reflection library, hence me never complaining about it (in public :-) ). But I vote we don’t perpetuate this situation, and still call the function reflectDict. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

On Sun, Apr 25, 2021 at 2:20 AM Edward Kmett
I speak to much this same point in this old stack overflow response, though to exactly the opposite conclusion, and to exactly the opposite pet peeve.
:-) I do not feel that I chose the vocabulary without due consideration of the
precise meaning of the words used.
I didn't mean to imply that you did. Sorry if I did so: written communication is hard. For what it's worth, I didn't really think that I would change your mind, either. Though it still seems to me that the name `ReifiedMonoid` uses the word for a different thing than the `reifyMonoid` function does. To be explicit:
Viewing a type as a space, 'reify' in the reflection library takes some space 'a' and splits it into individual fibers for each term in 'a', finding the appropriate one and handing it back to you as a fresh type 's' that captures just that singular value. The result is significantly less abstract, as we gained detail on the type, now every point in the original space 'a' is a new space. At the type level the fresh 's' in s `Reifies` a now concretely names exactly one inhabitant of 'a'.
On the flip side, 'reflect' in the reflection library forgets this finer fibration / structure on space, losing the information about which fiber the answer came from, being forgetful is precisely the justification of it being the 'reflect' half of the reify -| reflect pairing.
I confess I don't necessarily anticipate this changing your mind but it was not chosen blindly, reflect is the forgetful mapping here, reification is free and left adjoint to it, at least in the context of reflection-the-library, *where a quantifier is being injected to track the particular member*.
I've got to admit that I have the hardest time seeing the `s` as representing an inhabitant of `a`. I'm probably missing something here. I also don't think that a free object construction embodies a reify/reflect pair completely. It's probably fair to see `reify` as being the natural mapping from the free object of X to X (the counit of the adjunction). But reification will not be the unit of the adjunction, because it's trivial. So there is still a piece missing in this story. Anyway… I've made my point, and I am not too willing to spend too much time proving Wadler's law correct. So I think I'll stop here, fascinating a conversation though it is. Best, Arnaud

Can we just agree a name, then? Please correct me if I'm wrong, but
* I think Ed prefers 'reifyDict',
* That is compatible with the existing reflection library
* Arnaud disagrees but isn't going to die in the trenches for this one
* Virtually anything is better than 'magicDict'.
So: reifyDict it is?
Simon
From: Spiwack, Arnaud

I would like to propose one more option:
withDict :: dt -> (ct => a) -> a
1. This is less symmetric than '(ct => a) -> dt -> a'
but in existing applications magicDict gets the arguments
in the reverse order.
2. Easier to chain 'withDict d1 (withDict d2 ...)'.
3. The name is similar to 'withTypeable' or 'withFile',
and avoids arguing which is reify or reflect.
On Mon, Apr 26, 2021 at 9:41 AM Simon Peyton Jones via ghc-devs
Can we just agree a name, then? Please correct me if I’m wrong, but
I think Ed prefers ‘reifyDict’, That is compatible with the existing reflection library Arnaud disagrees but isn’t going to die in the trenches for this one Virtually anything is better than ‘magicDict’.
So: reifyDict it is?
Simon
From: Spiwack, Arnaud
Sent: 26 April 2021 08:10 To: Edward Kmett Cc: Simon Peyton Jones ; GHC developers Subject: Re: magicDict On Sun, Apr 25, 2021 at 2:20 AM Edward Kmett
wrote: I speak to much this same point in this old stack overflow response, though to exactly the opposite conclusion, and to exactly the opposite pet peeve.
https://stackoverflow.com/a/5316014/34707
:-)
I do not feel that I chose the vocabulary without due consideration of the precise meaning of the words used.
I didn't mean to imply that you did. Sorry if I did so: written communication is hard. For what it's worth, I didn't really think that I would change your mind, either.
Though it still seems to me that the name `ReifiedMonoid` uses the word for a different thing than the `reifyMonoid` function does.
To be explicit:
Viewing a type as a space, 'reify' in the reflection library takes some space 'a' and splits it into individual fibers for each term in 'a', finding the appropriate one and handing it back to you as a fresh type 's' that captures just that singular value. The result is significantly less abstract, as we gained detail on the type, now every point in the original space 'a' is a new space. At the type level the fresh 's' in s `Reifies` a now concretely names exactly one inhabitant of 'a'.
On the flip side, 'reflect' in the reflection library forgets this finer fibration / structure on space, losing the information about which fiber the answer came from, being forgetful is precisely the justification of it being the 'reflect' half of the reify -| reflect pairing.
I confess I don't necessarily anticipate this changing your mind but it was not chosen blindly, reflect is the forgetful mapping here, reification is free and left adjoint to it, at least in the context of reflection-the-library, where a quantifier is being injected to track the particular member.
I've got to admit that I have the hardest time seeing the `s` as representing an inhabitant of `a`. I'm probably missing something here.
I also don't think that a free object construction embodies a reify/reflect pair completely. It's probably fair to see `reify` as being the natural mapping from the free object of X to X (the counit of the adjunction). But reification will not be the unit of the adjunction, because it's trivial. So there is still a piece missing in this story.
Anyway… I've made my point, and I am not too willing to spend too much time proving Wadler's law correct. So I think I'll stop here, fascinating a conversation though it is.
Best,
Arnaud
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

| I would like to propose one more option:
|
| withDict :: dt -> (ct => a) -> a
Ah, you mean simply: swap the argument order. I can see your logic about chaining etc. I'd be fine with this.
Simon
| -----Original Message-----
| From: Krzysztof Gogolewski

I like withDict a lot. It is direct, easy to chain/use, avoids fighting
about direction completely, and even matches the argument order used by
reify in the reflection library.
+1 from me.
On Mon, Apr 26, 2021 at 7:49 AM Simon Peyton Jones
| I would like to propose one more option: | | withDict :: dt -> (ct => a) -> a
Ah, you mean simply: swap the argument order. I can see your logic about chaining etc. I'd be fine with this.
Simon
| -----Original Message----- | From: Krzysztof Gogolewski
| Sent: 26 April 2021 15:35 | To: Simon Peyton Jones | Cc: Spiwack, Arnaud ; Edward Kmett | ; GHC developers | Subject: Re: magicDict | | I would like to propose one more option: | | withDict :: dt -> (ct => a) -> a | | 1. This is less symmetric than '(ct => a) -> dt -> a' | but in existing applications magicDict gets the arguments | in the reverse order. | 2. Easier to chain 'withDict d1 (withDict d2 ...)'. | 3. The name is similar to 'withTypeable' or 'withFile', | and avoids arguing which is reify or reflect. | | On Mon, Apr 26, 2021 at 9:41 AM Simon Peyton Jones via ghc-devs wrote: | > | > Can we just agree a name, then? Please correct me if I'm wrong, | but | > | > I think Ed prefers 'reifyDict', | > That is compatible with the existing reflection library Arnaud | > disagrees but isn't going to die in the trenches for this one | > Virtually anything is better than 'magicDict'. | > | > | > | > | > | > So: reifyDict it is? | > | > | > | > Simon | > | > | > | > From: Spiwack, Arnaud | > Sent: 26 April 2021 08:10 | > To: Edward Kmett | > Cc: Simon Peyton Jones ; GHC developers | > | > Subject: Re: magicDict | > | > | > | > | > | > | > | > On Sun, Apr 25, 2021 at 2:20 AM Edward Kmett | wrote: | > | > I speak to much this same point in this old stack overflow response, | though to exactly the opposite conclusion, and to exactly the opposite | pet peeve. | > | > | > | > | https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstac | > | koverflow.com%2Fa%2F5316014%2F34707&data=04%7C01%7Csimonpj%40micro | > | soft.com%7C87da21fdcc8e4ed6bef508d908c071fb%7C72f988bf86f141af91ab2d7c | > | d011db47%7C1%7C0%7C637550444930791696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi | > | MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000& | > | sdata=VlRrIEROGj%2BE6%2FuLXBEdfa%2BPWVlHh50dahgjIrw4tQU%3D&reserve | > d=0 | > | > | > | > :-) | > | > | > | > I do not feel that I chose the vocabulary without due consideration | of the precise meaning of the words used. | > | > | > | > I didn't mean to imply that you did. Sorry if I did so: written | communication is hard. For what it's worth, I didn't really think that | I would change your mind, either. | > | > | > | > Though it still seems to me that the name `ReifiedMonoid` uses the | word for a different thing than the `reifyMonoid` function does. | > | > | > | > To be explicit: | > | > | > | > Viewing a type as a space, 'reify' in the reflection library takes | some space 'a' and splits it into individual fibers for each term in | 'a', finding the appropriate one and handing it back to you as a fresh | type 's' that captures just that singular value. The result is | significantly less abstract, as we gained detail on the type, now | every point in the original space 'a' is a new space. At the type | level the fresh 's' in s `Reifies` a now concretely names exactly one | inhabitant of 'a'. | > | > | > | > On the flip side, 'reflect' in the reflection library forgets this | finer fibration / structure on space, losing the information about | which fiber the answer came from, being forgetful is precisely the | justification of it being the 'reflect' half of the reify -| reflect | pairing. | > | > | > | > I confess I don't necessarily anticipate this changing your mind but | it was not chosen blindly, reflect is the forgetful mapping here, | reification is free and left adjoint to it, at least in the context of | reflection-the-library, where a quantifier is being injected to track | the particular member. | > | > | > | > I've got to admit that I have the hardest time seeing the `s` as | representing an inhabitant of `a`. I'm probably missing something | here. | > | > | > | > I also don't think that a free object construction embodies a | reify/reflect pair completely. It's probably fair to see `reify` as | being the natural mapping from the free object of X to X (the counit | of the adjunction). But reification will not be the unit of the | adjunction, because it's trivial. So there is still a piece missing in | this story. | > | > | > | > Anyway... I've made my point, and I am not too willing to spend too | much time proving Wadler's law correct. So I think I'll stop here, | fascinating a conversation though it is. | > | > | > | > Best, | > | > Arnaud | > | > _______________________________________________ | > ghc-devs mailing list | > ghc-devs@haskell.org | > | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail. | > haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=04%7C01 | > | %7Csimonpj%40microsoft.com%7C87da21fdcc8e4ed6bef508d908c071fb%7C72f988 | > | bf86f141af91ab2d7cd011db47%7C1%7C0%7C637550444930791696%7CUnknown%7CTW | > | FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 | > | Mn0%3D%7C1000&sdata=4JfXyRNMjQKTSLqme2VJU9Dy0s6N4Y8t%2BINHYp38xJk% | > 3D&reserved=0

You mean you like 'withDict' with that name, as well as the argument order K suggests? i.e. not reifyDict?
Simon
From: Edward Kmett

Indeed. Sent from my iPhone
On Apr 26, 2021, at 2:22 PM, Simon Peyton Jones
wrote: You mean you like ‘withDict’ with that name, as well as the argument order K suggests? i.e. not reifyDict?
Simon
From: Edward Kmett
Sent: 26 April 2021 21:34 To: Simon Peyton Jones Cc: Krzysztof Gogolewski ; Spiwack, Arnaud ; GHC developers ; Ryan Scott Subject: Re: magicDict I like withDict a lot. It is direct, easy to chain/use, avoids fighting about direction completely, and even matches the argument order used by reify in the reflection library.
+1 from me.
On Mon, Apr 26, 2021 at 7:49 AM Simon Peyton Jones
wrote: | I would like to propose one more option: | | withDict :: dt -> (ct => a) -> a
Ah, you mean simply: swap the argument order. I can see your logic about chaining etc. I'd be fine with this.
Simon
| -----Original Message----- | From: Krzysztof Gogolewski
| Sent: 26 April 2021 15:35 | To: Simon Peyton Jones | Cc: Spiwack, Arnaud ; Edward Kmett | ; GHC developers | Subject: Re: magicDict | | I would like to propose one more option: | | withDict :: dt -> (ct => a) -> a | | 1. This is less symmetric than '(ct => a) -> dt -> a' | but in existing applications magicDict gets the arguments | in the reverse order. | 2. Easier to chain 'withDict d1 (withDict d2 ...)'. | 3. The name is similar to 'withTypeable' or 'withFile', | and avoids arguing which is reify or reflect. | | On Mon, Apr 26, 2021 at 9:41 AM Simon Peyton Jones via ghc-devs wrote: | > | > Can we just agree a name, then? Please correct me if I'm wrong, | but | > | > I think Ed prefers 'reifyDict', | > That is compatible with the existing reflection library Arnaud | > disagrees but isn't going to die in the trenches for this one | > Virtually anything is better than 'magicDict'. | > | > | > | > | > | > So: reifyDict it is? | > | > | > | > Simon | > | > | > | > From: Spiwack, Arnaud | > Sent: 26 April 2021 08:10 | > To: Edward Kmett | > Cc: Simon Peyton Jones ; GHC developers | > | > Subject: Re: magicDict | > | > | > | > | > | > | > | > On Sun, Apr 25, 2021 at 2:20 AM Edward Kmett | wrote: | > | > I speak to much this same point in this old stack overflow response, | though to exactly the opposite conclusion, and to exactly the opposite | pet peeve. | > | > | > | > | https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstac | > | koverflow.com%2Fa%2F5316014%2F34707&data=04%7C01%7Csimonpj%40micro | > | soft.com%7C87da21fdcc8e4ed6bef508d908c071fb%7C72f988bf86f141af91ab2d7c | > | d011db47%7C1%7C0%7C637550444930791696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi | > | MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000& | > | sdata=VlRrIEROGj%2BE6%2FuLXBEdfa%2BPWVlHh50dahgjIrw4tQU%3D&reserve | > d=0 | > | > | > | > :-) | > | > | > | > I do not feel that I chose the vocabulary without due consideration | of the precise meaning of the words used. | > | > | > | > I didn't mean to imply that you did. Sorry if I did so: written | communication is hard. For what it's worth, I didn't really think that | I would change your mind, either. | > | > | > | > Though it still seems to me that the name `ReifiedMonoid` uses the | word for a different thing than the `reifyMonoid` function does. | > | > | > | > To be explicit: | > | > | > | > Viewing a type as a space, 'reify' in the reflection library takes | some space 'a' and splits it into individual fibers for each term in | 'a', finding the appropriate one and handing it back to you as a fresh | type 's' that captures just that singular value. The result is | significantly less abstract, as we gained detail on the type, now | every point in the original space 'a' is a new space. At the type | level the fresh 's' in s `Reifies` a now concretely names exactly one | inhabitant of 'a'. | > | > | > | > On the flip side, 'reflect' in the reflection library forgets this | finer fibration / structure on space, losing the information about | which fiber the answer came from, being forgetful is precisely the | justification of it being the 'reflect' half of the reify -| reflect | pairing. | > | > | > | > I confess I don't necessarily anticipate this changing your mind but | it was not chosen blindly, reflect is the forgetful mapping here, | reification is free and left adjoint to it, at least in the context of | reflection-the-library, where a quantifier is being injected to track | the particular member. | > | > | > | > I've got to admit that I have the hardest time seeing the `s` as | representing an inhabitant of `a`. I'm probably missing something | here. | > | > | > | > I also don't think that a free object construction embodies a | reify/reflect pair completely. It's probably fair to see `reify` as | being the natural mapping from the free object of X to X (the counit | of the adjunction). But reification will not be the unit of the | adjunction, because it's trivial. So there is still a piece missing in | this story. | > | > | > | > Anyway... I've made my point, and I am not too willing to spend too | much time proving Wadler's law correct. So I think I'll stop here, | fascinating a conversation though it is. | > | > | > | > Best, | > | > Arnaud | > | > _______________________________________________ | > ghc-devs mailing list | > ghc-devs@haskell.org | > | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail. | > haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=04%7C01 | > | %7Csimonpj%40microsoft.com%7C87da21fdcc8e4ed6bef508d908c071fb%7C72f988 | > | bf86f141af91ab2d7cd011db47%7C1%7C0%7C637550444930791696%7CUnknown%7CTW | > | FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 | > | Mn0%3D%7C1000&sdata=4JfXyRNMjQKTSLqme2VJU9Dy0s6N4Y8t%2BINHYp38xJk% | > 3D&reserved=0
participants (5)
-
Carter Schonwald
-
Edward Kmett
-
Krzysztof Gogolewski
-
Simon Peyton Jones
-
Spiwack, Arnaud