<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Functional-Programming on CHANGE_ME_BLOG_TITLE</title>
    <link>https://sharp-sherif.xyz/tags/functional-programming/</link>
    <description>Recent content in Functional-Programming on CHANGE_ME_BLOG_TITLE</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Thu, 24 Sep 2026 00:00:00 +0300</lastBuildDate>
    <atom:link href="https://sharp-sherif.xyz/tags/functional-programming/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Functional extensions for result</title>
      <link>https://sharp-sherif.xyz/posts/functional-extensions/</link>
      <pubDate>Thu, 24 Sep 2026 00:00:00 +0300</pubDate>
      <guid>https://sharp-sherif.xyz/posts/functional-extensions/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In &lt;a href=&#34;https://sharp-sherif.xyz/result-pattern-in-csharp&#34;&gt;an earlier post&lt;/a&gt;, I created &lt;code&gt;Result&amp;lt;TValue, TError&amp;gt;&lt;/code&gt;, a generic, allocation-free struct. On its own, it supports only procedural programming. Call something, check &lt;code&gt;Success&lt;/code&gt; or &lt;code&gt;Failure&lt;/code&gt;, branch and repeat. This is the same boilerplate as Go’s &lt;code&gt;if err != nil&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In functional languages, a result is a value like any other, so operations can be composed on it directly. F# includes a &lt;code&gt;Result&lt;/code&gt; module for this. This post discusses extension methods that reimplement &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;mapError&lt;/code&gt;, &lt;code&gt;bind&lt;/code&gt;, &lt;code&gt;iter&lt;/code&gt;, &lt;code&gt;iterError&lt;/code&gt;, &lt;code&gt;defaultValue&lt;/code&gt; and &lt;code&gt;defaultWith&lt;/code&gt; for &lt;code&gt;Result&amp;lt;TValue, TError&amp;gt;&lt;/code&gt;. They let you chain steps without checking &lt;code&gt;Success&lt;/code&gt; or &lt;code&gt;Failure&lt;/code&gt; after each call.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
