LoginSignup
4
3

More than 5 years have passed since last update.

Language.Haskell.Interpreter

Posted at

hintパッケージより。hintはGHC APIのラッパーで簡単に動的にスクリプトを読めるので、プラグインとかはこれで作れそう。

% runghc
module Main where
import Language.Haskell.Interpreter

main :: IO ()
main = do
  res <- runInterpreter withPlugins
  putStrLn . show $ res
  return ()

withPlugins :: InterpreterT IO ()
withPlugins = do
  setImports ["Prelude", "Data.List"]
  evaled <- interpret "intersperse ',' \"ABCDEF\"" (as :: String)
  (lift . putStrLn) evaled
  return ()
A,B,C,D,E,F
Right ()
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3