This article was permanently moved to my personal website:
About: I'm a Functional Programming enthusiast and Senior Software Engineer at Bloomberg using OCaml at work. All opinions are my own.
This article was permanently moved to my personal website:
Gotcha 3 is actually a warning.
Indeed, it's a warning. Still, I found this behaviour surprising, and decided to describe it in my blog post 😌
Also, deciphering severity from the icons looks complicated.
I don't think it's critical for the blog post understanding. Just a little extra from me to make the text less boring.
My idea was:
For gotcha 2 you can use begin..end
. Something like this:
match .. with
| ... -> begin match .. with ... end
You can also directly match the reason
part in Pending
. Not always practical, but in your example, I might have written:
let show_status status =
match status with
| Cancelled -> "Cancelled"
| Done -> "Done"
| Pending Waiting -> "Pending: Waiting"
| Pending Validating -> "Pending: Validating"
Alternatively, you can use the local open syntax:...
Book.(book.words) >= 50000
You can also prefix the field name with its module: book.Book.words >= 50_000
;-)
Gotcha 3 is actually a warning.
Also, deciphering severity from the icons looks complicated.