
Hi I have been trying to learn haskell (tip over the vending machine) for a while and eventually decided the Haskore music library might be a good way to start understating the language. I am using windows and hugs98. The IOExtensions.hs file will not work under windows. Any ideas on how to make it work or is this library *nix only? Regards David ----------------------------------------------------------------------------- -- -- Replacement for IOExtensions.hs of hugs for ghc -- -- Implements only the functions necessary for Haskore! -- -- Does not work under Windows (where there is a difference between -- binary and text files) -- -- Suitable for use with Hugs 98 ----------------------------------------------------------------------------- module IOExtensions( writeBinaryFile, openBinaryFile, readBinaryFile ) where import System( getArgs ) import IO( Handle, IOMode(WriteMode), openFile, hPutStr, hClose ) import IOExts openBinaryFile :: FilePath -> IOMode -> IO Handle openBinaryFile path mode = openFileEx path (BinaryMode mode) writeBinaryFile :: FilePath -> String -> IO () writeBinaryFile = writeFile -- this does not work on Windows!!! readBinaryFile :: FilePath -> IO String readBinaryFile = readFile -- this does not work on Windows!!! -- It chews up lies and spits out the gristle of truth http://liveatthewitchtrials.blogeasy.com/

On Fri, 22 Sep 2006, David Curran wrote:
Hi I have been trying to learn haskell (tip over the vending machine) for a while and eventually decided the Haskore music library might be a good way to start understating the language.
Please, don't understate this language! ;-)
I am using windows and hugs98. The IOExtensions.hs file will not work under windows. Any ideas on how to make it work or is this library *nix only?
I think that this problem was resolved in the revised Haskore version, see http://darcs.haskell.org/haskore/ and its binary file wrapper http://darcs.haskell.org/haskore/src/Haskore/General/IO.hs However, I feel that this Haskore version is no longer simple enough for learning.

Hello David, Friday, September 22, 2006, 1:40:31 PM, you wrote:
openBinaryFile :: FilePath -> IOMode -> IO Handle
import System.IO
writeBinaryFile :: FilePath -> String -> IO () writeBinaryFile f txt = bracket (openBinaryFile f WriteMode) hClose (\hdl -> hPutStr hdl txt)
readBinaryFile :: FilePath -> IO String readBinaryFile name = openBinaryFile name ReadMode >>= hGetContents
these definitions will work both on unix and win -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (5)
-
Bulat Ziganshin
-
David Curran
-
Henning Thielemann
-
Jón Fairbairn
-
Paul Hudak