Vlad Ardelean’s Reviews > Real World Haskell > Status Update

Vlad Ardelean
Vlad Ardelean is starting
logging stuff while debugging code was probably so annoying for the creators of Haskell, that they decided to break its purity, for the sake of productivity:
https://hackage.haskell.org/package/b...

trace :: String -> a -> a

this PRINTS the string, and returns the a, but it's not marked as `String -> a -> IO a`...so compiler doesn't force you have to have to rewrite lots of code.
Jun 24, 2021 07:39AM
Real World Haskell

flag

Vlad’s Previous Updates

Vlad Ardelean
Vlad Ardelean is starting
Chapter 9 shows a nice example of a piece of code written at the beginner level, vs the same code written by a more advanced hasketier. Nice to know!
Jun 19, 2021 10:07PM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
Interesting little function: flip

r = \x -> f x arg

is equiv. to

r = flip f arg

...same thing, less readable XD
Jan 31, 2021 11:40PM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
The author's ubiquitous anecdotes about how lots of bugs are caused by side-effects and how haskell provides out-of-the-box parallelism are extremely annoying.
Feels like he's trying to convert children to his religion.
Then again book is called "real world haskell, code you can believe in", so I should have expected religious fanaticism here...of which there is plenty. Too bad he's treating the topic anecdotically.
Jan 23, 2021 01:56AM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
Haskell design pattern:
When creating new types (newtype/data), DO NOT export the data constructors.

Export:
1. The type constructor
2. A function which creates data of that type (frim more basic types)
3. A function which turns our data back to something more basic (strings/lists/ints/etc)

As such, clients using our type can't start poking in its internals, and updates can't break their code. Less breakage surface
Jan 22, 2021 12:35PM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
Ok, so this is a function writte in "point-free" style.
func = f1 . f2 . f3

...lots of "points" there! Doesn't look too free of points XD
JK, "point-free" meams "no reference to the data. "Point" is supposed to stand for "data point"
Jan 16, 2021 11:21AM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
good tutorial for converting recursive functions to folds

http://www.cs.nott.ac.uk/~gmh/fold.pdf
Jan 12, 2021 11:35AM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
In the book, the topic of zip-ing with any number of lists is mentioned. Same in LYAHFGG.

This article mentions functions with any number of params. Very very hard to figure out:

https://wiki.haskell.org/Varargs

...still not the same as zip-ing, but interesting!
Dec 31, 2020 11:21PM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
There'a a compiler flag to warn against non-exhaustive patterns in function definitions! Nice! Had the problem a few times, was wondering about it.
Dec 30, 2020 02:07AM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
Haskell has curly braces! One could use those instead of indentation.
Good to know!
Dec 30, 2020 02:03AM
Real World Haskell


Vlad Ardelean
Vlad Ardelean is starting
Oh no, scratch the last comment. Algebraic data types are "haskell data types"... ok, got it!
Dec 29, 2020 03:01AM
Real World Haskell


No comments have been added yet.