You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Finally we can run the resulting <code>Eval</code> to actually execute the computation:</p>
292
292
<preclass="keep-together pdf epub"><codeclass="nohighlight"><spanclass="identifier">eval</span><span>.</span><spanclass="identifier">value</span><span>
293
293
</span><spanclass="comment">// Persisting updated user to the DB: User(100,Bob,150)
<preclass="keep-together pdf epub"><codeclass="nohighlight"><spanclass="keyword">val</span><span></span><spanclass="identifier">validator</span><span> = </span><spanclass="identifier">prog</span><span>.</span><spanclass="identifier">foldMap</span><span>[</span><spanclass="type-name">FromString</span><span>](</span><spanclass="identifier">compiler</span><span>)
<p>Note that the inferred type of <code>valid</code> correctly models that this computation can be executed only with an initial <code>Closed</code> state.</p>
480
480
<preclass="keep-together pdf epub"><codeclass="nohighlight"><spanclass="identifier">valid</span><span>.</span><spanclass="identifier">run</span><span>(</span><spanclass="type-name">Open</span><span>)
481
481
</span><spanclass="comment">// error: type mismatch;
<preclass="keep-together pdf epub"><codeclass="nohighlight"><spanclass="identifier">valid</span><span>.</span><spanclass="identifier">run</span><span>(</span><spanclass="type-name">Closed</span><span>)
<preclass="keep-together pdf epub"><codeclass="nohighlight"><spanclass="identifier">nelBimonad</span><span>.</span><spanclass="identifier">pure</span><span>(</span><spanclass="boolean-literal">true</span><span>).</span><spanclass="identifier">extract</span><span> === </span><spanclass="type-name">NonEmptyList</span><span>.</span><spanclass="identifier">one</span><span>(</span><spanclass="boolean-literal">true</span><span>).</span><spanclass="identifier">head</span><span>
0 commit comments