<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Windymelt</author_name>
  <author_url>https://blog.hatena.ne.jp/Windymelt/</author_url>
  <blog_title>Lambdaカクテル</blog_title>
  <blog_url>https://blog.3qe.us/</blog_url>
  <categories>
    <anon>技術</anon>
    <anon>scala</anon>
  </categories>
  <description>ScalaのCatsにifMという便利なやつがある。IO[Boolean]に対して条件分岐を適用して、trueの場合とfalseの場合とで異なるIOを返すというもの。別にIOでなくとも良くて、Monadなどの仲間であればifMは定義されている。例えばOption[Boolean]に対してもifMが使える。 http://typelevel.org/cats/api/cats/index.html?search=ifm このようなシチュエーションがあるときにifMを使うとシンプルになる: val condition: IO[Boolean] = ... condition.flatMap { c…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.3qe.us%2Fentry%2F2023%2F09%2F26%2F002208&quot; title=&quot;ScalaのCatsにifMという便利なやつがある - Lambdaカクテル&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>2023-09-26 00:22:08</published>
  <title>ScalaのCatsにifMという便利なやつがある</title>
  <type>rich</type>
  <url>https://blog.3qe.us/entry/2023/09/26/002208</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
