<?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>Posts on CHANGE_ME_BLOG_TITLE</title>
    <link>https://sharp-sherif.xyz/posts/</link>
    <description>Recent content in Posts 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/posts/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>
    <item>
      <title>Result Pattern in C#</title>
      <link>https://sharp-sherif.xyz/posts/result-pattern/</link>
      <pubDate>Tue, 15 Sep 2026 00:00:00 +0300</pubDate>
      <guid>https://sharp-sherif.xyz/posts/result-pattern/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Whenever I was writing C# and an edge case popped up that strayed from the happy path, I just threw an exception. At first it felt fine and natural. But later it started bothering me, every new edge case meant adding another exception type to the error handling middleware. It was especially unpleasant when trying to compose different methods in order to reuse functionality. Exceptions aren&amp;rsquo;t &lt;a href=&#34;https://dev.to/gramli/net-throwing-exceptions-vs-result-pattern-benchmark-4a62&#34;&gt;cheap&lt;/a&gt; — throwing one measurably costs more than returning a value. Nor should they be relied on for &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/exception-throwing&#34;&gt;control flow&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
