-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation of Data.Singletons #599
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR!
Where does this quote come from, out of curiosity? Speaking for myself, I only partially agree with it. type instance Sing @Bool = SBool That is, you never define a On the other hand, the conventions surrounding instance SingI True
instance SingI False That being said, I don't think it's accurate to characterize this difference as a matter of indexing (the kinds for both This point is a bit unrelated to the choice of whether to use Relatedly, I'm curious to know what these "substantial changes" to the documentation you have in mind are. If I have a better sense of the direction of travel you want to take, it might help me contextualize some of these changes better. Hair-splitting about indexing aside, the Correct Haddock link: link to Sing pattern, not Sing type family and Fix Haddock commits are clear improvements. If nothing else, we should merge these. |
Oh, it's not a quote. I Just wanted to highlight what I consider as the "main principle" underlying how I think of this library.
OK, I submitted them separately here: #600 |
because it's simpler to think of this type variable as standing for a type rather than as standing for a kind
Yes, OK, there are invisible type applications floating around, which muddy the water, and in some sense the argument I'm talking about isn't an argument of When I see If we accept type family Sing @k :: k -> Type
type SingI :: forall {k}. k -> Constraint it would be clearer to have type family Sing @t :: t -> Type
type SingI :: forall {t}. t -> Constraint I don't think it's ever useful to think of the (visible) parameter of
It depends a great deal on the outcome of discussions like this one on earlier changes, but the general principle would be to relatively deprioritize the documentation of less-used pieces. I would say there is a some sort of exponential response to confusing documentation, so documentation that is "one unit" more difficult to understand is ten times more likely to make the reader close the tab, "two units" more difficult one hundred times more likely, etc.. Thus I would move the documentation of |
Oh, and if you want to know what I think very clear documentation looks like for this sort of thing, I refer you to my "reinvention" of |
OK, I think we are largely in agreement then. If you have In that case, I would welcome this PR as a step in the direction of making the documentation more accessible to newcomers. Perhaps we could even have an "expert section" of the Haddocks that talks more about the details of I will note that some of the existing naming conventions reflect an "expert" understanding of how
That sounds entirely reasonable to me. The current order is not an intentional choice by any means, and I would welcome efforts to better organize the Haddocks. |
Yes, that's rather awkward. I don't have a good idea about what to do about that! If it was my library I think I would start a slow transition process to rename them, but I realise that's a hard sell. |
|
In the second paragraph did you mean |
Oops, well spotted. I've edited my comment to fix this. |
Sadly, the terminology with regards to terms, types, expressions, kinds, values, etc, is all over the place in Haskell. The fundamental concepts at play do not cleanly map one-to-one with the words that are used to describe them. There are at least two meanings for "type", the meaning of "kind" changed in 8.0 (and to this day not everyone has caught up), the meaning of "value" is different in colloquial usage and literature, and so on and so forth. I don't see much sense in fiddling with this: it's going to be subtly incorrect or ambiguous no matter what labels we pick. With regards to the specific change proposed here, I find myself leaning slightly against. Reason: it is too early to move away from the "kind" terminology as long as |
Currently I would say that
singletons
is daunting. This should not be!The underlying principle is straightforward. It took me a long time to understand it, but now that I understand it, it's simple 😂 Now, I did have to pretty much reinvent it before I could understand it. I lay the blame at the feet of the documentation.
There are substantial changes that could make the documentation more approachable. This PR is a small effort in that direction. It contains two minor Haddock fixes, and a pervasive change which I hope will improve the situation a lot:
This PR changes the variable
k
tot
in many places to aid this change in thinking.I really don't think it's helpful to look at the below
case
statement and interpretb
as a variable standing for something of kindBool
, either typeTrue
or typeFalse
. That may or may not be technically correct (I don't know) but I think it is far more helpful for the intuition if I think of it as something of typeBool
, either valueTrue
or valueFalse
, just used at the type level.I think this way of thinking, encouraged by the notation in this PR, would go a long way to resolving the kinds of difficulties we see in, e.g. #260 (comment)
What do you think? I have a number of other suggestions for documentation improvements if you like this one.