yaxu / feedforward

GNU General Public License v3.0
129 stars 10 forks source link

Preload custom tidal code #19

Closed ndr-brt closed 3 years ago

ndr-brt commented 3 years ago

Implements #14

It's pretty complete, the only thing I wasn't able to implement is catching the runStmt exceptions, so now, if the script(s) passed is(are) not valid, the editor starts but the interpreter won't work. At the moment only "file not found" is handled.

I tried to pass a BootTidal.hs file but it does not work, I think because it does not accept ghc command like :set. It works if the input script is like:

let g = gain
    d = delay

I added optparse-applicative library to handle command line argument passing, it's really nice

ndr-brt commented 3 years ago

Done, thanks to @jwaldmann, now also if the scripts "wont compile", feedforward will start correctly

yaxu commented 3 years ago

Great! Will this stop feedforward from crashing on syntax errors too?

ndr-brt commented 3 years ago

Don't think, but we can work on that for sure!

jwaldmann commented 3 years ago

If you have a failing test case, I can look at it.

ndr-brt commented 3 years ago

@yaxu the crash on syntax errors appears when there's an syntax error into the minitidal syntax, because the typeChecksWithDetails function cannot catch them, and an exception is thrown by interpret. The solution is to catch the interpret solution (already implemented in #21 ), and at this point is possible to get rid of the typeChecksWithDetails, because the same errors that function catches are also thrown by interpret (did some trials). I will commit this on #21

yaxu commented 3 years ago

I think we might still want to keep typeChecksWithDetails. I might be wrong but I think when interpret raises an error, that requires the interpreter to be relaunched, which is more costly in terms of CPU. This is only a real problem for low powered devices like the pi zero, but that's the platform I originally made feedforward for.

ndr-brt commented 3 years ago

It's relaunched only if the error is not catched, if it went catched the interpreter keeps on working.

BTW, I was wrong on the minitidal syntax error, it keeps on crash on it also with catching error on interpret. will investigate (I will open an issue about that)

yaxu commented 3 years ago

Ok!