Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell as a scripting language

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.

like image 855
Dan Avatar asked Apr 20 '26 07:04

Dan


1 Answers

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.

like image 104
MathematicalOrchid Avatar answered Apr 23 '26 14:04

MathematicalOrchid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!