-
-
Notifications
You must be signed in to change notification settings - Fork 186
/
index.html
260 lines (238 loc) Β· 9.39 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
---
layout: layout
preload:
# Preload hover image
- href: /images/lucy/lucyhappy.svg
as: image
---
{% capture header_content %}
<div>
<b>Gleam</b> is a <b>friendly</b> language for building
<b>type-safe</b> systems that <b>scale</b>!
</div>
<a class="button" href="https://tour.gleam.run/">Try Gleam</a>
{% endcapture %} {% include page-header.html image="/images/lucy/lucy.svg"
alt="Lucy the star, Gleam's mascot" content=header_content %}
<main role="main">
<section class="content home-pair intro">
<div>
<p>
The power of a type system, the expressiveness of functional
programming, and the reliability of the highly concurrent, fault
tolerant Erlang runtime, with a familiar and modern syntax.
</p>
</div>
<pre><code><span class="code-keyword">import</span> <span class="code-module">gleam/io</span>
<span class="code-keyword">pub fn</span> <span class="code-fn">main</span>() {
<span class="code-module">io.</span><span class="code-fn">println</span>(<span class="code-string">"hello, friend!"</span>)
}</code></pre>
</section>
<section class="home-top-sponsors">
<div class="content">
<h2>Kindly supported by</h2>
<ul>
<li>
<a
class="sponsor-level1"
href="https://lambdaclass.com/"
rel="noopener"
target="_blank"
>
<img
src="/images/sponsors/lambda-class-black.png"
alt="Lambda Class"
/>
</a>
</li>
</ul>
<a
class="sponsor-level0"
href="https://github.com/sponsors/lpil"
rel="noopener"
target="_blank"
>
and sponsors like you!
</a>
</div>
</section>
<section class="content home-pair">
<div>
<h2>Reliable and scalable</h2>
<p>
Running on the battle-tested Erlang virtual machine that powers
planet-scale systems such as WhatsApp and Ericsson, Gleam is ready for
workloads of any size.
</p>
<p>
Thanks to a multi-core actor based concurrency system that can run
millions of concurrent tasks, fast immutable data structures, and a
concurrent garbage collector that never stops the world, your service
can scale and stay lightning fast with ease.
</p>
</div>
<pre><code><span class="code-keyword">fn</span> <span class="code-fn">spawn_task</span>(i) {
<span class="code-module">task.</span><span class="code-fn">async</span>(<span class="code-keyword">fn</span>() {
<span class="code-keyword">let</span> n = <span class="code-module">int.</span><span class="code-fn">to_string</span>(i)
<span class="code-module">io.</span><span class="code-fn">println</span>(<span class="code-string">"Hello from "</span> <span class="code-operator"><></span> n)
})
}
<span class="code-keyword">pub fn</span> <span class="code-fn">main</span>() {
<span class="code-comment">// Run loads of threads, no problem</span>
<span class="code-module">list.</span><span class="code-fn">range</span>(<span class="code-number">0</span>, <span class="code-number">200_000</span>)
<span class="code-operator">|></span> <span class="code-module">list.</span><span class="code-fn">map</span>(<span class="code-fn">spawn_task</span>)
<span class="code-operator">|></span> <span class="code-module">list.</span><span class="code-fn">each</span>(<span class="code-module">task.</span><span class="code-fn">await_forever</span>)
}
</code></pre>
</section>
<section class="content home-pair">
<div>
<h2>Ready when you are</h2>
<p>
Gleam comes with compiler, build tool, formatter, editor integrations,
and package manager all built in, so creating a Gleam project is just
running <code>gleam new</code>.
</p>
<p>
As part of the wider BEAM ecosystem, Gleam programs can use thousands of
published packages, whether they are written in Gleam, Erlang, or
Elixir.
</p>
</div>
<pre><code><span class="code-prompt">β (main)</span> gleam add gleam_json
<span class="code-operator"> Resolving</span> versions
<span class="code-operator">Downloading</span> packages
<span class="code-operator"> Downloaded</span> 2 packages in 0.01s
<span class="code-operator"> Added</span> gleam_json v0.5.0
<span class="code-prompt">β (main)</span> gleam test
<span class="code-operator"> Compiling</span> thoas
<span class="code-operator"> Compiling</span> gleam_json
<span class="code-operator"> Compiling</span> app
<span class="code-operator"> Compiled</span> in 1.67s
<span class="code-operator"> Running</span> app_test.main
<span class="code-success">.
1 tests, 0 failures</span>
</code></pre>
</section>
<section class="content home-pair">
<div>
<h2>Here to help</h2>
<p>
No null values, no exceptions, clear error messages, and a practical
type system. Whether you're writing new code or maintaining old code,
Gleam is designed to make your job as fun and stress-free as possible.
</p>
</div>
<pre><code><span class="code-error">error:</span> Unknown record field
ββ ./src/app.gleam:8:16
β
8 β user.alias
β <span class="code-error"> ^^^^^^ Did you mean `name`?</span>
The value being accessed has this type:
User
It has these fields:
.name
</code></pre>
</section>
<section class="content home-pair">
<div>
<h2>Multilingual</h2>
<p>
Gleam makes it easy to use code written in other BEAM languages such as
Erlang and Elixir, so there's a rich ecosystem of thousands of open
source libraries for Gleam users to make use of.
</p>
<p>
Gleam can additionally compile to JavaScript, enabling you to use your
code in the browser, or anywhere else JavaScript can run. It also
generates TypeScript definitions, so you can interact with your Gleam
code confidently, even from the outside.
</p>
</div>
<pre><code>
<span class="code-keyword">@external</span>(erlang, <span class="code-string">"Elixir.HPAX", "new"</span>)
<span class="code-keyword">pub fn</span> <span class="code-fn">new</span>(size: <span class="code-type">Int</span>) -> <span class="code-type">Table</span>
<span class="code-keyword">pub fn</span> <span class="code-fn">register_event_handler</span>() {
<span class="code-keyword">let</span> el = <span class="code-module">document.</span><span class="code-fn">query_selector</span>(<span class="code-string">"a"</span>)
<span class="code-module">element.</span><span class="code-fn">add_event_listener</span>(el, <span class="code-keyword">fn</span>() {
<span class="code-module">io.</span><span class="code-fn">println</span>(<span class="code-string">"Clicked!"</span>)
})
}</code></pre>
</section>
<section class="home-friendly">
<!-- TODO: add triangles here -->
<div class="content">
<h2>Friendly π</h2>
<p>
As a community, we want to be friendly too. People from around the
world, of all backgrounds, genders, and experience levels are welcome
and respected equally. See our community code of conduct for more.
</p>
<p>
<!-- Hello! If you make a PR changing this I will ban you. -->
Black lives matter. Trans rights are human rights. No nazi bullsh*t.
</p>
</div>
<!-- TODO: add Lucy here -->
<img
class="home-waves"
src="/images/waves.svg"
alt="a soft wavey boundary between two sections of the website"
/>
</section>
<section class="home-sponsors">
<div class="content">
<h2>Lovely people</h2>
<p>
If you enjoy Gleam consider
<a href="https://github.com/sponsors/lpil">becoming a sponsor</a>
(or tell your boss to)
</p>
</div>
<div class="home-sponsors-list">
<ul data-randomise-order>
{% assign sponsors_count = site.data.sponsors | size %} {% assign
sponsors = site.data.sponsors | sample: sponsors_count %} {% for sponsor
in sponsors %}
<li>
<a href="{{ sponsor.url }}" rel="noopener" target="_blank">
<img
loading="lazy"
src="{{ sponsor.avatar }}"
class="{% unless sponsor.square_avatar %}round{% endunless %}"
alt="{{ sponsor.name }}"
/>
</a>
{% endfor %}
</li>
</ul>
<a data-expand-sponsors></a>
</div>
</section>
<section class="home-still-here">
<div class="content">
<h2>You're still here?</h2>
<p class="go-read">
Well, that's all this page has to say. Maybe you should go read the
language tour!
</p>
<a class="button" href="https://tour.gleam.run/">Let's go!</a>
<hr />
<h3>Wanna keep in touch?</h3>
<p>Subscribe to the Gleam newsletter</p>
<script
async
src="https://eocampaign1.com/form/ebfa5ade-6f63-11ed-8f94-ef3b2b6b307a.js"
data-form="ebfa5ade-6f63-11ed-8f94-ef3b2b6b307a"
></script>
<p>
We send emails at most a few times a year, and we'll never share your
email with anyone else.
</p>
<p class="recaptcha-blerb">
This site is protected by reCAPTCHA and the Google
<a href="https://policies.google.com/privacy">Privacy Policy</a> and
<a href="https://policies.google.com/terms">Terms of Service</a> apply.
</p>
</div>
</section>
</main>