Skip to content

Commit

Permalink
deploy: 1cc04ec
Browse files Browse the repository at this point in the history
  • Loading branch information
rossabaker committed Nov 21, 2024
1 parent ddf4e53 commit c3905ec
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion ADOPTERS.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ <h1 id="adopters" class="title">Adopters</h1>
<li><a href="https://www.colisweb.com/">Colisweb</a></li>
<li><a href="https://compstak.com">CompStak</a></li>
<li><a href="https://coya.com/">Coya</a></li>
<li><a href="https://www.criteo.com/">Criteo</a></li>
<li><a href="https://datumbrain.com/">Datum Brain</a></li>
<li><a href="https://disney.com/">Disney</a></li>
<li><a href="https://zd.drip.im">Dripower LTD</a></li>
Expand Down Expand Up @@ -278,7 +279,6 @@ <h1 id="adopters" class="title">Adopters</h1>
<li><a href="https://www.innfactory.de/">innFactory GmbH</a></li>
<li><a href="https://www.intenthq.com/">Intent HQ</a></li>
<li><a href="https://www.iofod.com/">iofod</a></li>
<li><a href="https://www.iponweb.com/">IPONWEB</a></li>
<li><a href="https://www.iteratorshq.com/">Iterators</a></li>
<li><a href="https://www.itv.com/">ITV</a></li>
<li><a href="https://www.kaluza.com">Kaluza</a></li>
Expand Down
12 changes: 6 additions & 6 deletions datatypes/contt.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ <h1 id="contt" class="title">ContT</h1>
</span><span class="type-name">Succeeded</span><span>(</span><span class="identifier">user</span><span>.</span><span class="identifier">id</span><span>)
}
}
</span><span class="comment">// eval: Eval[UserUpdateResult] = cats.Later@68edb6dd</span></code></pre>
</span><span class="comment">// eval: Eval[UserUpdateResult] = cats.Later@196ba180</span></code></pre>
<p>Finally we can run the resulting <code>Eval</code> to actually execute the computation:</p>
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="identifier">eval</span><span>.</span><span class="identifier">value</span><span>
</span><span class="comment">// Persisting updated user to the DB: User(100,Bob,150)
Expand All @@ -308,7 +308,7 @@ <h2 id="composition" class="section"><a class="anchor-link left" href="#composit
}
</span><span class="comment">// anotherComputation: ContT[Eval, UserUpdateResult, Map[String, String]] = FromFn(
// runAndThen = Single(
// f = cats.data.ContT$$Lambda$14430/0x00007f6330685398@32a2b5ea,
// f = cats.data.ContT$$Lambda$14325/0x00007f8b80680988@2b6918be,
// index = 0
// )
// )
Expand All @@ -319,7 +319,7 @@ <h2 id="composition" class="section"><a class="anchor-link left" href="#composit
</span><span class="type-name">Succeeded</span><span>(</span><span class="identifier">userFields</span><span>(</span><span class="string-literal">&quot;id&quot;</span><span>).</span><span class="identifier">toInt</span><span>)
}
}
</span><span class="comment">// anotherEval: Eval[UserUpdateResult] = cats.Eval$$anon$5@6435b180
</span><span class="comment">// anotherEval: Eval[UserUpdateResult] = cats.Eval$$anon$5@4833986d
</span><span>
</span><span class="identifier">anotherEval</span><span>.</span><span class="identifier">value</span><span>
</span><span class="comment">// Persisting these fields to the DB: Map(id -&gt; 100, name -&gt; Bob, age -&gt; 150)
Expand All @@ -336,7 +336,7 @@ <h2 id="composition" class="section"><a class="anchor-link left" href="#composit
}
</span><span class="comment">// updateUserModel: ContT[Eval, UserUpdateResult, User] = FromFn(
// runAndThen = Single(
// f = cats.data.ContT$$Lambda$14430/0x00007f6330685398@9a086f1,
// f = cats.data.ContT$$Lambda$14325/0x00007f8b80680988@59dc86b,
// index = 0
// )
// )
Expand Down Expand Up @@ -370,7 +370,7 @@ <h2 id="composition" class="section"><a class="anchor-link left" href="#composit
</span><span class="identifier">updateUserModel</span><span> </span><span class="identifier">flatMap</span><span> </span><span class="identifier">persistToDb</span><span> </span><span class="identifier">flatMap</span><span> </span><span class="identifier">publishEvent</span><span>
</span><span class="comment">// chainOfContinuations: ContT[Eval, UserUpdateResult, UserUpdateResult] = FromFn(
// runAndThen = Single(
// f = cats.data.ContT$$Lambda$14434/0x00007f6330685d20@6c75cdce,
// f = cats.data.ContT$$Lambda$14329/0x00007f8b80681310@658c89b3,
// index = 0
// )
// )
Expand All @@ -381,7 +381,7 @@ <h2 id="composition" class="section"><a class="anchor-link left" href="#composit
</span><span class="identifier">finalResult</span><span>
}
}
</span><span class="comment">// eval: Eval[UserUpdateResult] = cats.Eval$$anon$5@d9681f0
</span><span class="comment">// eval: Eval[UserUpdateResult] = cats.Eval$$anon$5@399d7a4d
</span><span>
</span><span class="identifier">eval</span><span>.</span><span class="identifier">value</span><span>
</span><span class="comment">// Updated user model
Expand Down
4 changes: 2 additions & 2 deletions datatypes/eval.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ <h4 id="eval-later" class="section"><a class="anchor-link left" href="#eval-late
</span><span class="identifier">println</span><span>(</span><span class="string-literal">&quot;Running expensive calculation...&quot;</span><span>)
</span><span class="number-literal">1</span><span> + </span><span class="number-literal">2</span><span> * </span><span class="number-literal">3</span><span>
}
</span><span class="comment">// lazyEval: Eval[Int] = cats.Later@198aec11
</span><span class="comment">// lazyEval: Eval[Int] = cats.Later@7d1822b2
</span><span>
</span><span class="identifier">lazyEval</span><span>.</span><span class="identifier">value</span><span>
</span><span class="comment">// Running expensive calculation...
Expand All @@ -276,7 +276,7 @@ <h4 id="eval-always" class="section"><a class="anchor-link left" href="#eval-alw
</span><span class="identifier">println</span><span>(</span><span class="string-literal">&quot;Running expensive calculation...&quot;</span><span>)
</span><span class="number-literal">1</span><span> + </span><span class="number-literal">2</span><span> * </span><span class="number-literal">3</span><span>
}
</span><span class="comment">// always: Eval[Int] = cats.Always@6d1e4aaf
</span><span class="comment">// always: Eval[Int] = cats.Always@968fed2
</span><span>
</span><span class="identifier">always</span><span>.</span><span class="identifier">value</span><span>
</span><span class="comment">// Running expensive calculation...
Expand Down
2 changes: 1 addition & 1 deletion datatypes/freeapplicative.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ <h2 id="example" class="section"><a class="anchor-link left" href="#example"><i
}
}</span></code></pre>
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">val</span><span> </span><span class="identifier">validator</span><span> = </span><span class="identifier">prog</span><span>.</span><span class="identifier">foldMap</span><span>[</span><span class="type-name">FromString</span><span>](</span><span class="identifier">compiler</span><span>)
</span><span class="comment">// validator: FromString[Boolean] = cats.instances.Function1Instances$$anon$7$$Lambda$14592/0x00007f6330747958@2ed270c6
</span><span class="comment">// validator: FromString[Boolean] = cats.instances.Function1Instances$$anon$7$$Lambda$14487/0x00007f8b806fdbd0@2dcd20cf
</span><span class="identifier">validator</span><span>(</span><span class="string-literal">&quot;1234&quot;</span><span>)
</span><span class="comment">// res0: Boolean = false
</span><span class="identifier">validator</span><span>(</span><span class="string-literal">&quot;12345&quot;</span><span>)
Expand Down
4 changes: 2 additions & 2 deletions datatypes/freemonad.html
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ <h2 id="freet" class="section"><a class="anchor-link left" href="#freet"><i clas
</span><span class="keyword">import</span><span> </span><span class="type-name">TeletypeOps</span><span>.</span><span class="identifier">_</span><span>

</span><span class="keyword">val</span><span> </span><span class="identifier">state</span><span> = </span><span class="identifier">program</span><span>.</span><span class="identifier">foldMap</span><span>(</span><span class="identifier">interpreter</span><span>)
</span><span class="comment">// state: TeletypeState[Unit] = cats.data.IndexedStateT@654b3f57
</span><span class="comment">// state: TeletypeState[Unit] = cats.data.IndexedStateT@57939ad4
</span><span class="keyword">val</span><span> </span><span class="identifier">initialState</span><span> = </span><span class="type-name">Nil</span><span>
</span><span class="comment">// initialState: Nil.type = List()
</span><span class="keyword">val</span><span> (</span><span class="identifier">stored</span><span>, </span><span class="identifier">_</span><span>) = </span><span class="identifier">state</span><span>.</span><span class="identifier">run</span><span>(</span><span class="identifier">initialState</span><span>).</span><span class="identifier">value</span><span>
Expand Down Expand Up @@ -789,7 +789,7 @@ <h2 id="freet" class="section"><a class="anchor-link left" href="#freet"><i clas
// value = Success(value = Some(value = Left(value = Action(value = 7))))
// )
// ),
// f0 = scala.Function1$$Lambda$14431/0x00007f63306253c0@197f1fed
// f0 = scala.Function1$$Lambda$14326/0x00007f8b806869c0@44fee5bd
// )
</span><span class="keyword">val</span><span> </span><span class="identifier">evaluated</span><span> = </span><span class="identifier">hoisted</span><span>.</span><span class="identifier">foldMap</span><span>(</span><span class="identifier">tryInterpreter</span><span>)
</span><span class="comment">// evaluated: OptTry[Int] = OptionT(value = Success(value = Some(value = 12)))
Expand Down
4 changes: 2 additions & 2 deletions datatypes/state.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h2 id="changing-states" class="section"><a class="anchor-link left" href="#chan
</span><span class="identifier">_</span><span> &lt;- </span><span class="identifier">close</span><span>
</span><span class="identifier">_</span><span> &lt;- </span><span class="identifier">open</span><span>
} </span><span class="keyword">yield</span><span> ()
</span><span class="comment">// valid: IndexedStateT[Eval, Closed.type, Open.type, Unit] = cats.data.IndexedStateT@3ec27384</span></code></pre>
</span><span class="comment">// valid: IndexedStateT[Eval, Closed.type, Open.type, Unit] = cats.data.IndexedStateT@7bd99933</span></code></pre>
<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>
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="identifier">valid</span><span>.</span><span class="identifier">run</span><span>(</span><span class="type-name">Open</span><span>)
</span><span class="comment">// error: type mismatch;
Expand All @@ -483,7 +483,7 @@ <h2 id="changing-states" class="section"><a class="anchor-link left" href="#chan
// valid.run(Open)
// ^^^^</span></code></pre>
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="identifier">valid</span><span>.</span><span class="identifier">run</span><span>(</span><span class="type-name">Closed</span><span>)
</span><span class="comment">// res6: Eval[(Open.type, Unit)] = cats.Eval$$anon$1@3549b089</span></code></pre>
</span><span class="comment">// res6: Eval[(Open.type, Unit)] = cats.Eval$$anon$1@3cc1731a</span></code></pre>


<hr class="footer-rule"/>
Expand Down
4 changes: 2 additions & 2 deletions typeclasses/bifoldable.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ <h2 id="tuple-as-bifoldable" class="section"><a class="anchor-link left" href="#
(</span><span class="identifier">s</span><span>, </span><span class="identifier">acc</span><span>) =&gt; </span><span class="identifier">acc</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">_</span><span> |+| </span><span class="identifier">s</span><span>),
(</span><span class="identifier">s</span><span>, </span><span class="identifier">acc</span><span>) =&gt; </span><span class="identifier">acc</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">_</span><span> |+| </span><span class="identifier">s</span><span>)
)
</span><span class="comment">// right: Eval[String] = cats.Eval$$anon$1@1e6233e8
</span><span class="comment">// right: Eval[String] = cats.Eval$$anon$1@56c1d329
</span><span>
</span><span class="identifier">left</span><span> === </span><span class="identifier">expected</span><span>
</span><span class="comment">// res2: Boolean = true
Expand All @@ -354,7 +354,7 @@ <h2 id="tuple-as-bifoldable" class="section"><a class="anchor-link left" href="#
(</span><span class="identifier">s</span><span>, </span><span class="identifier">acc</span><span>) =&gt; </span><span class="identifier">acc</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">_</span><span> |+| </span><span class="identifier">s</span><span>),
(</span><span class="identifier">s</span><span>, </span><span class="identifier">acc</span><span>) =&gt; </span><span class="identifier">acc</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">_</span><span> |+| </span><span class="identifier">s</span><span>)
)
</span><span class="comment">// reversedRight: Eval[String] = cats.Eval$$anon$1@bd84e09
</span><span class="comment">// reversedRight: Eval[String] = cats.Eval$$anon$1@4c39345a
</span><span>
</span><span class="identifier">reversedRight</span><span>.</span><span class="identifier">value</span><span> === </span><span class="identifier">expected</span><span>
</span><span class="comment">// res4: Boolean = false</span></code></pre>
Expand Down
2 changes: 1 addition & 1 deletion typeclasses/bifunctor.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ <h2 id="either-as-a-bifunctor" class="section"><a class="anchor-link left" href=
</span><span class="identifier">error</span><span> =&gt; </span><span class="type-name">DomainError</span><span>(</span><span class="identifier">error</span><span>.</span><span class="identifier">getMessage</span><span>),
</span><span class="identifier">dateTime</span><span> =&gt; </span><span class="identifier">dateTime</span><span>.</span><span class="identifier">toEpochSecond</span><span>
)
</span><span class="comment">// res0: Either[DomainError, Long] = Right(value = 1731756269L)</span></code></pre>
</span><span class="comment">// res0: Either[DomainError, Long] = Right(value = 1732222779L)</span></code></pre>
<p><code>Bifunctor</code> also defines a convenience function called <code>leftMap</code>, which is defined as follows:</p>
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">def</span><span> </span><span class="declaration-name">leftMap</span><span>[</span><span class="type-name">A</span><span>, </span><span class="type-name">B</span><span>, </span><span class="type-name">C</span><span>](</span><span class="identifier">fab</span><span>: </span><span class="type-name">F</span><span>[</span><span class="type-name">A</span><span>, </span><span class="type-name">B</span><span>])(</span><span class="identifier">f</span><span>: </span><span class="type-name">A</span><span> =&gt; </span><span class="type-name">C</span><span>): </span><span class="type-name">F</span><span>[</span><span class="type-name">C</span><span>, </span><span class="type-name">B</span><span>] = </span><span class="identifier">bimap</span><span>(</span><span class="identifier">fab</span><span>)(</span><span class="identifier">f</span><span>, </span><span class="identifier">identity</span><span>)</span></code></pre>
<p>There is no <code>rightMap</code> however - use <code>map</code> instead. The reasoning behind this is that in Cats, the instances of
Expand Down
2 changes: 1 addition & 1 deletion typeclasses/bimonad.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ <h3 id="nonemptylist-as-a-bimonad" class="section"><a class="anchor-link left" h
</span><span> </span><span class="keyword">override</span><span> </span><span class="keyword">def</span><span> </span><span class="declaration-name">tailRecM</span><span>[</span><span class="type-name">A</span><span>, </span><span class="type-name">B</span><span>](</span><span class="identifier">a</span><span>: </span><span class="type-name">A</span><span>)(</span><span class="identifier">fn</span><span>: </span><span class="type-name">A</span><span> =&gt; </span><span class="type-name">NonEmptyList</span><span>[</span><span class="type-name">Either</span><span>[</span><span class="type-name">A</span><span>, </span><span class="type-name">B</span><span>]]): </span><span class="type-name">NonEmptyList</span><span>[</span><span class="type-name">B</span><span>] =
???
}
</span><span class="comment">// nelBimonad: Bimonad[NonEmptyList] = repl.MdocSession$MdocApp$$anon$1@2672b8d6</span></code></pre>
</span><span class="comment">// nelBimonad: Bimonad[NonEmptyList] = repl.MdocSession$MdocApp$$anon$1@57db4c2f</span></code></pre>
<p>Note the equivalence:</p>
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="identifier">nelBimonad</span><span>.</span><span class="identifier">pure</span><span>(</span><span class="boolean-literal">true</span><span>).</span><span class="identifier">extract</span><span> === </span><span class="type-name">NonEmptyList</span><span>.</span><span class="identifier">one</span><span>(</span><span class="boolean-literal">true</span><span>).</span><span class="identifier">head</span><span>
</span><span class="comment">// res0: Boolean = true</span></code></pre>
Expand Down
Loading

0 comments on commit c3905ec

Please sign in to comment.