Skip to content

Commit

Permalink
Simplify link
Browse files Browse the repository at this point in the history
  • Loading branch information
ploeh committed Oct 21, 2024
1 parent 18d5641 commit 53e38a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _posts/2024-10-21-legacy-security-manager-in-haskell.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h3 id="03ee8805b5a44e77b92f9f6d132513bf">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf&nbsp;<span style="color:#a31515;">&quot;Saving&nbsp;Details&nbsp;for&nbsp;User&nbsp;(%s,&nbsp;%s,&nbsp;%s)&quot;</span>&nbsp;username&nbsp;fullName&nbsp;array</pre>
</p>
<p>
Notice how the Haskell code seems to suffer slightly from the <a href="https://wiki.c2.com/?ArrowAntiPattern=&ref=blog.codinghorror.com">Arrow code smell</a>, which is a problem that the C# code actually doesn't exhibit. The reason is that when using Haskell in an 'imperative style' (which you can, after a fashion, with <code>do</code> notation), you can't 'exit early' from a an <code>if</code> check. The problem is that you can't have <code>if</code>-<code>then</code> without <code>else</code>.
Notice how the Haskell code seems to suffer slightly from the <a href="https://wiki.c2.com/?ArrowAntiPattern">Arrow code smell</a>, which is a problem that the C# code actually doesn't exhibit. The reason is that when using Haskell in an 'imperative style' (which you can, after a fashion, with <code>do</code> notation), you can't 'exit early' from a an <code>if</code> check. The problem is that you can't have <code>if</code>-<code>then</code> without <code>else</code>.
</p>
<p>
Haskell has other language features that enable you to get rid of Arrow code, but in the spirit of the exercise, this would take us too far away from the original C# code. Making the code prettier should be a task for the refactoring exercise, rather than the starting point.
Expand Down

0 comments on commit 53e38a9

Please sign in to comment.