|
1 | | -@@ -1,24 +1,17 @@ |
| 1 | +@@ -1,29 +1,24 @@ |
2 | 2 | import gleam/io |
3 | 3 |
|
4 | | --// Uncomment this block to pass the first stage |
5 | | --// |
6 | | --// import gleam/erlang/process |
7 | | --// import gleam/option.{None} |
8 | | --// import gleam/otp/actor |
9 | | --// import glisten |
10 | | -+import gleam/erlang/process |
11 | | -+import gleam/option.{None} |
12 | | -+import gleam/otp/actor |
13 | | -+import glisten |
| 4 | + import gleam/erlang/process |
| 5 | + import gleam/option.{None} |
| 6 | + import gleam/otp/actor |
| 7 | + import glisten |
14 | 8 |
|
15 | 9 | pub fn main() { |
| 10 | + // Ensures gleam doesn't complain about unused imports in stage 1 (feel free to remove this!) |
| 11 | + let _ = glisten.handler |
| 12 | + let _ = glisten.serve |
| 13 | + let _ = process.sleep_forever |
| 14 | + let _ = actor.continue |
| 15 | + let _ = None |
| 16 | + |
16 | 17 | - // You can use print statements as follows for debugging, they'll be visible when running tests. |
17 | 18 | - io.println("Logs from your program will appear here!") |
18 | | -+ let assert Ok(_) = |
19 | | -+ glisten.handler(fn(_conn) { #(Nil, None) }, fn(_msg, state, _conn) { |
20 | | -+ io.println("Received message!") |
21 | | -+ actor.continue(state) |
22 | | -+ }) |
23 | | -+ |> glisten.serve(4221) |
24 | | - |
| 19 | +- |
25 | 20 | - // Uncomment this block to pass the first stage |
26 | 21 | - // |
27 | 22 | - // let assert Ok(_) = |
|
32 | 27 | - // |> glisten.serve(4221) |
33 | 28 | - // |
34 | 29 | - // process.sleep_forever() |
| 30 | ++ let assert Ok(_) = |
| 31 | ++ glisten.handler(fn(_conn) { #(Nil, None) }, fn(_msg, state, _conn) { |
| 32 | ++ io.println("Received message!") |
| 33 | ++ actor.continue(state) |
| 34 | ++ }) |
| 35 | ++ |> glisten.serve(4221) |
| 36 | ++ |
35 | 37 | + process.sleep_forever() |
36 | 38 | } |
0 commit comments