<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>sakata_harumi</author_name>
  <author_url>https://blog.hatena.ne.jp/sakata_harumi/</author_url>
  <blog_title>JKになりたい</blog_title>
  <blog_url>https://wanttobejk.com/</blog_url>
  <categories>
    <anon>Scala</anon>
    <anon>Tech</anon>
  </categories>
  <description>Stateモナドについてざっくりと。 状態の変化を伴うミュータブルな計算をFunctional Programmingのコンテキストで表現可能にしたもの。 catsにおけるStateモナドのapplyメソッドのシグネチャは以下のようになっています def apply[S, A](f: S =&gt; (S, A)): State[S, A] 見たとおり、状態Sを受け取って、(S, A)を返す関数を渡します。 これだけではさっぱりなので、使用例を考えていきます。。 例に示すのは乱数を生成する関数です。 乱数生成のためのオブジェクトは状態を持つため、以下は典型的な参照透過性のない関数です。 def cr…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwanttobejk.com%2Fentry%2F2018%2F06%2F13%2F003917&quot; title=&quot;CatsのStateモナドを使ってFP in ScalaのEx6.11 自動販売機問題を解く (1)Stateモナドについて - JKになりたい&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-06-13 00:39:17</published>
  <title>CatsのStateモナドを使ってFP in ScalaのEx6.11 自動販売機問題を解く (1)Stateモナドについて</title>
  <type>rich</type>
  <url>https://wanttobejk.com/entry/2018/06/13/003917</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
