<Documentation>//// Syntax test file for Gleam</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// This is a dummy example file and should not be taken as a reference of</Documentation><br/>
<Documentation>//// well written Gleam, but it does compile correctly appart from an error</Documentation><br/>
<Documentation>//// for the absent file "./ffi.mjs" and some warnings.</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// ## Top module documentation comment with markdown formatting</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// Formats: _italic text_, **bold text**, `monospace text`, ~~strikeout~~</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// Bullet list:</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// - item 1</Documentation><br/>
<Documentation>//// - item 2</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// Numbered list:</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// 1. item 1</Documentation><br/>
<Documentation>//// 2. item 2</Documentation><br/>
<Documentation>////</Documentation><br/>
<Documentation>//// [link](https://example.com)</Documentation><br/>
<Normal Text></Normal Text><br/>
<Comment>// </Comment><SPDX Tag>SPDX-FileCopyrightText:</SPDX Tag><Comment> 2024 Louis Guichard <glpda+kde@pm.me></Comment><br/>
<Comment>// </Comment><SPDX Tag>SPDX-License-Identifier:</SPDX Tag><SPDX Value> </SPDX Value><SPDX License>MIT</SPDX License><br/>
<Normal Text></Normal Text><br/>
<Keyword>import</Keyword><Normal Text> </Normal Text><Module>gleam/bit_array</Module><Normal Text> </Normal Text><Keyword>as</Keyword><Normal Text> </Normal Text><Module>bit_string</Module><br/>
<Keyword>import</Keyword><Normal Text> </Normal Text><Module>gleam/bool</Module><br/>
<Keyword>import</Keyword><Normal Text> </Normal Text><Module>gleam/dict</Module><Symbol>.{</Symbol><Keyword>type</Keyword><Normal Text> </Normal Text><Type>Dict</Type><Symbol>,</Symbol><Normal Text> delete</Normal Text><Symbol>,</Symbol><Normal Text> get</Normal Text><Symbol>,</Symbol><Normal Text> insert</Normal Text><Symbol>}</Symbol><br/>
<Keyword>import</Keyword><Normal Text> </Normal Text><Module>gleam/io</Module><br/>
<Normal Text></Normal Text><br/>
<Comment>// </Comment><Region Marker>BEGIN</Region Marker><br/>
<Normal Text></Normal Text><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>fn</Keyword><Normal Text> </Normal Text><Function>main</Function><Symbol>()</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> </Normal Text><Crash>assert</Crash><Normal Text> </Normal Text><Type>Ok</Type><Symbol>(</Symbol><Normal Text>prefix</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>=</Symbol><Normal Text> bit_string</Normal Text><Symbol>.</Symbol><Function>to_string</Function><Symbol>(</Symbol><Normal Text>prefix</Normal Text><Symbol>)</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> name</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>String</Type><Normal Text> </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><String>"Kate </String><EscapeSequence>\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}</EscapeSequence><String> "</String><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> </Normal Text><Crash>assert</Crash><Normal Text> </Normal Text><Type>Ok</Type><Symbol>(</Symbol><Normal Text>suffix</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Function>get</Function><Symbol>(</Symbol><Function>mascots</Function><Symbol>(),</Symbol><Normal Text> </Normal Text><String>"Lucy"</String><Symbol>)</Symbol><br/>
<Normal Text>  io</Normal Text><Symbol>.</Symbol><Function>println</Function><Symbol>(</Symbol><Normal Text>prefix </Normal Text><Symbol><></Symbol><Normal Text> name </Normal Text><Symbol><></Symbol><Normal Text> suffix</Normal Text><Symbol>)</Symbol><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>const</Keyword><Normal Text> prefix </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Symbol><<</Symbol><String>"Hello"</String><Symbol>:</Symbol><BitArrayOption>utf8</BitArrayOption><Symbol>,</Symbol><Normal Text> </Normal Text><Decimal>44</Decimal><Symbol>:</Symbol><BitArrayOption>size</BitArrayOption><Symbol>(</Symbol><Decimal>8</Decimal><Symbol>),</Symbol><Normal Text> </Normal Text><Decimal>32</Decimal><Symbol>:</Symbol><BitArrayOption>int</BitArrayOption><Symbol>>></Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>fn</Keyword><Normal Text> </Normal Text><Function>number</Function><Symbol>(</Symbol><Normal Text>int</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>use</Keyword><Normal Text> </Normal Text><Symbol><-</Symbol><Normal Text> bool</Normal Text><Symbol>.</Symbol><Function>guard</Function><Symbol>(</Symbol><Normal Text>when</Normal Text><Symbol>:</Symbol><Normal Text> int </Normal Text><Symbol><</Symbol><Normal Text> </Normal Text><Decimal>0</Decimal><Symbol>,</Symbol><Normal Text> return</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>False</Type><Symbol>)</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> dec </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Decimal>123_456_789</Decimal><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> bin </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Binary>0b10011011</Binary><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> oct </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Octal>0o1234567</Octal><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> hex </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Hex>0x8337_BEEF</Hex><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> _float </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Symbol>-</Symbol><Float>3.1415</Float><Normal Text> </Normal Text><Symbol>*.</Symbol><Normal Text> </Normal Text><Float>1.0e-4</Float><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> roof </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><Normal Text> dec </Normal Text><Symbol>+</Symbol><Normal Text> oct </Normal Text><Symbol>}</Symbol><Normal Text> </Normal Text><Symbol>*</Symbol><Normal Text> bin </Normal Text><Symbol>-</Symbol><Normal Text> hex </Normal Text><Symbol>}</Symbol><Normal Text> </Normal Text><Symbol>/</Symbol><Normal Text> </Normal Text><Decimal>4</Decimal><br/>
<Normal Text>  </Normal Text><Comment>// 4_246_851_061</Comment><br/>
<Normal Text>  </Normal Text><Keyword>case</Keyword><Normal Text> int </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>    _ </Normal Text><Keyword>if</Keyword><Normal Text> int </Normal Text><Symbol><</Symbol><Normal Text> roof </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>True</Type><br/>
<Normal Text>    _ </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>False</Type><br/>
<Normal Text>  </Normal Text><Symbol>}</Symbol><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Documentation>/// Documentation for a custom type with 3 variants</Documentation><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>opaque</Keyword><Normal Text> </Normal Text><Keyword>type</Keyword><Normal Text> </Normal Text><Type>CustomType</Type><Symbol>(</Symbol><Normal Text>a</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Documentation>/// first variant</Documentation><br/>
<Normal Text>  </Normal Text><Type>Var1</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>:</Symbol><Normal Text> a</Normal Text><Symbol>)</Symbol><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><Documentation>/// second variant</Documentation><br/>
<Normal Text>  </Normal Text><Type>Var2</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>:</Symbol><Normal Text> a</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>:</Symbol><Normal Text> a</Normal Text><Symbol>)</Symbol><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><Documentation>/// third variant</Documentation><br/>
<Normal Text>  </Normal Text><Type>Var3</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>:</Symbol><Normal Text> a</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>:</Symbol><Normal Text> a</Normal Text><Symbol>,</Symbol><Normal Text> z</Normal Text><Symbol>:</Symbol><Normal Text> a</Normal Text><Symbol>)</Symbol><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>fn</Keyword><Normal Text> </Normal Text><Function>first</Function><Symbol>(</Symbol><Normal Text>ct</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>CustomType</Type><Symbol>(</Symbol><Normal Text>a</Normal Text><Symbol>))</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> a </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  ct</Normal Text><Symbol>.</Symbol><Normal Text>x</Normal Text><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Attribute>@deprecated</Attribute><Symbol>(</Symbol><String>"Use last instead"</String><Symbol>)</Symbol><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>fn</Keyword><Normal Text> </Normal Text><Function>third</Function><Symbol>(</Symbol><Normal Text>ct</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>CustomType</Type><Symbol>(</Symbol><Normal Text>a</Normal Text><Symbol>))</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> a </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Comment>// let assert Var3(_, _, z) = ct  z</Comment><br/>
<Normal Text>  </Normal Text><Keyword>case</Keyword><Normal Text> ct </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>    </Normal Text><Type>Var3</Type><Symbol>(</Symbol><Normal Text>_</Normal Text><Symbol>,</Symbol><Normal Text> _</Normal Text><Symbol>,</Symbol><Normal Text> z</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> z</Normal Text><br/>
<Normal Text>    _ </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Crash>panic</Crash><br/>
<Normal Text>  </Normal Text><Symbol>}</Symbol><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>fn</Keyword><Normal Text> </Normal Text><Function>last</Function><Symbol>(</Symbol><Normal Text>ct</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>CustomType</Type><Symbol>(</Symbol><Normal Text>a</Normal Text><Symbol>))</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> a </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>case</Keyword><Normal Text> ct </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>    </Normal Text><Type>Var1</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> x</Normal Text><br/>
<Normal Text>    </Normal Text><Type>Var2</Type><Symbol>(</Symbol><Normal Text>_</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> y</Normal Text><br/>
<Normal Text>    </Normal Text><Type>Var3</Type><Symbol>(</Symbol><Normal Text>_</Normal Text><Symbol>,</Symbol><Normal Text> _</Normal Text><Symbol>,</Symbol><Normal Text> z</Normal Text><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> z</Normal Text><br/>
<Normal Text>  </Normal Text><Symbol>}</Symbol><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>type</Keyword><Normal Text> </Normal Text><Type>ListError</Type><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Type>EmptyList</Type><br/>
<Normal Text>  </Normal Text><Type>ListTooLong</Type><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Documentation>/// Converts a `List(a)` to a `Result(CustomType(a))`, empty list and list</Documentation><br/>
<Documentation>/// longer than 3 will return an error.</Documentation><br/>
<Documentation>///</Documentation><br/>
<Documentation>/// ## Examples</Documentation><br/>
<Documentation>///</Documentation><br/>
<Documentation>/// ```gleam</Documentation><br/>
<Documentation>/// from_list([1, 2, 3])</Documentation><br/>
<Documentation>/// // -> Ok(Var3(1, 2, 3))</Documentation><br/>
<Documentation>///</Documentation><br/>
<Documentation>/// from_list([1, 2, 3, 4, 5])</Documentation><br/>
<Documentation>/// // -> Error(ListTooLong)</Documentation><br/>
<Documentation>/// ```</Documentation><br/>
<Documentation>///</Documentation><br/>
<Keyword>pub</Keyword><Normal Text> </Normal Text><Keyword>fn</Keyword><Normal Text> </Normal Text><Function>from_list</Function><Symbol>(</Symbol><Normal Text>l</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>List</Type><Symbol>(</Symbol><Normal Text>a</Normal Text><Symbol>))</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Result</Type><Symbol>(</Symbol><Type>CustomType</Type><Symbol>(</Symbol><Normal Text>a</Normal Text><Symbol>),</Symbol><Normal Text> </Normal Text><Type>ListError</Type><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>case</Keyword><Normal Text> l </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>[</Symbol><Normal Text>x</Normal Text><Symbol>]</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Ok</Type><Symbol>(</Symbol><Type>Var1</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>))</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>[</Symbol><Normal Text>x</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>]</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Ok</Type><Symbol>(</Symbol><Type>Var2</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>))</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>[</Symbol><Normal Text>x</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>,</Symbol><Normal Text> z</Normal Text><Symbol>]</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Ok</Type><Symbol>(</Symbol><Type>Var3</Type><Symbol>(</Symbol><Normal Text>x</Normal Text><Symbol>,</Symbol><Normal Text> y</Normal Text><Symbol>,</Symbol><Normal Text> z</Normal Text><Symbol>))</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>[]</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Error</Type><Symbol>(</Symbol><Type>EmptyList</Type><Symbol>)</Symbol><br/>
<Normal Text>    _ </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Error</Type><Symbol>(</Symbol><Type>ListTooLong</Type><Symbol>)</Symbol><br/>
<Normal Text>  </Normal Text><Symbol>}</Symbol><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>fn</Keyword><Normal Text> </Normal Text><Function>mascots</Function><Symbol>()</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>Dict</Type><Symbol>(</Symbol><Type>String</Type><Symbol>,</Symbol><Normal Text> </Normal Text><Type>String</Type><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> old_mascots </Normal Text><Symbol>=</Symbol><Normal Text> dict</Normal Text><Symbol>.</Symbol><Function>from_list</Function><Symbol>([#(</Symbol><String>"Konqi"</String><Symbol>,</Symbol><Normal Text> </Normal Text><String>"🐉"</String><Symbol>),</Symbol><Normal Text> </Normal Text><Symbol>#(</Symbol><String>"Kandalf"</String><Symbol>,</Symbol><Normal Text> </Normal Text><String>"🧙"</String><Symbol>)])</Symbol><br/>
<Normal Text>  </Normal Text><Keyword>let</Keyword><Normal Text> new_mascots </Normal Text><Symbol>=</Symbol><br/>
<Normal Text>    old_mascots</Normal Text><br/>
<Normal Text>    </Normal Text><Symbol>|></Symbol><Normal Text> </Normal Text><Function>delete</Function><Symbol>(</Symbol><String>"Kandalf"</String><Symbol>)</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>|></Symbol><Normal Text> </Normal Text><Function>insert</Function><Symbol>(</Symbol><String>"Kate"</String><Symbol>,</Symbol><Normal Text> </Normal Text><String>"🐦"</String><Symbol>)</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>|></Symbol><Normal Text> </Normal Text><Function>insert</Function><Symbol>(</Symbol><String>"Katie"</String><Symbol>,</Symbol><Normal Text> </Normal Text><String>"🐉"</String><Symbol>)</Symbol><br/>
<Normal Text>    </Normal Text><Symbol>|></Symbol><Normal Text> </Normal Text><Function>insert</Function><Symbol>(</Symbol><String>"Lucy"</String><Symbol>,</Symbol><Normal Text> </Normal Text><String>"🌟"</String><Symbol>)</Symbol><br/>
<Normal Text>  new_mascots</Normal Text><br/>
<Symbol>}</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>type</Keyword><Normal Text> </Normal Text><Type>UserId</Type><Normal Text> </Normal Text><Symbol>=</Symbol><br/>
<Normal Text>  </Normal Text><Type>Int</Type><br/>
<Normal Text></Normal Text><br/>
<Attribute>@external</Attribute><Symbol>(</Symbol><Normal Text>javascript</Normal Text><Symbol>,</Symbol><Normal Text> </Normal Text><String>"./ffi.mjs"</String><Symbol>,</Symbol><Normal Text> </Normal Text><String>"call"</String><Symbol>)</Symbol><br/>
<Keyword>fn</Keyword><Normal Text> </Normal Text><Function>call</Function><Symbol>(</Symbol><Normal Text>id</Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Type>UserId</Type><Symbol>)</Symbol><Normal Text> </Normal Text><Symbol>-></Symbol><Normal Text> </Normal Text><Type>String</Type><Normal Text> </Normal Text><Symbol>{</Symbol><br/>
<Normal Text>  </Normal Text><Crash>todo</Crash><Normal Text> </Normal Text><Keyword>as</Keyword><Normal Text> </Normal Text><String>"call not implemented for this target"</String><br/>
<Symbol>}</Symbol><br/>
<Comment>// </Comment><Region Marker>END</Region Marker><br/>
