-
Notifications
You must be signed in to change notification settings - Fork 193
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
Ch8 - Clarify Either e
#162
Comments
What is the motivation behind making the type variable |
I believe the |
Working in making courses and tutorials for gamedev for a while I would say that explicit is better than implicit in 99% of the cases. We ended up doing even trivial stuff like for index in range(10):
# ...
func set_width(value: float) -> void:
# ... instead of for i in range(10):
# ...
func set_width(val: float) -> void:
# ... Why? Because we have to consider beginners that have no coding background as well and it's just easier for them to keep track of what's happening, it's closer to real language and they learn a lot faster through repetition: "oh, if there's a With that said, all the short versions, |
Full form could be good ( But I feel like the main source of confusion here is in mixing-up |
Well two things:
There's a lot that people coming from other imperative languages are going to miss on a first pass. It might even be a good idea to have a subchapter somewhere discussing terminology. Like |
Ch7 is pretty heavy with single-letter variable names, so I think this would be a good place to experiment with the feasibility of longer names and decide on a policy of where we draw the line on when to go longform. Do you want to make a PR for Ch7 with the proposal you have in mind? For example, do we expand the type variables of our custom combineList :: forall f a. Applicative f => List (f a) -> f (List a)
sequence :: forall a m. Applicative m => t (m a) -> m (t a)
We can certainly do more to cater to folks coming from specific languages. I'd like to make comparisons (and cheatsheets) for other languages purescript/documentation#334. The book's intro would be a good place to link to the comparisons (discussed in #173). Contrasting OOP involves more work, so I'm thinking we can leverage existing Haskell content - posted some ideas for that in purescript/documentation#334 (comment). |
I don't agree with this at all, actually. I think |
Yeah, I have to think a bit more about this cause when comparing with functions from libraries doesn't seem like it's a good idea to use full-words, didn't think about it at the time. |
☝️ |
I think you guys have the misconception that using full-words instead of symbols is antithetical to teaching beginners the basics. The idea is to make a smother transition. I've been thinking about this a bit and given the above example I'd do something like: combineList :: forall any applicative . Applicative applicative => List (applicative any) -> applicative (List any)
sequence :: forall a m t. Traversable t => Applicative m => t (m a ) -> m (t a ) That's to say we keep the symbolic form of the library functions, but whatever we write as explanations/exercises we use full-words. When I get a chance I'll make a PR to see it in practice and see if we can agree on something. |
I understand where you’re coming from, I just don’t agree. Using full words for type variables encourages the reader to derive meaning from those type variables, when really they should be looking at everything else in the type signature except the type variable names. As for that specific example, |
Yeah, I know what you mean, I guess we probably just disagree about this, let's see what the others have to say. As for |
So I've been thinking lately about this and looked at ch7. The complication with long-form type variables is that a lot of examples from Prelude and other libraries use short-form variables and I don't think we can get around this so I'm dropping the idea of long-form. I guess FP is just special that way :) |
See #161
There may be an ever earlier appearance to address, and perhaps for a different type constructor too..
The text was updated successfully, but these errors were encountered: