Execute a Haskell Script with Arguments

Since a KM native action doesn't exist, I created this plugin that executes Haskell code with parameters. This is currently in experimental phase. I hope this gets natively implemented someday.

Author:

Gabriel @unlocked2412

Version 0.01

Execute a Haskell Script with Arguments.zip (9.8 KB)

Requirements:

Haskell downloads:

(runhaskell program should be at: /usr/local/bin/runhaskell)

The script should have an interact' :: (String -> String) -> IO () function to accept those arguments.

Notes:
I used some of the wonderful functions in the prelude-jxa library by Rob Trew. Could be found here: https://github.com/RobTrew/prelude-jxa

The plugin currently writes a temporary .hs file.

A Haskell playground could be found here (below Try it):

EDIT:

Example:

This example uses the modified interact' function.
Retrieving the second item of a KM Array:

This new version doesn't error if Arg has parenthesis (due to shell interpretation of parenthesis).

Version 0.02

Execute a Haskell Script with Arguments.zip (9.7 KB)

Example:

1 Like

Version 0.04

  • changed icon and minor edits.

Execute a Haskell Script with Arguments.zip (11.8 KB)

Note: Haskell platform must be installed in the machine.