I'm not clear on everything you've saying.
My program, at present, opens some MIDI ports and leaves them open while it is running. It presents me with a command line prompt from which I can configure the program and initiate MIDI playback. I can also halt playback in progress. Every time I change the score (in the Sibelius typesetter program), I initiate a new playback action.
What you are saying sounds like running the program once for each playback. I guess the program wouldn't leave the MIDI ports open, as it has to close them before it exits. But that should work fine. I would also need a different way of configuring the program -- the current settings would have to be stored in a file so they won't be lost when the program exits.
I wonder about two things. First, I would like the majority of the program to be compiled. It needs speed. Is there a way to compile everything but the module that "varies" a Score?
Second, the Vary.hs module would need to be located on the disk in the same directory as the music score, to keep things organized. But on my disk (MacBook Pro with SS drive) there is one tree for Haskell source, /Users/Dennis/haskell. I use the option "-i/Users/Dennis/haskell" which compiling or running ghci. The musical scores are all stored in a different tree, "/Users/Dennis/Dropbox/music/comp".
So I don't know how to "import" a file that is not in my Haskell source tree, and more important, is not determined until run time.
Oh yeah, I don't specify the specific score when I run my program, but rather let it search the /Users/Dennis/Dropbox/music/comp tree for the most recently modified score. This is convenient, because over the course of an hour or two that I compose, I would switch several times between scores, and as soon as I modify and save a particular score, that one becomes the source for playback.
So the program would locate a recently modified Sibelius score, say $MUSIC/piano/tocatta1.sib. (Where $MUSIC is /Users/Dennis/Dropbox/music/comp). Then the program would assume there is some Haskell source in the same directory, called "toccata1.hs". This source would contain functions that vary the expression in ways I like for that particular composition.
Does this sound doable with ghci? Or the GHC API?
About what I've learned about expression score realization, I could perhaps share some things at some point. Unfortunately I have bad work habits... I often don't take care to finish projects in a way that is presentable, so I have many years of half-finished compositions that can't even be played back with the current version of my program. I'm 48 years old and finally realizing just how important it is to organize and finish things. And to collaborate. I found another musician to collaborate with -- I will make computer "interpretations" of his compositions.
So my top priority over the next several months is to look over back projects and finish things enough to get some sound, then archive the *sound files* -- so they don't become obsolete. (Assuming wav or mp3 is trustworthy for a while.)
D