displays & solves a puzzle How to create a basic elm app, the exact pattern that influenced redux FP building blocks can feel like huge obstacles and how to make use of them IoT gadgets coded with FP Never been easier to build elm app but how easy is that?
to ask questions. One to one chats better for the bar later or emails My contact details are at the end, do get in touch Also fine not to understand everything at once, I'm working through a lot of this myself Yesterday's keynote speaker said earlier this year that we are all writing good code now. I completely agree, this talk is to present new ideas, not to downplay anything we're doing now.
I just write Haskell programs What follows is how I see/understand things It may or may not exactly match the books, wikis, academic papers, mathematical proofs etc.
doing FP, I've been looking to improve since then • We hear a lot about Elm and it's benefits • However, many people try it and drop it quickly • Why? Is it useful or not?
game puzzle • Converted Haskell to interactive Elm app – It simulates the puzzle and calculates the solution • We'll consider the solution(s) • Can we take lessons from FP back to js ? – We'll see the Elm/Haskell code converted to Angular2,RxJs, Typescript app • Is elm a temporary fad or part of all our futures?
now on Esp8266 – it's got me thinking! • Map, reduce etc • The blueprint for Js, with some C constructs on top. – No wonder we have such a great time with it! – Private data closure pattern from lisp • Abelson and Sussman’s classic Structure and Interpretation of Computer Programs • ES6 just catching up Lisp 30 years later – backticks, symbols
casts or ignore flags … Can decide not to specify type – Haskell complains if this does not hold up It does have the notion of type groups – num, equality … (C# generic constraints)
are like arrays Any length – can only hold a single type Tuples are like, er, multiples ? Fixed length – may store multiple types Algebraic create our own from the above (diy) plus a part we specify (e.g. Tree Int) Records object-like syntactic sugar in Elm, a bit duck type-y
3: [] Pass as params like this xs entire list x:xs x is “head”, xs is “tail” (destructuring like es6) FP functions are designed to work with head of list as much as possible
to go through secLoop and attach to copy of first item This creates a LoopsPermutation - two loops mixed, perhaps In effect, basis for solution/algorithm – see in app Here, Haskell code is little different from any modern language (that uses an anonymous function)
perms items So keep memory use limited to a small amount Since then, have heard about “constant space” Created a revised version of this, which filters the items before processing
FP • FP can be as lightweight as Lua • These programs were written or prototyped in Haskell and Elm, then converted • Bit of a proof of concept, much like micro-python
small code, test it, fit together – pattern from lisp 30 years ago, much like tdd – Do the same with data structures • Types show transformations, search for type pattern, not just code • Tail recursion (waiting on Node for this!)
infinite streams we can choose to get first item only Typescript – preserves Haskell types They stand out clearly Are they useful? What have we gained or lost by this functional programming style ?
but get a flavour Like that the Haskell types transfer well We have lazy eval – we declare operations But nothing happens until x amount of data requested What have we gained or lost by this functional programming style ?