20 lines
No EOL
2.1 KiB
Text
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> =></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> =></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>=> <span class="hljs-string">"Hello teacher!"</span>
|
|
| <span class="hljs-module"><span class="hljs-identifier">Director</span> </span>=> <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>) =></span>
|
|
switch (configJson<span class="hljs-operator"> |> </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> =></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> =></span>
|
|
data<span class="hljs-operator"> |> </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) =></span> <span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">CachingServiceConfig</span>.</span></span>decode(json))
|
|
}; |