A good friend of mine convinced me about the benefits of Reactive Programming not that long ago. It almost feels wrong not to write Functional Reactive Programming -- the functional methodology lends itself magnificently to compliment reactive programming. So I decided to learn this stuff.
Knowing myself, I soon realized I would only ever get in the mindset if I had to solve some actual problems using the techniques. Having written JavaScript for the past few years, I could have just gone for RxJS. But again, I knew myself and felt it would give me way too much room for "going against the grain". I needed something that would enforce me to solve everything in a functional manner. This is where Elm comes in.
- Haskell-inspired language that compiles into HTML5
- immutable data
- strong types
- functional
- reactive
- all functions are pure
- no way to cause side-effects
- type annotations clarify the goal
- there are no loops
- mind-twister:
Signal.foldp
- a signal is a function of time
- for each moment, there exists a pure value of a signal
Signal.foldpreduces the value in the same sense asList.foldl-> each state of the interactive program is explicitly derived from all things that have happened in the past
- FP is often terse and readable
- reactive pattern makes input and output explicit
- no worries about weird states