Hello Org Maintainers, This issue has been reproduced on org versions 9.1.14 and Git master, and comes with a patch.
* Issue ob-haskell.el::org-babel-execute:haskell produces spurious error messages when running haskell blocks without =:results output= specified. If =:results= is not specified or is set to =value=, or =silent=, evaluating haskell blocks with =C-c C-c= produces an error message: : org-babel-script-escape: ‘org-babel-script-escape’ expects a string". Below is a minimal example that produces the unexpected behavior. * ECM The ECM is in two parts, below. 2. The Org sample that produces the error. 3. The minimal =~/.emacs=. You may need to install the =ghc= package to get the =ghci= executable. ** Org File #+name: ecm-error-message #+BEGIN_SRC org 1. Evaluate the addThree-delcare block to produce the error message. If you receive an error about how =haskell-prompt-regexp= is undefined, evaluate the block again, that is a transient error. Create the =addThree= function that adds three to any number. Use =:results silent= to suppress the RESULTS block because we don't care about the results of a function declaration. ,#+name: addThree-declare ,#+begin_src haskell :results silent :{ addThree :: (Num a) => a -> a addThree x = x + 3 :} ,#+end_src Observed behavior (without the patch below): "org-babel-script-escape: ‘org-babel-script-escape’ expects a string" With the patch: (no output) 2. Apply the =addThree= function and get the result: ,#+name: addThree-apply ,#+begin_src haskell addThree 10 ,#+end_src With and without the patch: ,#+RESULTS: addThree-apply : 13 #+END_SRC ** .emacs This is the minimal example .emacs file to produce this error: #+BEGIN_SRC elisp (require 'org) (require 'ob-haskell) (setq org-babel-load-languages '((haskell . t))) #+END_SRC * Patch This unnecessary error message can be corrected with the following patch that applies cleanly on both Debian Stable's Org version 9.1.14 and the current git master (commit #93c50e3a7867a1a85fc78b337172585f7a10dcc6). #+BEGIN_SRC diff --- org-9.1.14/ob-haskell.el +++ org-9.1.14/ob-haskell.el @@ -92,7 +92,7 @@ (`output (mapconcat #'identity (reverse (cdr results)) "\n")) (`value (car results))))) (org-babel-result-cond (cdr (assq :result-params params)) - result (org-babel-script-escape result))) + result (if (stringp result) (org-babel-script-escape result)))) (org-babel-pick-name (cdr (assq :colname-names params)) (cdr (assq :colname-names params))) (org-babel-pick-name (cdr (assq :rowname-names params)) #+END_SRC This error may also prevent execution entirely in different configurations, but I have not been able to reliably confirm that behavior: https://emacs.stackexchange.com/questions/35709/cannot-execute-org-babel-haskell-block Thank you for your time, Nick