presentations/highlight-js/test/markup/reasonml/pattern-matching.expect.txt

20 lines
No EOL
2.1 KiB
Text

<span class="hljs-keyword">let</span> message =
switch (person1) {
<span class="hljs-pattern-match">| <span class="hljs-constructor">School</span>.<span class="hljs-constructor">Teacher</span> =&gt;</span> <span class="hljs-string">"Hello teacher!"</span>
<span class="hljs-pattern-match">| <span class="hljs-constructor">School</span>.<span class="hljs-constructor">Director</span> =&gt;</span> <span class="hljs-string">"Hello director!"</span>
};
<span class="hljs-keyword">let</span> message =
<span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">School</span>.</span>(
switch (person1) {
| <span class="hljs-module"><span class="hljs-identifier">Teacher</span> </span>=&gt; <span class="hljs-string">"Hello teacher!"</span>
| <span class="hljs-module"><span class="hljs-identifier">Director</span> </span>=&gt; <span class="hljs-string">"Hello director!"</span>
}
)</span>;
<span class="hljs-keyword">let</span> readCacheServiceConfigAndDecode =<span class="hljs-function"> (<span class="hljs-params">configJson</span>) =&gt;</span>
switch (configJson<span class="hljs-operator"> |&gt; </span><span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">Js</span>.</span><span class="hljs-module"><span class="hljs-identifier">Json</span>.</span></span>decodeObject) {
<span class="hljs-pattern-match">| <span class="hljs-constructor">None</span> =&gt;</span> raise(Json.Decode.<span class="hljs-constructor">DecodeError(<span class="hljs-string">"Invalid Cache Config"</span>)</span>)
<span class="hljs-pattern-match">| <span class="hljs-constructor">Some(<span class="hljs-params">data</span>)</span> =&gt;</span>
data<span class="hljs-operator"> |&gt; </span><span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">Js</span>.</span><span class="hljs-module"><span class="hljs-identifier">Dict</span>.</span></span>map(<span class="hljs-function">(. json) =&gt;</span> <span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">CachingServiceConfig</span>.</span></span>decode(json))
};