Michael J. Forster

Tar Road to Sligo

Gallagher’s Frolics

Whew! Poor light and make-shift tools, but my SBDC001 fits now!

Whew! Poor light and make-shift tools, but my SBDC001 fits now!

R&D: Content Delivery with AWS S3, Pharo, and Zinc HTTP Components

To reduce or eliminate the need for attached persistent storage for a client’s AWS instances, I’m exploring the use of S3 and CloudFront to store and deliver static content and uploaded files.

Since most of the applications hosted on the instances are written in Pharo, I’m using the Zinc-AWS package from Sven Van Caekenberghe’s excellent Zinc HTTP Components.

Installing LispWorks 6.1 Professional (32 bit) on Slackware64 14.1

I installed LispWorks 6.1 Professional (32-bit) on multilib Slackware64 14.1 .

The Slackware64 multilib installation includes the required GTK+ 2 (>=2.4). However, attempting to run LispWorks gives the following error message:

$ /usr/local/lib/LispWorks/lispworks-6-1-0-x86-linux

(lispworks:30162): GdkPixbuf-WARNING **: Cannot open
   pixbuf loader module file 
   '/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such
   file or directory

This likely means that your installation is broken.
Try running the command
    gdk-pixbuf-query-loaders \
      > /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.

To remedy this, I ran the 32-bit_version of gdk-pixbuf-query-loaders(1):

$ su -
# gdk-pixbuf-query-loaders-32 \
       > /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache

Following that, LispWorks started without incident.

Installing OCaml on Slackware

Here I describe my installation of the OCaml compiler and tool chain on Slackware 13.37.

The SlackBuilds OCaml script for Slackware 13.37 specifies OCaml 3.12.1. However, that’s sufficient to install OPAM, which, in turn, can be used to install not only newer but multiple versions of OCaml.

After installing OCaml 3.12.1, I downloaded the source for OPAM 1.1.0 and followed the installation instructions. I initialised OPAM, answering “yes” to the prompt to update ~/.bash_profile and ~/.ocamlinit, and logged out and back in to make sure the OPAM environment would be set properly.

With OPAM installed, I switched to OCaml 4.01.0, installed Jane Street's core, core_extended, core_bench, and async libraries, and installed utop.

I added the following lines to &;/.ocamlinit to configure the ocaml and utop toplevels:

#use "topfind";;
#require "core.top";;
#require "core.syntax";;

I will open Core.Std as needed, so I didn’t add it to ~/.ocamlinit.

Installing newsbeuter on Slackware

I used the Slackbuilds script to install newsbeuter 2.5 on Slackware 13.37.

stfl was required, so I used the SlackBuilds script to install stfl 0.22.

json-c was required, so I used the SlackBuilds script to install json-c 0.9.

Using Haskell in Anger

Recently, late in a risky project, I chose to abandon my previous efforts with another language and use Haskell to solve a difficult problem. This has been one of the best professional decisions I’ve made, and much of the success must be attributed to Haskell, its community, and functional programming in general.

However, diving into paid work with Haskell has meant focusing on production and deployment concerns at some expense to learning the language itself. It’s time to document the former and plan to remedy the latter.

Developing and Deploying with Haskell

Having installed GHC and the Haskell Platform, I have a stable Haskell environment, and I want to keep it that way. So far, I’ve used cabal only to install cabal-dev, pointfree, hlint, and ghc-paths (for GHCi) into my user package database:

$ cabal install cabal-dev
$ cabal install pointfree
$ cabal install hlint
$ cabal install ghc-paths

For the project, I’ve used cabal-dev in place of cabal to install libraries and compile the executable:

$ mkdir -p /path/to/project
$ cd /path/to/project
$ cabal init -n --is-executable
$ cabal-dev install postgresql-simple
$ cabal-dev install datetime
$ cabal-dev configure
$ cabal-dev build && cabal-dev ghci
.\ main
$ cabal-dev build && cabal-dev install

Generally, I’ve followed the advice given in How to write a Haskell program and Structure of a Haskell Project.

Learning Haskell

I’ve perused both Learn You a Haskell for Great Good! and Real World Haskell sporadically over the past couple of years, but I’m working through them in earnest now.

As well, I’m using the Haskell wiki Applications and libraries section as a guide to studying GHC and its tool environment. First up is the Prelude:

The most important Haskell library is called the Prelude. It is
implicitly imported by default, and includes the most commonly used
functions. Make sure you know what they do and how to use them

Of course, I’ll always have a tab open to Hoogle.

Reinstalling Haskell on Slackware

I had not included hscolour when I recently installed Haskell. Consequently, package documentation was not created.

I removed the GHC and Haskell Platform Slackware packages and deleted root’s and my ~/.cabal and ~/.ghc directories. Then, I built a Slackware package for hscolour using the Slackbuilds script. Finally, I installed the Slackware packages for GHC, hscolour, and Haskell Platform, in that order.