Some language modes seem to have built-in REPL support. Maybe worth considering. `futhark repl` shouldn't be difficult to wrangle.