midi-0.2.0.1: Handling of MIDI messages and files

Safe Haskell | Safe-Inferred

Sound.MIDI.IO

Description

Taken from Haskore.

Synopsis

- openBinaryFile :: FilePath -> IOMode -> IO Handle
- readBinaryFile :: FilePath -> IO ByteList
- writeBinaryFile :: FilePath -> ByteList -> IO ()
- type ByteList = [Word8]
- listCharFromByte :: ByteList -> String
- listByteFromChar :: String -> ByteList

# Documentation

openBinaryFile :: FilePath -> IOMode -> IO Handle

Like `openFile`, but open the file in binary mode. On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLF. This is usually what you want with text files. With binary files this is undesirable; also, as usual under Microsoft operating systems, text mode treats control-Z as EOF. Binary mode turns off all special treatment of end-of-line and end-of-file characters. (See also `hSetBinaryMode`.)

readBinaryFile :: FilePath -> IO ByteList Source

writeBinaryFile :: FilePath -> ByteList -> IO ()Source

Hugs makes trouble here because it performs UTF-8 conversions. E.g. `[255]` is output as `[195,191]` It would be easy to replace these routines by FastPackedString(fps).ByteList.Lazy, however this introduces a new package dependency.

type ByteList = [Word8]Source

listCharFromByte :: ByteList -> String Source

listByteFromChar :: String -> ByteList Source