[Haskell-cafe] ANN: Haskore tutorial (programming music using Haskell)

Henk-Jan van Tuyl hjgtuyl at chello.nl
Thu Aug 7 13:42:48 EDT 2008

On Tue, 05 Aug 2008 10:59:10 +0200, jinjing <nfjinjing at gmail.com> wrote:

> Hi there,
> Here's the project link:
> http://github.com/nfjinjing/haskore-guide/tree/master/doc/index.markdown
> I found Haskore pretty fun :) so I'm documenting it while learning it.
> Please don't hesitate to give suggestions / corrections.

About the installation section: I think beginners will be grateful if you  
write down the full "darcs get" commands and explain the --global  
parameter of the "cabal install" command.

There are two more packages that need to be downloaded:
  - package hosc depends on package binary
  - package haskore depends on package unix

Windows users will be grateful if you tell them that Haskore cannot be  
built on Windows, because of the dependance on the unix package. It would  
have saved me a lot of time if I knew that beforehand.

For the people interested in porting Haskore to Windows I'll describe what  
I have done so far:

System.Posix.Unistd.usleep replaced by Control.Concurrent.threadDelay
(of course, the name of the file is not correct after this; better put the  
timer function in another file)

File Haskore.cabal:
removed "unix" from section "Build-depends"

Added to cabal file:
    if os(windows)
         cpp-options: -DWIN32

Added to src\Haskore\Interface\CSound\Play.lhs:
> {-# OPTIONS -cpp #-}

and around the signal handling part and the line
> import qualified System.Posix.Signals as Signals

#ifndef WIN32

Same treatment for src/Haskore/Interface/MIDI/Play.lhs

Finally I discovered that in the file
environment variables are set and that there is no setEnv or putEnv for  
GCC knows the function setenv(), but that function does not work as  
expected (on Windows); once the program terminates, the created  
environment variable has dissapeared. After I discovered that, I decided  
it would be too much yak shaving for me to go on. To solve this problem,  
on would either create an improved setenv() function, or redesign Haskore  
to pass the information some other way (and of course the program(s) that  
read this information).

Met vriendelijke groet,
Henk-Jan van Tuyl


More information about the Haskell-Cafe mailing list