<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sakib Hadžiavdić</title>
    <description>The latest articles on DEV Community by Sakib Hadžiavdić (@sake_92).</description>
    <link>https://dev.to/sake_92</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F15295%2F82b1a93d-d8c9-4c4b-bf5e-b973f57d7290.png</url>
      <title>DEV Community: Sakib Hadžiavdić</title>
      <link>https://dev.to/sake_92</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sake_92"/>
    <language>en</language>
    <item>
      <title>You already know Monad(ic) stuff</title>
      <dc:creator>Sakib Hadžiavdić</dc:creator>
      <pubDate>Tue, 17 May 2022 23:18:53 +0000</pubDate>
      <link>https://dev.to/sake_92/you-already-know-monadic-stuff-272n</link>
      <guid>https://dev.to/sake_92/you-already-know-monadic-stuff-272n</guid>
      <description>&lt;p&gt;If you wonder what: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;flatMap&lt;/li&gt;
&lt;li&gt;Monads&lt;/li&gt;
&lt;li&gt;Promise, Future, Rx, IO&lt;/li&gt;
&lt;li&gt;do, for, async/await&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;have in common, then you are in a good place.&lt;/p&gt;

&lt;p&gt;First we'll see how and why &lt;code&gt;Monad&lt;/code&gt; came into Haskell (a &lt;em&gt;purely&lt;/em&gt; functional language).&lt;br&gt;&lt;br&gt;
Then we will see a nicer syntax for writing functions that operate on monads.&lt;br&gt;&lt;br&gt;
And lastly I will show you some similarities between Monad and async/await.&lt;/p&gt;


&lt;h2&gt;
  
  
  Haskell
&lt;/h2&gt;

&lt;p&gt;A few relevant things about Haskell:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it is a lazy language&lt;/li&gt;
&lt;li&gt;it wants to separate &lt;strong&gt;pure functions&lt;/strong&gt; from &lt;strong&gt;impure functions (actions)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Laziness
&lt;/h3&gt;

&lt;p&gt;By "lazy" we mean non-strict evaluation.&lt;br&gt;&lt;br&gt;
In Java for example, when you call a function &lt;code&gt;myFun(a, b)&lt;/code&gt;, the order of evaluation is strict and consistent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;arguments are evaluated from left to right, one after another&lt;/li&gt;
&lt;li&gt;function is evaluated&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But in Haskell that's not the case. Arguments &lt;em&gt;are not evaluated until needed&lt;/em&gt;.&lt;br&gt;&lt;br&gt;
So if the parameter &lt;code&gt;a&lt;/code&gt; is not used in the body of &lt;code&gt;myFun&lt;/code&gt; &lt;strong&gt;it will not be evaluated at all&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
This is fine+desirable+performant when your functions are pure (not &lt;em&gt;doing&lt;/em&gt; anything),&lt;br&gt;
but it is a big issue when they do &lt;strong&gt;side effects&lt;/strong&gt;: write to a file/db etc.&lt;br&gt;&lt;br&gt;
For example, if you want these actions to be executed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;f1&lt;/code&gt;: write to a file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;f2&lt;/code&gt;: read from that file
you need to make sure that &lt;code&gt;f1&lt;/code&gt; always gets evaluated before &lt;code&gt;f2&lt;/code&gt;!!
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Haskell you are never sure because eval order is unspecified..&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The next Haskell will be strict.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simon Peyton Jones&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Pure functions
&lt;/h3&gt;

&lt;p&gt;Pure functions are like &lt;strong&gt;mathematical functions&lt;/strong&gt;, they do calculations, and only return new values (no mutable variables).&lt;br&gt;&lt;br&gt;
They are only considering "insides" of a program, its own memory.  &lt;/p&gt;
&lt;h3&gt;
  
  
  Impure functions
&lt;/h3&gt;

&lt;p&gt;Impure functions go &lt;em&gt;beyond our program&lt;/em&gt;, they "go outside", play and get dirty.&lt;br&gt;&lt;br&gt;
They read/write to a file/console/database etc.&lt;/p&gt;

&lt;p&gt;So, Haskell wants you &lt;em&gt;not to get dirty&lt;/em&gt;, and play as much as you can &lt;em&gt;inside&lt;/em&gt; (stay safe).&lt;br&gt;&lt;br&gt;
How does it know which functions are "impure"?&lt;br&gt;&lt;br&gt;
Usually by marking them with &lt;code&gt;IO&lt;/code&gt; wrapper type (which is "a monad").&lt;/p&gt;
&lt;h3&gt;
  
  
  Main function
&lt;/h3&gt;

&lt;p&gt;"Normal" programming languages have a &lt;code&gt;main&lt;/code&gt; function, which usually looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void main(String[] args) {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but in Haskell you have this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main :: IO ()
main = ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Haskell marks the main as an IO action, so by definition it is impure.&lt;/p&gt;




&lt;h2&gt;
  
  
  History and pre-history
&lt;/h2&gt;

&lt;p&gt;Before monads were introduced, main function looked like this: &lt;code&gt;main :: [Response] -&amp;gt; [Request]&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
Example taken from &lt;a href="https://stackoverflow.com/a/17004448/4496364"&gt;SO&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;main&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;main&lt;/span&gt; &lt;span class="n"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="kt"&gt;AppendChan&lt;/span&gt; &lt;span class="s"&gt;"stdout"&lt;/span&gt; &lt;span class="s"&gt;"Please enter a Number&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;ReadChan&lt;/span&gt; &lt;span class="s"&gt;"stdin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;AppendChan&lt;/span&gt; &lt;span class="s"&gt;"stdout"&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;enteredNumber&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="kr"&gt;where&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Str&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="n"&gt;firstLine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="n"&gt;lines&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;
        &lt;span class="n"&gt;enteredNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;read&lt;/span&gt; &lt;span class="n"&gt;firstLine&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a nutshell, you would have to &lt;strong&gt;write all of the impure stuff that your whole program will do as a return value&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
That is represented as a &lt;em&gt;list of requests&lt;/em&gt;: &lt;code&gt;[Request]&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
Return values from those IO actions are delivered in the &lt;code&gt;[Response]&lt;/code&gt; list, that you would use inside the program logic.  &lt;/p&gt;

&lt;p&gt;The number of responses is the same as the number of requests you gave.&lt;br&gt;&lt;br&gt;
So you have to keep in mind the indices and bounds of responses, which is a bummer. &lt;br&gt;
What if you add one request in the middle? You'd have to change all indices after it...&lt;br&gt;&lt;br&gt;
Which request belongs to which response? That's really hard to see.&lt;br&gt;&lt;br&gt;
We can already see that this way of writing a program is very &lt;strong&gt;cumbersome, unreadable, and limited&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Notice also that the approach above works only because Haskell is lazy!&lt;/p&gt;


&lt;h2&gt;
  
  
  Monads
&lt;/h2&gt;

&lt;p&gt;Back to &lt;code&gt;IO t&lt;/code&gt;. The &lt;code&gt;IO t&lt;/code&gt; is an action that will do some &lt;em&gt;side effects&lt;/em&gt; before returning a value of type &lt;code&gt;t&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
This can be &lt;em&gt;anything&lt;/em&gt;: writing to disk, sending HTTP requests etc.&lt;br&gt;&lt;br&gt;
We have these impure functions in Haskell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;getChar&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="kt"&gt;IO&lt;/span&gt; &lt;span class="kt"&gt;Char&lt;/span&gt;
&lt;span class="n"&gt;putChar&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="kt"&gt;Char&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;IO&lt;/span&gt; &lt;span class="nb"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We already have some special &lt;em&gt;functions&lt;/em&gt; that operate on these values &lt;em&gt;inside&lt;/em&gt; the &lt;code&gt;IO&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
For example, we have &lt;code&gt;fmap :: Functor f =&amp;gt; (a -&amp;gt; b) -&amp;gt; f a -&amp;gt; f b&lt;/code&gt; which transformes the value inside any Functor &lt;code&gt;f&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
But what about chaining, sequencing actions one after another?&lt;br&gt;&lt;br&gt;
How can we ensure that &lt;code&gt;getChar&lt;/code&gt; executes &lt;em&gt;strictly before&lt;/em&gt; &lt;code&gt;putChar&lt;/code&gt;?&lt;br&gt;&lt;br&gt;
Monads to the rescue! Its core function is called &lt;code&gt;bind&lt;/code&gt; (&lt;code&gt;flatMap&lt;/code&gt; in other languages):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;=&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="kt"&gt;IO&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;IO&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;IO&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;takes an &lt;code&gt;IO a&lt;/code&gt; action&lt;/li&gt;
&lt;li&gt;takes a function that takes &lt;code&gt;a&lt;/code&gt; (from the &lt;code&gt;IO a&lt;/code&gt; argument)&lt;/li&gt;
&lt;li&gt;returns a new &lt;code&gt;IO b&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So there we have it, Monad in all its glory! :)&lt;br&gt;&lt;br&gt;
Let's see our solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;getChar&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;putChar&lt;/span&gt;

&lt;span class="c1"&gt;-- or more verbosely&lt;/span&gt;
&lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;getChar&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;\&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;putChar&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;-- or even more verbosely&lt;/span&gt;
&lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;=&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;getChar&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;\&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;putChar&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Scala you'd write &lt;code&gt;val echo = getChar.flatMap(putChar)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is the main reason why Monads were introduced in Haskell.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In short, Haskell is the world’s finest imperative programming language.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simon Peyton Jones&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Syntax sugar for Monads
&lt;/h3&gt;

&lt;p&gt;Haskell and some other languages have built in syntax support for Monads.&lt;br&gt;&lt;br&gt;
Haskell has "do notation" and Scala has "for comprehensions"&lt;br&gt;
It makes them more readable by flipping sides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kr"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;getChar&lt;/span&gt;
    &lt;span class="n"&gt;putChar&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scala:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scala"&gt;&lt;code&gt;&lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="nv"&gt;echo&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;getChar&lt;/span&gt;
    &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="nf"&gt;putChar&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="nf"&gt;yield&lt;/span&gt; &lt;span class="o"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;&amp;lt;-&lt;/code&gt; symbol gets translated into &lt;code&gt;&amp;gt;&amp;gt;=&lt;/code&gt; by Haskell's compiler.&lt;br&gt;
In case of Scala, it gets turned into a &lt;code&gt;flatMap&lt;/code&gt;.&lt;/p&gt;



&lt;p&gt;It turnes out they are useful not only in the &lt;code&gt;IO&lt;/code&gt; context, but for other types too.&lt;br&gt;&lt;br&gt;
Whenever you have unwanted &lt;code&gt;Wrapper[Wrapper[T]]&lt;/code&gt; wrappers, you need to "flatMap that shit" =&amp;gt; Monads.&lt;br&gt;&lt;br&gt;
If you have &lt;code&gt;List[List[String]]&lt;/code&gt; you probably needed a &lt;code&gt;flatMap&lt;/code&gt; instead of &lt;code&gt;map&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
If you have &lt;code&gt;Option[Option[String]]&lt;/code&gt; =&amp;gt; same thing.&lt;br&gt;&lt;br&gt;
You can imagine doing the same with &lt;code&gt;List[T]&lt;/code&gt;, where &lt;code&gt;c&lt;/code&gt; would be just &lt;em&gt;one element of the list&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Async / Await
&lt;/h2&gt;

&lt;p&gt;After some time it came to my mind that we are doing a similar thing in JS/C#/Kotlin with &lt;code&gt;await&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
It is almost the same thing, we are "pulling a value from a Promise/Task":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchUserMovies&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;movies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/user/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/movies`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this we used to write "normal functions", callbacks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchUserMovies&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/user/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/movies`&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;movies&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seems like &lt;code&gt;then&lt;/code&gt; corresponds to &lt;code&gt;flatMap&lt;/code&gt;, and &lt;code&gt;await&lt;/code&gt; corresponds to &lt;code&gt;&amp;lt;-&lt;/code&gt; in do syntax.&lt;br&gt;&lt;br&gt;
Some noticable differences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do/for is general, while await is specific just for Promise&lt;/li&gt;
&lt;li&gt;do/for in statically typed languages is checked for proper types, while in JS you're on your own&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  My opinions
&lt;/h1&gt;

&lt;p&gt;To me, it feels very awkward to program in a lazy programming language.&lt;br&gt;&lt;br&gt;
It is hard to reason about and you &lt;em&gt;have to use monads&lt;/em&gt; for doing even the simplest IO operations.&lt;br&gt;&lt;br&gt;
Seems like it introduces more problems than it gives us benefits.&lt;/p&gt;

&lt;p&gt;So, in my opinion, use Monads/Rx/whatever &lt;em&gt;only when you have to&lt;/em&gt;!&lt;br&gt;&lt;br&gt;
The simpler the program - the better.  &lt;/p&gt;

&lt;p&gt;For example, in Java you can use threads and concurrent datastructures. &lt;br&gt;
Web servers like Tomcat, Jetty etc. are working just fine with a thread-per-request model.&lt;/p&gt;

&lt;p&gt;But in JS you don't have that liberty, you &lt;strong&gt;need to use Promises&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
That's because JS doesn't have "normal threads", is uses an event-loop so you have to program asynchronous code.&lt;/p&gt;




&lt;p&gt;I hope this gave you a better insight into scary Monads and the FP way of handling IO.&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/mark.pdf?from=https%3A%2F%2Fresearch.microsoft.com%2F%7Esimonpj%2Fpapers%2Fmarktoberdorf%2Fmark.pdf"&gt;Tackling the Awkward Squad&lt;/a&gt; by Simon Peyton Jones&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=9TR--8gAcZ8"&gt;Essential Effects&lt;/a&gt; by Adam Rosien&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html"&gt;State of Loom&lt;/a&gt; by Ron Pressler (comparing RX vs threads)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://gist.github.com/dcastro/c451883ff8aac44c57233ef1c6fd75ee"&gt;Future vs IO&lt;/a&gt; by Diogo Castro&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://medium.com/@luijar/the-observable-disguised-as-an-io-monad-c89042aa8f31"&gt;The Observable disguised as an IO Monad&lt;/a&gt; by Luis Atencio&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>monad</category>
      <category>haskell</category>
      <category>scala</category>
      <category>await</category>
    </item>
    <item>
      <title>FlowRun - executable flowcharts for the web</title>
      <dc:creator>Sakib Hadžiavdić</dc:creator>
      <pubDate>Mon, 11 Apr 2022 00:23:23 +0000</pubDate>
      <link>https://dev.to/sake_92/flowrun-executable-flowcharts-for-the-web-48b5</link>
      <guid>https://dev.to/sake_92/flowrun-executable-flowcharts-for-the-web-48b5</guid>
      <description>&lt;p&gt;Wow, it's been 5 years since my last post here.. :o&lt;br&gt;
I have something really exciting to share with you people!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flowrun.io/"&gt;FlowRun&lt;/a&gt; is my latest greatest project.&lt;br&gt;
It is a PWA web app for designing and &lt;strong&gt;running flowcharts&lt;/strong&gt; in your browser.&lt;br&gt;
Its main alternative is &lt;a href="http://www.flowgorithm.org/index.html"&gt;Flowgorithm&lt;/a&gt;, which supports only Windows unfortunately. &lt;br&gt;
FlowRun even works offline to some extent. It is a PWA so it can be "installed" on phone/desktop. Since it is web based it is easier to share programs and integrate them in other apps like Jira, Confluence and similar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Snappy editor
&lt;/h2&gt;

&lt;p&gt;A big advantage of FlowRun is its better UX of the editor: no popup windows, no doubleclicking nodes etc. &lt;br&gt;
Everything is right there, usually one click away. &lt;br&gt;
It has some features that Flowgorithm does not, like reporting &lt;em&gt;syntax errors as you type&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expressions
&lt;/h2&gt;

&lt;p&gt;The expressions and execution is mostly the same as in Java. &lt;br&gt;
It will be easy for beginners to switch to most real programming languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code generator
&lt;/h2&gt;

&lt;p&gt;Code generator works for 10 languages, although there are probably still some bugs left to fix.&lt;br&gt;&lt;br&gt;
When you click a statement(node in diagram) it gets highlighted in the code generator! Very handy when you are learning a new programming language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Execution
&lt;/h2&gt;

&lt;p&gt;Runtime is also neat, you can start and stop the program whenever you want.&lt;br&gt;&lt;br&gt;
When you get an error it will &lt;em&gt;highlight the relevant node&lt;/em&gt; in the editor!&lt;br&gt;&lt;br&gt;
When a program pauses for taking input from user, you can see the current state/values of variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layout
&lt;/h2&gt;

&lt;p&gt;You can turn off some panels in the settings popup.&lt;br&gt;&lt;br&gt;
E.g. if you only want to show the main function you can hide the functions chooser. This way you can focus viewer's attention on relevant details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fun facts
&lt;/h2&gt;

&lt;p&gt;FlowRun editor/interpreter is open source: &lt;a href="https://github.com/sacode387/FlowRun"&gt;https://github.com/sacode387/FlowRun&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is written in &lt;a href="https://www.scala-js.org/"&gt;ScalaJS&lt;/a&gt;, which compiles to JavaScript.&lt;br&gt;
Why? Because Scala is really good for writing compilers.&lt;/p&gt;

&lt;p&gt;Next, it uses Graphviz via &lt;a href="https://github.com/magjac/d3-graphviz"&gt;d3-graphviz&lt;/a&gt; library,&lt;br&gt;
which uses WebAssembly under the hood.&lt;br&gt;
You can copy the DOT source for each function that is displayed,&lt;br&gt;
and generate an SVG/PDF/JPG or any other format that Graphviz supports.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hope that this tool will help more people to get into programming.&lt;br&gt;&lt;br&gt;
If you have any feedback, suggestions, please let me know in the comments! :)&lt;/p&gt;

</description>
      <category>flowrun</category>
      <category>flowchart</category>
      <category>scala</category>
      <category>scalajs</category>
    </item>
    <item>
      <title>Render static site from Scala code</title>
      <dc:creator>Sakib Hadžiavdić</dc:creator>
      <pubDate>Thu, 17 Aug 2017 14:18:46 +0000</pubDate>
      <link>https://dev.to/sake_92/render-static-site-from-scala-code</link>
      <guid>https://dev.to/sake_92/render-static-site-from-scala-code</guid>
      <description>&lt;p&gt;Have you ever thought:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If I just had a variable in my ugly HTML...&lt;br&gt;
So I wouldn't have to repeat all those Bootstrap classes and could change them at one place...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://github.com/sake92/sbt-hepek"&gt;Sbt-hepek&lt;/a&gt; to the rescue
&lt;/h1&gt;

&lt;p&gt;So, after some thinking, I decided to write my first sbt plugin just for that (&lt;a href="http://www.scala-sbt.org/"&gt;Sbt&lt;/a&gt; is a &lt;a href="http://www.scala-lang.org/"&gt;Scala&lt;/a&gt; build tool, like Maven or Gradle in Java ecosystem).&lt;/p&gt;

&lt;p&gt;Note: &lt;em&gt;This is &lt;strong&gt;not&lt;/strong&gt; a standard template-based, special-language static site generator like Jekyll and others. It is a &lt;strong&gt;completely&lt;/strong&gt; different approach, namely, we use Scala &lt;code&gt;object&lt;/code&gt;s to represent pages.&lt;/em&gt;&lt;br&gt;
We can use some of Scala's features to our advantage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scala has singleton object as a built-in feature. Every &lt;code&gt;object&lt;/code&gt; that extends &lt;code&gt;Renderable&lt;/code&gt; trait will be rendered to a file. You can specify a default extension etc. &lt;/li&gt;
&lt;li&gt;Also, Scala/Java packages can be used to &lt;em&gt;represent&lt;/em&gt; file system structure! For example, if an &lt;code&gt;object&lt;/code&gt; is in a &lt;code&gt;package mysite.posts&lt;/code&gt; it could be rendered to a "mysite/posts" folder! Cool, right? :)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The meat of your page could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scala"&gt;&lt;code&gt;
&lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;HelloWorld&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;JavaTemplate&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;pageTitle&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello world!"&lt;/span&gt;

  &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="nv"&gt;introSectionContent&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt;
    &lt;span class="nf"&gt;div&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
      &lt;span class="nf"&gt;p&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java "&lt;/span&gt;&lt;span class="nc"&gt;Hello&lt;/span&gt; &lt;span class="nc"&gt;World&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="s"&gt;" example:"&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;javaSnippet&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"""         
            class HelloWorldApp {
                public static void main(String[] args) {       
                    System.out.println("Hello!");      
                }
            }
      """&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="nv"&gt;introSection&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Section&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello world!"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;introSectionContent&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sections&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Seq&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;introSection&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Ideas
&lt;/h1&gt;

&lt;p&gt;Since we use a full-featured programming language, we can do many things that are not possible (or not as nice) with custom-made template languages like Markdown. These are some ideas that are already implemented.&lt;/p&gt;

&lt;h3&gt;
  
  
  Templates
&lt;/h3&gt;

&lt;p&gt;This one is obvious, to represent a template you can use &lt;code&gt;trait&lt;/code&gt;s. Then you make an &lt;code&gt;object&lt;/code&gt; that extends it and implement(&lt;code&gt;override&lt;/code&gt;) only the methods that are &lt;code&gt;abstract&lt;/code&gt;. Scala's trait methods can have default implementation so we can exploit that also.&lt;/p&gt;

&lt;h3&gt;
  
  
  Relative paths
&lt;/h3&gt;

&lt;p&gt;Another thing I thought about was error-prone relative paths in HTML, like &lt;code&gt;../js/something.js&lt;/code&gt;. We can make a method &lt;code&gt;def relTo(other: RelativePath): String&lt;/code&gt; that will "calculate" it for us. Then a relative link looks like &lt;code&gt;Index.relTo(MyOtherPage)&lt;/code&gt;, or from &lt;code&gt;Index&lt;/code&gt; object itself &lt;code&gt;this.relTo(MyOtherPage)&lt;/code&gt;. Very intuitive IMHO.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sections
&lt;/h3&gt;

&lt;p&gt;This one is "stolen" from Li Haoyi's &lt;a href="http://www.lihaoyi.com/Scalatex/#Section"&gt;Scalatex&lt;/a&gt;. Idea is very simple, structure your content inside &lt;a href="https://github.com/sake92/sake-ba-source/blob/master/core/src/main/scala/hepek/templates/Section.scala#L9"&gt;sections&lt;/a&gt; so you can &lt;a href="https://github.com/sake92/sake-ba-source/blob/eea293d665611415b7d6ec30d3cdc5566c16c155/core/src/main/scala/hepek/utils/HTMLUtils.scala#L48"&gt;render them&lt;/a&gt; like chapters in a book. Also, you can make a nice Table Of Contents! :)&lt;/p&gt;

&lt;h1&gt;
  
  
  Example site
&lt;/h1&gt;

&lt;p&gt;For a full-blown example, please take a look at my &lt;a href="https://github.com/sake92/sake-ba-source"&gt;repo&lt;/a&gt; alive @ &lt;a href="https://blog.sake.ba"&gt;blog.sake.ba&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It has a &lt;code&gt;core&lt;/code&gt; project where the templates are (if I decide to make another site, I could reuse it), and &lt;code&gt;sake-ba-blog&lt;/code&gt; where the content is.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;IMHO, this is a very powerful approach for static sites and all kinds of static stuff, like XML or JSON. Since there is no parsing we can incrementally render files by examining class dependencies. E.g. if we change a template we want all &lt;code&gt;Renderable&lt;/code&gt;s to be rendered again, but if we change just the content of a page only that page should be rendered. See &lt;a href="https://github.com/sake92/hepek-core"&gt;hepek-core&lt;/a&gt; for implementation details.&lt;/p&gt;

&lt;p&gt;This approach can be implemented in other languages that have singleton objects as first-class sitizens, like Kotlin and others.&lt;br&gt;
Opinions, suggestions are welcome! :)&lt;/p&gt;

</description>
      <category>scala</category>
      <category>showdev</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Hi, I'm Sakib Hadžiavdić</title>
      <dc:creator>Sakib Hadžiavdić</dc:creator>
      <pubDate>Mon, 10 Apr 2017 13:33:54 +0000</pubDate>
      <link>https://dev.to/sake_92/hi-im-sakib-hadiavdi</link>
      <guid>https://dev.to/sake_92/hi-im-sakib-hadiavdi</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;world!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;startedCodingYear&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2011&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;spaces&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;location&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sarajevo, Bosnia&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;favoriteLanguages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Scala&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Java&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;!JS&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;learning&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FP&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;OOP&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;web&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
