invesdwin / invesdwin-context

Module system for software product lines
GNU Lesser General Public License v3.0
6 stars 0 forks source link

add scripting integration for haskell #40

Open subes opened 8 months ago

subes commented 8 months ago

https://eta-lang.org/

Unsuitable because there is no ScriptEngine in eta: https://github.com/typelead/eta/issues/466

subes commented 6 months ago

Better alternative: https://github.com/Frege/frege-interpreter

Call Java from Frege: http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/

blocker: https://github.com/Frege/frege-interpreter/issues/36#issuecomment-1969676299 (fixed)

Repl with: java -cp frege3.25-latest.jar frege.repl.FregeRepl

https://learnyouahaskell.com/introduction https://github.com/Frege/frege/wiki/LYAH-adaptions-for-Frege https://dierk.gitbooks.io/fregegoodness/content/

Frege ScriptEngine has a few flaws:

subes commented 6 months ago

Won't do since ScriptEngines don't work for In-JVM usage. Could introduce a REPL based binding (which should also work for vanilla haskell "ghci"), but this would be in a separate project, not in invesdwin-context.

subes commented 6 months ago

GHCI interpreter: https://stackoverflow.com/a/2144410

arch install "cabal-install" and "ghc-static"

cabal update cabal install hint

$ ghci

import Language.Haskell.Interpreter runInterpreter $ setImports ["Prelude"] >> eval "3 + 5"

subes commented 6 months ago

hGetLine to read a line from a socket: https://stackoverflow.com/questions/25040884/hgetcontents-vs-hgetline

hPutStrLn to write to socket https://stackoverflow.com/questions/37143458/socket-programming-in-haskell-putstrln-hputstrln-not-behaving-as-expected