<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>ppenzin</title>
    <meta name="viewport" content="width=device-width">
    <meta name="description" content="A (possibly technical) blog of Petr Penzin.">
    <link rel="canonical" href="http://ppenzin.github.io/feed.xml">

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/main.css">

</head>


    <body>

    <header class="site-header">

  <div class="wrap">

    <a class="site-title" href="/">ppenzin</a>

    <nav class="site-nav">
      <a href="#" class="menu-icon">
        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
           viewBox="0 0 18 15" enable-background="new 0 0 18 15" xml:space="preserve">
          <path fill="#505050" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0
            h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
          <path fill="#505050" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484
            h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
          <path fill="#505050" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0
            c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
        </svg>
      </a>
      <div class="trigger">
        
          <a class="page-link" href="/about/">About</a>
        
          <a class="page-link" href="/feed.xml"></a>
        
          <a class="page-link" href="/"></a>
        
          <a class="page-link" href="/projects/">Projects</a>
        
          <a class="page-link" href="/assets/main.css"></a>
        
      </div>
    </nav>

  </div>

</header>


    <div class="page-content">
      <div class="wrap">
      <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>ppenzin</title>
    <description>A (possibly technical) blog of Petr Penzin.</description>
    <link>http://ppenzin.github.io/</link>
    <atom:link href="http://ppenzin.github.io/feed.xml" rel="self" type="application/rss+xml" />
    
      <item>
        <title>Kill The Doctor</title>
        <description>&lt;p&gt;LLVM has “Kill the doctor” &lt;a href=&quot;https://github.com/llvm-mirror/llvm/blob/master/utils/KillTheDoctor/KillTheDoctor.cpp&quot;&gt;test utility&lt;/a&gt; for disabling DrWatson when
tests are running (a scenario would be that a test would throw an exception and
DrWatson UI would pop up, freezing the build). Its file comment is worth
reproducing in full:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//===- KillTheDoctor - Prevent Dr. Watson from stopping tests ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This program provides an extremely hacky way to stop Dr. Watson from starting
// due to unhandled exceptions in child processes.
//
// This simply starts the program named in the first positional argument with
// the arguments following it under a debugger. All this debugger does is catch
// any unhandled exceptions thrown in the child process and close the program
// (and hopefully tells someone about it).
//
// This also provides another really hacky method to prevent assert dialog boxes
// from popping up. When --no-user32 is passed, if any process loads user32.dll,
// we assume it is trying to call MessageBoxEx and terminate it. The proper way
// to do this would be to actually set a break point, but there's quite a bit
// of code involved to get the address of MessageBoxEx in the remote process's
// address space due to Address space layout randomization (ASLR). This can be
// added if it's ever actually needed.
//
// If the subprocess exits for any reason other than successful termination, -1
// is returned. If the process exits normally the value it returned is returned.
//
// I hate Windows.
//
//===----------------------------------------------------------------------===//
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Tue, 27 Feb 2018 22:29:19 +0000</pubDate>
        <link>http://ppenzin.github.io/open%20source/motivation/2018/02/27/kill-the-doctor.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/open%20source/motivation/2018/02/27/kill-the-doctor.html</guid>
      </item>
    
      <item>
        <title>What do programmers do</title>
        <description>&lt;p&gt;This old rant came up in a conversation with a colleague, here is a
&lt;a href=&quot;https://www.computer.org/csdl/mags/so/2003/01/s1005.pdf&quot;&gt;link&lt;/a&gt; or
&lt;a href=&quot;https://www.researchgate.net/publication/220092569_The_Software_Developer_as_Movie_Icon&quot;&gt;two&lt;/a&gt;.
Warren Harrison (former PSU CS chair and IEEE Software editor) wrote an
excellent take on what’s wrong with CS education. He does a little bit of old
man rambling; and, of course, it is the students, but his article really does
expose a lot of problems in the system itself.&lt;/p&gt;

&lt;p&gt;A colleague’s reaction was: “this is hopeless, if people draw information about
their future field from movies then nothing could be done.” While the idea that
undergrads would be inspired by popular culture to choose their major sounds silly,
there nothing too astonishing about it. I think the main reason this happens is
information vacuum surrounding STEM disciplines in the US. While everyone
thinks Computer Science pays well (and therefore &lt;em&gt;you&lt;/em&gt; should chose major in
it), but no one really knows what is it about; therefore there is such a stark
contrast between what people think we do and what we actually do. A separate
problem is what is taught in CS classes (the primary reason students stay
ignorant to the nature of their field for so long), but that is a big enough
topic for a separate post.&lt;/p&gt;

&lt;p&gt;While Warren hits it right on about team players and ability to express
thoughts in English, Computer Science and especially “algorithm-heavy” parts of
it should be viewed as something close to high-level finance industry: there
are things there that have drifted pretty far away from “everyday” reality and
require a lot of special knowledge to understand.&lt;/p&gt;

</description>
        <pubDate>Tue, 07 Jun 2016 22:47:17 +0000</pubDate>
        <link>http://ppenzin.github.io/software/education/2016/06/07/what-do-programmers-do.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/software/education/2016/06/07/what-do-programmers-do.html</guid>
      </item>
    
      <item>
        <title>Back to Plan 9</title>
        <description>&lt;p&gt;Some time ago I was not able to resist a hoarding urge and “rescued” an old HP
laptop. Pavilion zv5000 (in case you are curious).&lt;/p&gt;

&lt;p&gt;I tried a few Linux and BSD incarnations but nothing stuck, primarily due to
lack of drivers. And finally I got lucky with Plan 9.&lt;/p&gt;

&lt;p&gt;Plan 9 was my first introduction to Unix-like operating systems. I discovered
it by accident and was so fascinated with it, that I kept on reading old
articles and documentation for it even though I was not really able to put it
to much use.&lt;/p&gt;

&lt;p&gt;And now, after more than ten years, I suddenly have a laptop and a handful of
virtual machines running it. I have to say that prior experience with Unix-like
environments is required to get anywhere with it, regardless of what 9fans
mailing list has to say.&lt;/p&gt;

</description>
        <pubDate>Thu, 19 Nov 2015 17:50:54 +0000</pubDate>
        <link>http://ppenzin.github.io/plan%209/system%20software/2015/11/19/back-to-plan9.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/plan%209/system%20software/2015/11/19/back-to-plan9.html</guid>
      </item>
    
      <item>
        <title>Run your family like a software company</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;Responding to change over following a plan&lt;/p&gt;

  &lt;p&gt;provided a detailed plan is in place to respond to the change, and it is
followed precisely&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;– &lt;a href=&quot;http://www.halfarsedagilemanifesto.org/&quot;&gt;Half-arsed agile manifesto&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For all who are familiar with Agile (but beware, you won’t be able to unsee it):&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/J6oMG7u9HGE&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;This is a &lt;a href=&quot;https://www.ted.com/talks/bruce_feiler_agile_programming_for_your_family&quot;&gt;TED&lt;/a&gt; video, it is a couple years old and it is somewhat
hillarious. It could have been a parody on Agile Coaching and family
counseling, but, unfortunately, &lt;a href=&quot;http://en.wikipedia.org/wiki/Bruce_Feiler&quot;&gt;he is serious&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;He claims that he is using &lt;a href=&quot;http://www.agilemanifesto.org/&quot;&gt;agile&lt;/a&gt; &lt;s&gt;to manage his family&lt;/s&gt; in his
family, but the stuff he is saying sounds more like Agile’s evil corporate
&lt;a href=&quot;http://www.halfarsedagilemanifesto.org/&quot;&gt;cousin&lt;/a&gt; with “&lt;em&gt;the simple new process that will make your company more
successful&lt;/em&gt;”.&lt;/p&gt;

&lt;p&gt;There is just so much wrong with the video, from the belief that software
development methodologies can be applied to family life, to what Agile and
Waterfall are, to fictional “Agile Programming”. Ironicaly, it is not uncommon
to see similar things in companies that claim to be doing Agile. On the upside,
at least he is not referring to his children as “resources”.&lt;/p&gt;

</description>
        <pubDate>Sun, 25 Jan 2015 19:52:01 +0000</pubDate>
        <link>http://ppenzin.github.io/unsee%20this/2015/01/25/agile-family.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/unsee%20this/2015/01/25/agile-family.html</guid>
      </item>
    
      <item>
        <title>Do not use scripting languages for building your project</title>
        <description>&lt;p&gt;Every now and then I come across projects that use some sort of scripting
solutions to hold their builds together. What I mean is build scripts written
in Bash, Python, Perl or any other general-purpose scripting language. Usually
scripts are used as wrappers for makefiles or any other build tools and are
trying to make up for functionality those tools are lacking, though there are
those rare cases when they are used to invoke the compiler directly. This has
to stop and here is why:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Is is wasteful. You are requiring people to carry around a shell or an
interpreter (often legacy) just for the sake of running a handful of scripts
(often just a single script).  Unless you are using those things for what
they are supposed to be used, that is an unnecessary dependency. Moreover,
building is fairly repetitive and tedious by nature, so you are looking at
chasing a lot of little bugs that cause substantial trouble.&lt;/li&gt;
  &lt;li&gt;It is not quite cross-platform. This is mostly true for Bash idioms and other
&lt;em&gt;linuxisms&lt;/em&gt;. Not everyone in the world has the same set up as you do, nor
they need to have.&lt;/li&gt;
  &lt;li&gt;It does not do you any good personally, unless you want to do program in
scripting languages for a living. It is a much better investment of time to
learn to do advanced stuff with popular build tools than hone your skills in
languages that you would never use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some suggestions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Switch to more advanced build tools. CMake and Autotools help when
Makefile-based projects get out of hand; Maven is a powerful tool for Java
projects, and so on. Those tools have been around for a while and have become
de facto standards. They have the common use-cases implemented and are
more consistent that hand-rolled build systems.&lt;/li&gt;
  &lt;li&gt;Write your own build modules: use extendable build tools (CMake for example)
and write extensions for it. That way your build scripts are kept in a
language designed for builds.&lt;/li&gt;
  &lt;li&gt;Create your own build tool. If nothing helps, try to implement the custom
functionality that you need as a complete product rather than set of
scripts. Designing it will help you review your build process and might
trigger some positive changes for the project. And if it succeeds you get
another marketable app almost for free.&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Tue, 13 Jan 2015 18:16:37 +0000</pubDate>
        <link>http://ppenzin.github.io/builds/design%20decisions/2015/01/13/dont-use-build-scripts.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/builds/design%20decisions/2015/01/13/dont-use-build-scripts.html</guid>
      </item>
    
      <item>
        <title>FreeBSD: QuickCheck (tf-random) and `invalid byte sequence'</title>
        <description>&lt;p&gt;Have you ran into this while installing QuickCheck on FreeBSD?&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;QuickCheck-2.7.5 depends on tf-random-0.5 which failed to install.
tf-random-0.5 failed during the final &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;step. The exception was:
/tmp/pkgConf-tf-random-043046.5: hGetContents: invalid argument &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;invalid byte
sequence&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I wasted a lot of time trying to debug this, but today I was fighting with a
similar problem with Jekyll and finally found an &lt;a href=&quot;https://pgib.me/blog/2013/09/25/jekyll-freebsd-byte-sequence/&quot;&gt;answer&lt;/a&gt;. In
short, the issue is that tf-random (as well as &lt;a href=&quot;https://pgib.me/blog/2013/09/25/jekyll-freebsd-byte-sequence/&quot;&gt;Liquid&lt;/a&gt;) needs
UTF-8 input. And FreeBSD does not use that encoding by default.&lt;/p&gt;

&lt;h2 id=&quot;the-solution&quot;&gt;The solution&lt;/h2&gt;
&lt;p&gt;Add appropriate language and encoding tag. to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default:&lt;/code&gt; section of your
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/login.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you your language is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;en_US&lt;/code&gt; then you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lang&lt;/code&gt; tag would be
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:lang=en_US.UTF-8:&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Before:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;default:&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  :passwd_format&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;md5:&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;many lines...&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;

  :umask&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;022:&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;default:&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  :passwd_format&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;md5:&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;many lines...&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;

  :umask&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;022:&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  :lang&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;en_US.UTF-8:&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To reload the changes, run (as root):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;cap_mkdb /etc/login.conf&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After that relogin to your environment. More details in the mentioned
&lt;a href=&quot;https://pgib.me/blog/2013/09/25/jekyll-freebsd-byte-sequence/&quot;&gt;post&lt;/a&gt;. Thanks to &lt;a href=&quot;https://pgib.me/&quot;&gt;Patrick Gibson&lt;/a&gt; for sharing the solution.&lt;/p&gt;

</description>
        <pubDate>Wed, 25 Jun 2014 00:46:12 +0000</pubDate>
        <link>http://ppenzin.github.io/haskell/quickcheck/freebsd/2014/06/25/tf-random-invalid-byte-sequence.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/haskell/quickcheck/freebsd/2014/06/25/tf-random-invalid-byte-sequence.html</guid>
      </item>
    
      <item>
        <title>'Welcome to Jekyll'</title>
        <description>&lt;p&gt;There is a lot left to be done, but I got bare minimal content migrated to &lt;a href=&quot;http://github.io&quot;&gt;Github Pages&lt;/a&gt; from my &lt;a href=&quot;http://zeuk-zeuk.blogspot.com&quot;&gt;old blog&lt;/a&gt;. I hope to be using this blog mainly to publish documents related to my &lt;a href=&quot;http://github.com/ppenzin/?tab=repositories&quot;&gt;projects&lt;/a&gt; hosted on Github.&lt;/p&gt;

</description>
        <pubDate>Tue, 24 Jun 2014 14:32:03 +0000</pubDate>
        <link>http://ppenzin.github.io/jekyll/update/2014/06/24/welcome-to-jekyll.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/jekyll/update/2014/06/24/welcome-to-jekyll.html</guid>
      </item>
    
      <item>
        <title>Haskell build automation: alternatives to Cabal</title>
        <description>In the &lt;a href=&quot;http://ppenzin.github.io/2014/05/26/haskell-build-automation-cabal/&quot;&gt;previous post&lt;/a&gt; I've talked about issues that Cabal has. Now it is time to talk about what alternatives there are.&lt;br /&gt;&lt;h4&gt;Existing tools: task management&lt;/h4&gt;Haskell can work with various task automation tools, starting with good old &lt;i&gt;make&lt;/i&gt;. Among the tools written in Haskell &lt;a href=&quot;https://hackage.haskell.org/package/nemesis&quot;&gt;nemesis&lt;/a&gt; and &lt;a href=&quot;http://hackage.haskell.org/package/shake&quot;&gt;shake&lt;/a&gt; definitely worth mentioning.&lt;br /&gt;&lt;br /&gt;One problem with task management tools is that one has to create work flow for them, they don't mandate anything or come with any predefined tasks. A bigger problem is that they still require `global' dependencies, so building with different versions of the same library would be as painful as it is with Cabal.&lt;br /&gt;&lt;br /&gt;Some workaround would be to create some project-carving tool, like &lt;a href=&quot;https://rubygems.org/gems/jeweler&quot;&gt;Jeweler&lt;/a&gt; or &lt;a href=&quot;https://rubygems.org/gems/hoe&quot;&gt;Hoe&lt;/a&gt; in Ruby. That would introduce a work flow and will set up important tasks, like mandatory testing, but will not help with dependencies.&amp;nbsp;Well, actually the tool can incorporate dependency resolution task, but that will make it almost identical to work flow solutions discussed below.&lt;br /&gt;&lt;h4&gt;Solutions yet to be implemented: standard work flow&lt;/h4&gt;More drastic approach is to&amp;nbsp;implement a work flow based tool similar to &lt;a href=&quot;http://maven.apache.org/&quot;&gt;Maven&lt;/a&gt;. Standard work flows are a great thing, especially when project needs to be packaged in a particular way, or one wants to ensure that tests are ran every time a build is done.&lt;br /&gt;&lt;br /&gt;That also has more potential for fixing dependencies, because if fetching dependencies is part of the work flow, then they can be stored and compiled (assuming that they are distributed as source code) locally.&lt;br /&gt;&lt;br /&gt;As a solution one can implement a Haskell plugin for an existing tool, like Maven or Gradle. That would be as hard as writing it from scratch, since those are heavily geared towards compiling to Java bytecode. Also, those tools are not implemented in Haskell, and I would like to show that Haskell is can stand up to a project like this.&lt;br /&gt;&lt;br /&gt;So I personally really like the idea of implementing a `conventions and standard work flows' build automation tool in Haskell. I will try to give this a shot, but it will be a big effort, so we'll see what happens.
</description>
        <pubDate>Thu, 12 Jun 2014 00:00:00 +0000</pubDate>
        <link>http://ppenzin.github.io/2014/06/12/haskell-build-automation-alternatives.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/2014/06/12/haskell-build-automation-alternatives.html</guid>
      </item>
    
      <item>
        <title>Haskell build automation: Cabal</title>
        <description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Disclaimer&lt;/h2&gt;The purpose of this and the following posts is to evaluate options for build automation tools for Haskell, and propose possible solutions for improving developer experience and facilitating test-driven development.&lt;br /&gt;&lt;br /&gt;This post is solely based on my opinion, which is affected by my experience with other tools, mostly &lt;i&gt;Maven&lt;/i&gt; and &lt;i&gt;Make&lt;/i&gt;. I believe that having a good build automation tool makes a big impact on developer experience and code quality. I think improving build automation is easier and more beneficial than enabling continuous integration using a faulty build tool.&lt;br /&gt;&lt;br /&gt;I don't have an intention to criticize anyone or the software they are contributing to. I think Cabal is a great tool for creating and sharing packages, but I would like to look at it in relation to build automation.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;What is a `build automation tool'&lt;/h2&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Build_automation&quot;&gt;Wikipedia&lt;/a&gt; on build automation:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Build automation is the act of scripting or automating a wide variety of tasks that software developers do in their day-to-day activities including things like:&lt;/blockquote&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;blockquote&gt;compiling computer source code into binary code&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;packaging binary code&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;running tests&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;deployment to production systems&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;&lt;blockquote&gt;creating documentation and/or release notes&lt;/blockquote&gt;&lt;/li&gt;&lt;/ul&gt;As for the build automation system, there are various ways to think about that, but what I am looking for is a tool that can run at least build, test and package in one command.&lt;br /&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Using Cabal for builds&lt;/h2&gt;&lt;br /&gt;Packaging and sharing of Haskell projects is traditionally done via Cabal. Cabal is as good as it can get for manipulating Haskell packages and interacting with HackageDB, but it has several shortcomings when it comes to manging builds.&lt;br /&gt;&lt;br /&gt;There is an excellent post about why &lt;a href=&quot;http://ivanmiljenovic.wordpress.com/2010/03/15/repeat-after-me-cabal-is-not-a-package-manager/&quot;&gt;Cabal is not a good package manager&lt;/a&gt;. I have to add that it might not pass as a modern build automation tool, either.&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Build life cycle&lt;/h3&gt;&lt;br /&gt;Build life cycle is a set of stages that project passes during build process. It enforces a work flow. For tools that see builds as a set of custom tasks or targets (Make, Rake, Ant) that work flow is defined by the relationships between tasks and there is now default. For tools that are based on conventions and standard life cycles, like Maven, there is a default work flow that can be extended to fit project needs.&lt;br /&gt;&lt;br /&gt;Cabal does not fall into either of the categories: it is does not have custom tasks, but does not have a standard work flow either. There is a list of commands in &lt;a href=&quot;http://www.haskell.org/cabal/users-guide/installing-packages.html&quot;&gt;Cabal user guide&lt;/a&gt;, (and some of them are obviously included in one another like install and register) but there is no clear definition of what build phases project has to go through before deployment.&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Configuration&lt;/h3&gt;In addition to .cabal configuration file, there is an extra `configure' step that sometimes needs to be run manually. By default `cabal configure' checks if the dependencies are installed, but it has to be used for some other things, like enabling tests (more on that later):&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;cabal configure --enable-tests&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;cabal build&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;cabal test&lt;/blockquote&gt;I am not sure why that could not have been read from .cabal and automatically included in the build or test phase.&lt;br /&gt;&lt;br /&gt;Also, Cabal configuration can not define new build phases, cabal will always stick with the set of command it already has. But there are various situations when having adding a new goal makes a lot of sense than trying to integrate with existing ones.&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Haskell Dependencies&lt;/h3&gt;There are some issues with how cabalized dependencies are handled in Cabal builds.&lt;br /&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Local build dependencies are optional&lt;/h4&gt;Unless you are using sandboxes, dependencies that Cabal installs are fairly global (system-wide or user). That can cause version conflicts which you might not be able to resolve.&lt;br /&gt;&lt;br /&gt;The solution is to use optional cabal sandbox, that will track installed dependencies for the current copy of the project separately from system-wide libraries. That would help, but will add a few extra manual steps, which will bring us to the next point.&lt;br /&gt;&lt;br /&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Too much manual intervention&lt;/h4&gt;To tell cabal to install dependencies and then build one needs to run two commands:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;cabal install --only-dependencies&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;cabal build&lt;/blockquote&gt;&lt;br /&gt;That installs dependencies globally, so if you want to tie them your sandboxed version of the project, you would have to run a few `cabal sandbox' commands on top of that. Sandboxed and non-sandboxed dependency installation is done by the same command, so if you forgot to create a sandbox you are risking messing up your Haskell installation.&lt;br /&gt;&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Testing&lt;/h3&gt;In order to &lt;a href=&quot;http://www.haskell.org/cabal/users-guide/developing-packages.html#test-suites&quot;&gt;add tests&lt;/a&gt; to a cabalized project, one has to provide wrapper code, for example you might have to surround your quickcheck test suite with IO code that reports status via exit codes.&lt;br /&gt;&lt;br /&gt;Also, testing is optional, to enable it one has to run a configure command before building the project:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;cabal configure --enable-tests&lt;/blockquote&gt;This has to be done even after you have included a reference to test suite in your .cabal configuration file (just mentioning it in the configuration file is not enough). Also, `enable tests' does not stick, if you re-run configure and forget the flag, Cabal will happily disable tests. None of that helps with test-driven development.&lt;br /&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;TL;DR&lt;/h3&gt;Cabal is a great tool for manipulating packages, but it does not enforce a build work flow and requires a significant amount of manual bookkeeping to produce a full build.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(To be potentially continued...)&lt;/div&gt;
</description>
        <pubDate>Mon, 26 May 2014 00:00:00 +0000</pubDate>
        <link>http://ppenzin.github.io/2014/05/26/haskell-build-automation-cabal.html</link>
        <guid isPermaLink="true">http://ppenzin.github.io/2014/05/26/haskell-build-automation-cabal.html</guid>
      </item>
    
  </channel>
</rss>

      </div>
    </div>

    <footer class="site-footer">

  <div class="wrap">

    <h2 class="footer-heading">ppenzin</h2>

    <div class="footer-col-1 column">
      <ul>
        <li>ppenzin</li>
        <li><a href="mailto:"></a></li>
      </ul>
    </div>

    <div class="footer-col-2 column">
      <ul>
        <li>
          <a href="https://github.com/ppenzin">
            <span class="icon github">
              <svg version="1.1" class="github-icon-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                 viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
                <path fill-rule="evenodd" clip-rule="evenodd" fill="#C2C2C2" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761
                c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32
                c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472
                c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037
                C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65
                c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261
                c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082
                c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129
                c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/>
              </svg>
            </span>
<!--
            <span class="username">ppenzin</span>
-->
          </a>
        </li>
        <li>
          <a href="https://twitter.com/ppenzin">
            <span class="icon twitter">
              <svg version="1.1" class="twitter-icon-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                 viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
                <path fill="#C2C2C2" d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809
                c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27
                c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767
                c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206
                C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271
                c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469
                c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"/>
              </svg>
            </span>
<!--
            <span class="username">ppenzin</span>
-->
          </a>
        </li>
        <li>
          <a href="/static/Penzin.pdf">
            <span class="username">resume</span>
          </a>
        </li>
      </ul>
    </div>

    <div class="footer-col-3 column">
      <p class="text">A (possibly technical) blog of Petr Penzin.</p>
    </div>

  </div>

</footer>


    </body>
</html>