Hi,

I noticed that ob-haskell.el doesn't support custom ghci prompts at present.
Custom ghci prompts such as "λ>" are quite popular in the haskell community, 
see for example

https://stackoverflow.com/questions/42081379/how-to-set-up-org-babel-for-haskell-with-stack

Could you have a look at the following patch and see, wether that would work in 
general, wrt. coding standars etc.
Obviously it works on my system, but I'm not an experienced elisp programmer, 
so I guess there might be  room for
improvement. 

diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el
index cc78bec33..361b2b9ce 100644
--- a/lisp/ob-haskell.el
+++ b/lisp/ob-haskell.el
@@ -59,14 +59,23 @@
 
 (defvar org-babel-haskell-eoe "\"org-babel-haskell-eoe\"")
 
+(defvar haskell-prompt-regexp)
+
 (defun org-babel-execute:haskell (body params)
   "Execute a block of Haskell code."
+  (require 'inf-haskell)
+  (add-hook 'inferior-haskell-hook
+            (lambda ()
+              (setq-local comint-prompt-regexp
+                          (concat haskell-prompt-regexp "\\|^λ?> "))))
   (let* ((session (cdr (assq :session params)))
          (result-type (cdr (assq :result-type params)))
          (full-body (org-babel-expand-body:generic
 		     body params
 		     (org-babel-variable-assignments:haskell params)))
          (session (org-babel-haskell-initiate-session session params))
+	 (comint-preoutput-filter-functions
+	       (cons 'ansi-color-filter-apply comint-preoutput-filter-functions))
          (raw (org-babel-comint-with-output
 		  (session org-babel-haskell-eoe t full-body)
                 (insert (org-trim full-body))

Reply via email to