-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
132 lines (112 loc) · 4.33 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="Maxim Sokhatsky" />
<title>N2O</title>
<link rel="stylesheet" href="https://n2o.dev/blank.css?x=12"/>
<link rel="stylesheet" href="https://n2o.dev/zima.css?x=12"/>
</head>
<body>
<nav>
<a href='https://n2o.dev/tech'>TECH</a>
<a href='https://o3.github.io/nitro/'>O3</a>
<a href='#'>N2O</a>
</nav>
<header>
<a href="https://github.com/o3/n2o"><img src="https://avatars.githubusercontent.com/u/45380730?s=200&v=4"></a>
<h1>N2O</h1>
</header>
<aside>
<article>
<section>
<h3>SYNOPSIS</h3>
<div>This project introduces N2O protocols for Haskell programming language.
The aim is to be compatible at transport level with Erlang version of N2O.
</div>
</section>
<section>
<a name=plugin><h3>MODULES</h3></a>
<div><ul>
<li><a href="man/int.htm">Network.N2O.Internal</a></font></li>
<li><a href="man/web.htm">Network.N2O.Web</a></font></li>
</ul></div>
<br/>
<div>
2018 © <a href="https://github.com/o3/n2o">Marat Khafizov</a> BSD 3-clause
</div>
</section>
<section>
<figure>
<code>
git clone https://github.com/o3/sample
stack build
stack exec n2o-sample
open http://localhost:3000/static/index.html
</code>
</figure>
</section>
</article>
</aside>
<main>
<section>
<h3>N2O Haskell</h3>
<p> N2O defines a way we scale protocols, database schema, applications and
services across companies, formatters, views and presentation layers.
At the core N2O folds a list of protocols and their handlers providing
a minimal type-level specification for general purpose application protocol tract.</p>
<p> As example this Haskell version of N2O is shipped with Nitro protocol
implementation, that listens the tract and push prerendered JavaScript
events back to the channel. This smart and simple reactive way
of client-server interaction first was used by Rusty Klophaus in
his Nitrogen web framework, that was pushed forward since then in
N2O by Andy Melnikov and Marat Khafizov.</p>
<p>The philosophy behind N2O is a simplicity, cleanness, and purity.
The core of N2O should be no more than 500 LOC.</p>
<figure>
<figcaption>Listing 2. N2O Context Setup</figcaption>
<code>
data Example = Greet deriving (Show, Eq, Read)
main = runServer "localhost" 3000 cx
cx = createCx router
router cx@Cx{cxReq=Req{reqPath=path}} =
let handler = case path of
"/ws/samples/static/index.html" -> index
"/ws/samples/static/about.html" -> about
_ -> index
in traceShow path cx{cxHandler=handler}
</code></figure>
<p>The idea to send prerendered JavaScript events over the
wire belongs to Rusty Klophaus who made Nitrogen Erlang web framework.
Later this was refined by N2O team and now is available
in its purity of Haskell.</p>
<figure>
<figcaption>Listing 3. NITRO Web Protocol</figcaption>
<code>
index Init = do
updateText "system" "What is your name?"
wireEl button{id="send", postback=Just Greet, source=["name"]}
index (Message Greet) = do
Just name <- get "name" -- wf:q/1
updateText "system" ("Hello, " <> jsEscape name <> "!")
about Init =
updateText "app" "This is the N2O Hello World App"
</code></figure>
<p>The N2O does not limit in developing only web applications.
N2O stack of protocols covers bus, storage, process interfaces.
Subscribe to follow Haskell implementations.</p>
</section>
<section>
<p>You may want to read:
<b><a href="man/web.htm">WEB</a></b>,
<b><a href="man/int.htm">INT</a></b>.
</p>
</section>
</main>
<footer>
Made with <span class="heart">❤</span> to Haskell and N2O
</footer>
</body>
</html>