<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Functional patterns on OOFP 2025-26</title>
    <link>https://unibz-oofp-25-26.github.io/docs/pattern/</link>
    <description>Recent content in Functional patterns on OOFP 2025-26</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <atom:link href="https://unibz-oofp-25-26.github.io/docs/pattern/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Pipeline</title>
      <link>https://unibz-oofp-25-26.github.io/docs/pattern/sections/pipe/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/pattern/sections/pipe/</guid>
      <description>&lt;h1 id=&#34;pipeline&#34;&gt;&#xA;  Pipeline&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#pipeline&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;We will see in this section how functional languages provide a convenient syntax to &lt;em&gt;compose&lt;/em&gt; functions that modify lists.&lt;/p&gt;&#xA;&lt;p&gt;This lets us apply a sequence of operations (filter, transform, aggregate, etc.) to a stream of incoming data,&#xA;analogously to &lt;a href=&#34;https://en.wikipedia.org/wiki/Pipeline_%28Unix%29&#34;&gt;Unix-like pipes&lt;/a&gt;.&#xA;This style of programming also pairs well with &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;functors&lt;/a&gt; and &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;monads&lt;/a&gt;, which we will see in later sections.&lt;/p&gt;&#xA;&lt;p&gt;Thanks to &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/control/#lazy&#34;&gt;lazy evaluation&lt;/a&gt;, each operation in the pipeline can start feeding partial results to the next one, even if it has not finished processing its input list.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Functor</title>
      <link>https://unibz-oofp-25-26.github.io/docs/pattern/sections/functor/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/pattern/sections/functor/</guid>
      <description>&lt;h1 id=&#34;functor&#34;&gt;&#xA;  Functor&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#functor&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;The notion of functor comes from a branch of mathematics called &lt;a href=&#34;https://en.wikipedia.org/wiki/Category_theory&#34;&gt;category theory&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For programmers, a functor can be viewed as a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/&#34;&gt;generic type&lt;/a&gt; that implements a certain function (called &lt;code&gt;fmap&lt;/code&gt; in Haskell), while respecting certain &lt;a href=&#34;#constraints&#34;&gt;constraints&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;&lt;code&gt;Functor&lt;/code&gt; in Haskell is a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/bound/#class&#34;&gt;type class&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A type &lt;code&gt;t&lt;/code&gt; that belongs to this class must:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;be a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/&#34;&gt;generic type&lt;/a&gt; (with a single type variable), and&lt;/li&gt;&#xA;&lt;li&gt;implement the function&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fmap&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;Functor&lt;/span&gt; t) &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; (a &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; b) &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; t a &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; t b&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Terminology.&lt;/em&gt;&lt;/strong&gt;&#xA;The function &lt;code&gt;fmap&lt;/code&gt; &lt;strong&gt;lifts&lt;/strong&gt; a function&lt;/p&gt;</description>
    </item>
    <item>
      <title>Monad</title>
      <link>https://unibz-oofp-25-26.github.io/docs/pattern/sections/monad/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/pattern/sections/monad/</guid>
      <description>&lt;h1 id=&#34;monad&#34;&gt;&#xA;  Monad&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#monad&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Like &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/pattern/sections/functor/&#34;&gt;functors&lt;/a&gt;, monads come from category theory.&lt;/p&gt;&#xA;&lt;p&gt;For programmers, a monad can be viewed as a functor that implements additional functions, while respecting certain constraints.&lt;/p&gt;&#xA;&lt;p&gt;Monads serve a variety of purposes in functional programs.&#xA;This includes (among other) writing to a log, or reading data.&lt;/p&gt;&#xA;&lt;p&gt;In this section, we will only focus on two of the simplest monads, namely the type of lists and the option type (as we did for functors).&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
