Today I started to read for the 3rd time Purescript by Example. First time with proper idea what I want to write :)
It should be helpful in future learning.
Following chapter 3 we can find that indentation matters. That’s a good finding!
And yes - we have at least one winner! In 3.13 there’s a nice explenation what does $ mean! It it connected with curring. It can be used to omit parentheses. It makes code more readible. Haskell people are using it all the time so probably it’ll be our second nature.
$ can be readed as: “evalutate on the right of it and apply result to function on the left side on it”.
Working example (after installing purescript-lists)
Take first element from generated list of integers from 1 to 20
Reading this chapter and looking at corresponding source code we cannot find other answer to yesterday’s questions (what does = do mean). Instead we can find some new language constructions:
::
- similar to Haskell’s type definition. On the left side we have name, on the right side - types- functions takes always one argument with automatic curring
>>>
and<<<
- composition operators. Bread and butter in functional world. One is “from left” and another is “from right”.
Composition
Let’s try consider following examples - we want all elements but first from filtered list of integers: