Sunday, October 31, 2010

Installing Heist

Now that I have snap installed, the next part is to install Heist - the X(HT)ML templating library for use with snap.
$ cabal install heist
And that's it - no problems at all.

Saturday, October 16, 2010

Installing Snap (a web framework for Haskell) on Mac OS X Snow Leopard

I haven't been very active writing posts here, but hopefully this will change as I start to document my experience with Snap - a Haskell web framework. I have some experience with Haskell, though have never used it for web applications. Outside of Haskell, I have limited experience developing web applications, and hope to expand my knowledge of both by exploring Snap.

A quick overview of my system:
  • Mac OS X version 10.6.4 (Snow Leopard)
  • Haskell Platform version 2010.2.0.0 which includes ghc version 6.12.3
First impressions are very good as I browse the website and skim over the tutorials and documentation provided. The first step is to install Snap: $ cabal update $ cabal install snap-server After a short while compiling, cabal failed with the following message: cabal: Error: some packages failed to install: bytestring-mmap-0.2.1 failed during the building phase. The exception was: ExitFailure 1 snap-core-0.2.13 depends on bytestring-mmap-0.2.1 which failed to install. snap-server-0.2.13.3 depends on bytestring-mmap-0.2.1 which failed to install. Hmm...trying again to try to narrow down what the problem was: $ cabal install snap-server I get a bit more info: Resolving dependencies... Configuring bytestring-mmap-0.2.1... Preprocessing library bytestring-mmap-0.2.1... Building bytestring-mmap-0.2.1... [1 of 3] Compiling System.IO.Posix.MMap.Internal (System/IO/Posix/MMap/Internal.hs, dist/build/System/IO/Posix/MMap/Internal.o ) ghc: could not execute: /Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/ghc-asm cabal: Error: some packages failed to install: bytestring-mmap-0.2.1 failed during the building phase. The exception was: ExitFailure 1 snap-core-0.2.13 depends on bytestring-mmap-0.2.1 which failed to install. snap-server-0.2.13.3 depends on bytestring-mmap-0.2.1 which failed to install. Ok, so the problem is around executing /Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/ghc-asm. Looking at the contents of this file, I see that it is a perl script with the perl interpreter location set to: #!/opt/local/bin/perl Running: $ which perl I find that perl is located at /usr/bin/perl. Making the appropriate substitution and trying again, the installation was successful. Note that this problem has been documented here