<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>licheng</author_name>
  <author_url>https://blog.hatena.ne.jp/licheng/</author_url>
  <blog_title>滴了庵日録</blog_title>
  <blog_url>https://lipoyang.hatenablog.com/</blog_url>
  <categories>
    <anon>プログラミング</anon>
  </categories>
  <description>Stateモナド Stateモナド STモナドは runST で値のみを取り出せたが、Stateモナドは状態も取り出せる。値と状態を取り出すには runState を、値のみを取り出すには evalState を、状態のみを取り出すには execState を用いる。前の記事でSTモナドで実装した sum' 関数を Stateモナドを使って書き直すと下記のようになる。 Stateモナドの持つ状態を、破壊的代入可能な変数のようなものとして使っている。 import Control.Monad import Control.Monad.State sum' :: [Int] -&gt; Int -- 戻…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Flipoyang.hatenablog.com%2Fentry%2F2024%2F04%2F15%2F150905&quot; title=&quot;Haskellのモナドいろいろ (3) - 滴了庵日録&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>2024-04-15 15:09:05</published>
  <title>Haskellのモナドいろいろ (3)</title>
  <type>rich</type>
  <url>https://lipoyang.hatenablog.com/entry/2024/04/15/150905</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
