Book Club : IFPuH Section 1.1

I pushed sample and exercises for section 1.1.

Here is some of what I learned, only a bit from the book:

  • Rudimentary cabal (Haskell build / package util)
  • Rudimentary HUnit (Haskell version of JUnit)
  • Rudimentary Haskell function definitions

I haven’t figured out the naming / script files yet. I feel like I should have better test names than ‘testN’. Still, I’d like to differentiate between sample code and problem set, and maybe have the section name in the test. That may allow fewer files, to the extent that the sample code / solution code remains conflict free.

Barely learned any Haskell yet, but this was productive learning the dev tools needed to build and test the projects. A fulfilling start. The most complicated Haskell was in the HUnit tests, and that was nearly all cut and paste from google searches to get the HUnit tests to compile and run. 

One thing I don’t care for regarding HUnit as run by cabal: the shell output is not what I expected.

$ cabal test

Preprocessing test suite 'tests' for funcprog-0.1.0.0..

Building test suite 'tests' for funcprog-0.1.0.0..

[2 of 2] Compiling MainTest         ( app\test\MainTest.hs, dist\build\tests\tests-tmp\MainTest.o )

Linking dist\build\tests\tests.exe …

Running 1 test suites…

Test suite tests: RUNNING…

Test suite tests: PASS

Test suite logged to: dist\test\funcprog-0.1.0.0-tests.log

1 of 1 test suites (1 of 1 test cases) passed.

The thing is, I had 13 tests cases spread across multiple test groups. To me, the (1 of 1 test cases) passed is misleading. The .log file does show the more typical xUnit runner output, so there is that.

The next most complicated bit I learned was about cabal, the Haskell build and package tool. It took a bit of work to modify the templates / samples I’d seen to match some to the directory structure and names I chose. I am not at all sure how to handle multiple libraries / modules or binaries or test suites. I suspect it will be additional stanzas or possibly nested .cabal files. I expect I’ll find out soonish.

Leave a Reply

Your email address will not be published. Required fields are marked *