You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only have one outgoing port, and only one incoming port
If you have many ports, they could be all over your project, and therefore hard to manage and easy for forget about. Keep track of all of them by representing your outgoing ports in a union type like..
type JsMsg=Download|LoginLogin.Payload|Logout|TrackTracking.Payload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Im one of the few lucky enough to write Elm at work. I write Elm in the evening and on the week ends too, so I am kind of Elm 24/7 nowadays. Naturally Ive developed patterns and techniques to my code, that have been invaluable to maximizing my productivity as a web developer. I will share those techniques below.
But before that, let me say that Im obviously not the first person to write up an Elm style guide. There are other style guides out there, and I would say Im in at least 90% agreement with them. Just repeating what other people have already said about writing good Elm code wouldnt add much, so I have listed techniques that dont seem to be already widespread. Also, they are listed in order of how unusual they are, with the most unusual on top. I would love a discussion about good technique, and I would love to improve, so I invite you to criticize me on anything in this document.
Never use anonymous functions
Every time you write an anonymous function, you forgo writin
Back in December 2017, I started working on something I called Elmish-Wasm, which was just an experimental repo to compile something Elm-like to Wasm. I made some progress, but the helpful people I talked and I came to the conclusion that most of what I had so far (Haskell and Regex to interpret .elm files into rudimentary wasm) was something the Elm compiler and the Elm AST already did. Writing that code was a lot of fun, but maybe not the most valuable way to explore Elm and WebAssembly. Before jumping back into this project I would like to record the important facts and questions related to compiling Elm to Wasm.
What is Wasm?
A lot of people talk about Web Assembly as if its C++ that runs in the browser. Thats not the case. This belief must come from that fact that C can currently compile to web assembly. Wasm is human-unreadable bytecode. There is a human-readable version of wasm, called wat. It looks like this..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the last year I have gotten hyped up about predictions. Why? heres a few reasons:
Statistics is fun. Rationality and cognition are fun topics.
It exercises self awareness. We all have beliefs about the world around us. How often do we deliberately test the accuracy of our beliefs? If you dont test yourself, how do you know your beliefs arent far off the mark? If your beliefs are really off the mark, is that going to work out well for you?
It exercises objectivity. We all feel certainty some of the time about some of the things. If you feel really certain, is that 70%? Is it 90%? 20 points is a big difference! If you can reliably put your certainty into a number, then all the powers of math are at your disposal.
Seems like being able to reliably predict useful things would be a pretty good ability to have, so its probably worth practicing.
To self improve, I am doing two sorts of predictions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters