kubuszok.com<p>Personally just a "developer" without X in front of it, currently working with Scala.</p><p>I enjoy learning new things, especially more abstract like mathematics or algorithmics.</p><p>If you want to know about new posts follow me on <a href="https://twitter.com/MateuszKubuszok">Twitter</a> or <a href="https://kubuszok.com/feed.xml">RSS</a> feed!</p>
https://kubuszok.com//
Wed, 17 May 2023 01:45:09 +0200Wed, 17 May 2023 01:45:09 +0200Jekyll v4.3.2IO monad: which, why and how<p>In many discussions about FP - especially about purely functional programming - there are talks about IO monad, IO type and so on. Its users’ argument on how it is better than your standard imperative approach, how it helps reason, encapsulate side-effects and design more elegant programs. On the other hand, its opponents argue, that programs are side-effectful by nature, so you would end up with something that needs IO for like 80% of the codebase while learning curve for newcomers would go up, so what the benefit? Let’s try to figure out.</p>
Mon, 27 May 2019 00:00:00 +0200
https://kubuszok.com/2019/io-monad-which-why-and-how/
https://kubuszok.com/2019/io-monad-which-why-and-how/scalaiomonadcatsscalazzioeffectefffreefreerttfiMathematics and Computer ScienceAST playground: recursion schemes and recursive data<p>So, we parsed an input - file, stream of characters or string - and we got a nicely structured data in the form of a tree and/or an algebraic data type. What now?</p>
Mon, 06 May 2019 00:00:00 +0200
https://kubuszok.com/2019/ast-playground-recursion-schemes-and-recursive-data/
https://kubuszok.com/2019/ast-playground-recursion-schemes-and-recursive-data/recursive schemeastrecursioncorecursionfoldunfoldrefoldcatamorphismanamorphismhylomorphismmatryoshkatrampolinegadtMathematics and Computer ScienceFrom String to AST: parsing<p>Whether you have to do with data in form of CSV, JSON or a full-blooded programming language like C, JavaScript, Scala, or maybe a query language like SQL, you always transform some sequence of characters (or binary values) into a structured representation. Whatever you’ll do with that representation depends on your domain and business goals, and is quite often the core value of whatever you are doing. With a plethora of tools doing the parsing for us (including the error-handling), we might easily overlook how complex and interesting process it is.</p>
Mon, 29 Apr 2019 00:00:00 +0200
https://kubuszok.com/2019/from-string-to-ast-parsing/
https://kubuszok.com/2019/from-string-to-ast-parsing/regular expressionregular languagefinite state machinecontext-free grammarpushdown automataparserparser combinatorastMathematics and Computer ScienceADT through the looking glass - lenses, prims and other optics<p>Algebraic data structures and invaluable in functional programming. With immutable data structures reasoning about the code is easy. Concurrency requires little effort as you don’t have to be worried about locking, mutexes and semaphores - nobody can change your data anyway. If you need to update something you can just create an updated copy and use it for now on. Except if you have a nested structure and need to update something deep, deep inside.</p>
Mon, 24 Dec 2018 00:00:00 +0100
https://kubuszok.com/2018/adt-through-the-looking-glass/
https://kubuszok.com/2018/adt-through-the-looking-glass/lensprismoptionalisogetsetMathematics and Computer ScienceDifferent ways to understand a monad<p>As soon as you start mentioning functional programming, monads pops out as something that you have to know. However, hardly anyone is good at explaining what a monad is. That is why we’ll try to get some intuition about it without defining it.</p>
Mon, 17 Dec 2018 00:00:00 +0100
https://kubuszok.com/2018/different-ways-to-understand-a-monad/
https://kubuszok.com/2018/different-ways-to-understand-a-monad/monadcircuit breakingfor comprehensionfreetransformercomonadMathematics and Computer ScienceThe F-words: functor and friends<p>While algebras are something we (programmers) rely on in our everyday work, we don’t always use them knowingly. Functional programming, however, has a relatively high number of programmers, that care about correctness and mathematical formalism, that leads to it.It is no surprise that it was FP that explored the idea that if you perceive your program as a pipeline of operations, you could provide stronger guarantees if you had a tools to define such pipelines mathematically.</p>
Mon, 10 Dec 2018 00:00:00 +0100
https://kubuszok.com/2018/the-f-words-functors-and-friends/
https://kubuszok.com/2018/the-f-words-functors-and-friends/functorcofunctorinvariantphantombufunctorprofunctornatural transformationfunctionkyoneda lemmaMathematics and Computer ScienceAlgebras we love<p>If you work with anything that can be modeled mathematically, you most likely know that many things you work can be expressed with algebras. However, if you are not a graduate of a <em>computer science course or similar</em> you might not know how ubiquitous they are and how often you rely on some of them. (And I don’t mean F-algebras and FP-concepts). So what are algebras and where can we meet some most common of them?</p>
Mon, 03 Dec 2018 00:00:00 +0100
https://kubuszok.com/2018/algebras-we-love/
https://kubuszok.com/2018/algebras-we-love/algebramagmasemigroupmonoidfreegroupsymmetrypermutationabelianringidealquotientfieldbooleangaloisMathematics and Computer ScienceIt's all about relations<p>In FP we talk a lot about algebras functions and types. But types are sets and functions are also sets. Algebras are types with operations, that fulfill some conditions, which means also sets. So how <em>low</em> should we get if we want to start from the beginning? I would say we should start with finitary relations.</p>
Mon, 26 Nov 2018 00:00:00 +0100
https://kubuszok.com/2018/its-all-about-relations/
https://kubuszok.com/2018/its-all-about-relations/relationpreorderequivalencepartial orderlinear orderlatticefunctionMathematics and Computer ScienceIn the beginning, there was the empty set<p>What would you say if I told you that in math everything is a set? That, whatever mathematical object you name, it can be defined using sets? And not sets, that contains some special ingredient somewhere deep inside - but by basically wrapping up empty sets and merging it with more wrapped empty sets in various degree of wrapping?</p>
Mon, 19 Nov 2018 00:00:00 +0100
https://kubuszok.com/2018/in-the-beginning-there-was-the-empty-set/
https://kubuszok.com/2018/in-the-beginning-there-was-the-empty-set/setset theorypeanonumbernaturalintegerrationalrealMathematics and Computer ScienceKinds of types in Scala, part 3: embedding some more info in a type<p><a href="/2018/kind-of-types-in-scala-part-2/">In the previous post</a>, we understood how parametric types work, which let cover most of the cases we’ll have in our everyday coding. However, there are some interesting concepts, which, while not so heavily used, can come handy at a time.</p>
Mon, 20 Aug 2018 00:00:00 +0200
https://kubuszok.com/2018/kinds-of-types-in-scala-part-3/
https://kubuszok.com/2018/kinds-of-types-in-scala-part-3/scalatypekindKinds of types in Scala