Possible to load a JS lib into the REPL?


Wanted to experiment with a library that exposes a foreign function interface, from within the REPL. Is it possible to load the JS native library into the REPL to make this work?


The question is difficult to answer because there’s not much detail. Can you share what you did and what you hoped would happen? If you want to use a JS library directly from the purescript repl, then the answer is probably no; the purescript repl only deals with purescript code, although if there are purescript bindings for that library then I think you should be able to use them from the repl.

Yes, I have a module that defines several foreign functions. I could attempt to load easily enough, but it’s unclear to me how the FFI definitions would work if the JS library that is being referenced is not somehow “loaded” into the REPL as well? I don’t see any switches for loading the JS library, for example.

Have you tried it already? It might just work without you having to do anything.

1 Like

This really surprised me, but you were right, it just worked. I think the library just needed to be on the path. Thanks.