I want to install, and use Happstack, and what should of taken 10 minutes, has been bugging me all day. First off, I had to wrestle with Cabal, and eventually gutted it out, and installed a fresh copy, and updated it:
# I use Fedora 16...
yum remove cabal-install
...
yum install cabal-install
...
cabal update
...
# I was told that a new version was available.
cabal install cabal-install
...
cabal install happstack-server
None of these commands failed (or at least they didn't give the impression that they did.)
With it now installed, I decided to try and build the first, simple example found in the Crashcourse guide.
I have it written as:
-- server.hs
module Main where
import Happstack.Server (nullConf, simpleHTTp, toResponse, ok)
main :: IO()
main = simpleHTTP nullConf $ ok "Hello World!"
When I try to compile it with GHC using the commandline of:
ghc --make -threaded server.hs -o server
I get the following error:
server.hs:3:8:
Could not find module `Happstack.Server':
Use -v to see a list of the files searched for.
and using the suggested -v
option gives:
Glasgow Haskell Compiler, Version 7.0.4, for Haskell 98, stage 2 booted by GHC version 7.0.4
Using binary package database: /usr/lib/ghc-7.0.4/package.conf.d/package.cache
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-6bf7b03ebc9c668817e4379b6796c0c2
wired-in package integer-gmp mapped to integer-gmp-0.2.0.3-4c5ab8b517f0b5d4ecf2153d5dfb7f41
wired-in package base mapped to base-4.3.1.0-4582a5bc64f22f03f6d960b4f15c981f
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.5.0.0-958de6d18727479331372229849ac6b8
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
ghc: no input files
Honestly, I'm having a hard time interpreting that. Anyways, I decided it was time to Google (again!) That lead me to this similar question (Which is messy and not very useful by the way...), and it suggested trying to load the module in GHCi.
I gave it a shot, and to my surprise, this works:
> :m Happstack.Server
> simpleHTTP nullConf $ ok "Hello World!"
>
> ...MODULE LOADING INFORMATION HERE...
as well as this:
> :l server
> main
Both run and behave as they should.
So in short, this is weird, Cabal is a hassle, and I don't really have much experience with the basic Haskell toolset (yet.)
Anyone got any ideas on how to fix this? Thanks in advance! :)