3

Are there any redistributable1 solutions2 to loading Haskell scripts3 from a Haskell program?

1 Statically linked; not need the end user to install ghc or have anything special on their PATH.

2 Ie a library plus some setup on my end.

3 That are written in Haskell, and have access to some set of symbols exported from the program doing the loading. This is the important one. I've been able to load and run code snippets with hint, but I haven't been able to get them to see any symbols in my program, which is how scripting systems normally work.

4
  • 4
    The "symbols in your program" don't exist at runtime, except in interpreted mode. Commented Feb 13, 2014 at 23:16
  • That's what I was afraid of. Is there no way to get at them? Commented Feb 13, 2014 at 23:27
  • @Dan Look at the code ghc generates. It's very much not Haskell-y at all. Commented Feb 14, 2014 at 16:03
  • @Cubic Not necessarily get at them directly, but possibly though some kind of stub mechanism. Commented Feb 14, 2014 at 18:12

1 Answer 1

1

Idea #1: If you want the code to have access to certain functions, you could just pass those functions in as arguments. (May not work well if there's a huge number of them though.)

Idea #2: FFI allows you to export symbols to C, so it should be possible to import those back into Haskell on the other side. Probably ugly though.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.