This repository has been archived by the owner on Dec 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
26 lines (26 loc) · 2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<p><meta charset="utf-8"> <link rel="stylesheet" href="https://tonyday567.github.io/other/lhs.css"></p>
<h1 id="haskell-todomvc-example">Haskell TodoMVC Example</h1>
<blockquote>
<p>Haskell is a strongly-typed, lazily-evaluated, functional programming language.</p>
</blockquote>
<ul class="incremental">
<li><p><a href="other/mvc-todo.html">live demo</a></p></li>
<li><p>with <a href="other/mvc-todo-auto.html">automation</a></p></li>
</ul>
<p>This example demonstrates an idiomatic haskell approach to the TodoMVC problem domain involving:</p>
<ul class="incremental">
<li>compilation of haskell to javascript using <a href="https://github.com/ghcjs/ghcjs">ghcjs</a>.</li>
<li>The specification of a <code>Model</code> representing the problem domain, consisting of</li>
<li>specification of Abstract Data Types (ADTs) for inputs, state and outputs.</li>
<li>an algebra between state and actions.</li>
<li>Use of the <a href="https://hackage.haskell.org/package/mvc">mvc</a> library for specification, asynchronicity and separation of model, view and controllers.</li>
<li>The creation of <code>View</code>s that consume model outputs, by using vanilla javascript effects.</li>
<li>The creation of <code>Controller</code>s that produce model inputs, by listening for Dom events using vanilla javascript.</li>
</ul>
<h1 id="recipe">recipe</h1>
<p>The recipe below handles the bits and bobs you need to do every re-compile. This includes a compression step via <a href="http://dl.google.com/closure-compiler">closure</a>.</p>
<pre>
<code style="white-space: pre-wrap;">
stack build --exec "pandoc -f markdown -i other/index.md -t html -o index.html --filter pandoc-include" --exec "java -jar $(stack path --local-bin)/closure-compiler-v20170124.jar --js_output_file=other/mvc-todo-auto.js $(stack path --local-install-root)/bin/mvc-todo-auto.jsexe/all.js" --exec "java -jar $(stack path --local-bin)/closure-compiler-v20170124.jar --js_output_file=other/mvc-todo.js $(stack path --local-install-root)/bin/mvc-todo.jsexe/all.js"
</code>
</pre>