I thought it would be an unpleasant task, but it turned out it to be an entirely lovely task to deal with haskell and MIDI files directly (without having to deal with the current work-in-progress that is haskore).
The source file is here. To produce a major scale in ghci, do something like the following:
createMidi "test.mid" [50,52,54,55,57,59,61,62]
I even managed to do something useful with this sort of code, that I’ll post some time in the near future.