Simon Beaumont | 10 Jun 22:07 2013

Bug: Babel Haskell mode [8.0.3 (8.0.3-30-g56b864-elpa <at> /Users/ix/.emacs.d/elpa/org-20130610/)]


Whenever I try and evaluate the Haskell code block I get:
"Code block returned no value."

#+begin_src haskell :results value
  let fac n = product [1..n]
  [(x,fac x) | x <- [0..11]]
#+end_src

#+results:

I am using ghci as my haskell-program
The Haskell source is correctly executed in the *haskell* inferior mode.

> let fac n = product [1..n]
[(x,fac x) | x <- [0..11]]
"org-babel-haskell-eoe"
> [(0,1),(1,1),(2,2),(3,6),(4,24),(5,120),(6,720),(7,5040),(8,40320),(9,362880),(10,3628800),(11,39916800)]
> "org-babel-haskell-eoe"
> 

The raw binding receives appropriate data below but the "parse" is
always null

...
(defun org-babel-execute:haskell (body params)
  "Execute a block of Haskell code."
  (let* ((session (cdr (assoc :session params)))
         (vars (mapcar #'cdr (org-babel-get-header params :var)))
         (result-type (cdr (assoc :result-type params)))
(Continue reading)

Eric Schulte | 11 Jun 00:53 2013
Picon

Re: Bug: Babel Haskell mode [8.0.3 (8.0.3-30-g56b864-elpa <at> /Users/ix/.emacs.d/elpa/org-20130610/)]

Simon Beaumont <simon <at> datalligator.com> writes:

> Whenever I try and evaluate the Haskell code block I get:
> "Code block returned no value."
>
> #+begin_src haskell :results value
>   let fac n = product [1..n]
>   [(x,fac x) | x <- [0..11]]
> #+end_src
>
> #+results:
>

I can't reproduce this problem.  With a minimal emacs config started
with -Q, and loading the attached init.el file (you'll have to update
the paths to work with your system).

Attachment (init.el): application/emacs-lisp, 278 bytes

I'm able to execute the following Org-mode file returning a table of
results as expected (although I have to execute it twice, presumably to
clear out some cruft at the beginning of the haskell session).

Attachment (haskell.org): text/x-org, 88 bytes

I'm using
(Continue reading)

Simon Beaumont | 11 Jun 17:15 2013

Re: Bug: Babel Haskell mode [8.0.3 (8.0.3-30-g56b864-elpa <at> /Users/ix/.emacs.d/elpa/org-20130610/)]

Well that's really odd: I modded the paths in init.el and did the following:

emacs -Q -l init.el foo.org

When I eval'ed the code block in foo.org (twice) I still get message: "Code block returned no value"
I've attached the inferior haskell buffer and all relevant files.
Attachment (init.el): application/octet-stream, 407 bytes
Attachment (foo.org): application/octet-stream, 104 bytes
GHClet fac n = product [1..n]
[(x,fac x) | x <- [0..11]]
"org-babel-haskell-eoe"
i, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
> [(0,1),(1,1),(2,2),(3,6),(4,24),(5,120),(6,720),(7,5040),(8,40320),(9,362880),(10,3628800),(11,39916800)]
> "org-babel-haskell-eoe"
> let fac n = product [1..n]
[(x,fac x) | x <- [0..11]]
"org-babel-haskell-eoe"
> [(0,1),(1,1),(2,2),(3,6),(4,24),(5,120),(6,720),(7,5040),(8,40320),(9,362880),(10,3628800),(11,39916800)]
> "org-babel-haskell-eoe"
> 

--
Looks like we are on the same versions of emacs and ghc:

(Continue reading)

Eric Schulte | 13 Jun 07:18 2013
Picon

Re: Bug: Babel Haskell mode [8.0.3 (8.0.3-30-g56b864-elpa <at> /Users/ix/.emacs.d/elpa/org-20130610/)]

Simon Beaumont <simon <at> datalligator.com> writes:

> Well that's really odd: I modded the paths in init.el and did the following:
>
> emacs -Q -l init.el foo.org
>
> When I eval'ed the code block in foo.org (twice) I still get message:
> "Code block returned no value" I've attached the inferior haskell
> buffer and all relevant files.
>
> (add-to-list 'load-path "~/.emacs.d/elpa/haskell-mode-20130610.152")

I thought maybe it could be a difference between our haskell modes, so I
switched to the latest available through my elpa (haskell-mode-13.6),
and I still see the correct behavior.

> GHClet fac n = product [1..n]
> [(x,fac x) | x <- [0..11]]
> "org-babel-haskell-eoe"
> i, version 7.6.3: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
>> [(0,1),(1,1),(2,2),(3,6),(4,24),(5,120),(6,720),(7,5040),(8,40320),(9,362880),(10,3628800),(11,39916800)]
>> "org-babel-haskell-eoe"
>> let fac n = product [1..n]
> [(x,fac x) | x <- [0..11]]
> "org-babel-haskell-eoe"
>> [(0,1),(1,1),(2,2),(3,6),(4,24),(5,120),(6,720),(7,5040),(8,40320),(9,362880),(10,3628800),(11,39916800)]
>> "org-babel-haskell-eoe"
(Continue reading)

Simon Beaumont | 13 Jun 11:35 2013

Re: Bug: Babel Haskell mode [8.0.3 (8.0.3-30-g56b864-elpa <at> /Users/ix/.emacs.d/elpa/org-20130610/)]

Hi Eric,

Thanks for investigating this.

You got it! The blooming prompt! As you say the comint parser expects "Prelude>" and I have customised my
prompt in .ghci (also this wouldn't work with module loads like :m +Mymodule.Foo as this changes the ghci
prompt). 

BTW if I use a unicode sequence for the prompt (like a greek lambda as a few knights of the lambda calculus do) 
then accept-process-output hangs! 

Well at least that's me fixed! Would it be possible for comint to learn the prompt by sending an empty line and
then adapting? -- It would need to do this every time it sees a :command and at startup. Of course this is ghci specific.

Or is the answer to write an evaluation server for ghc with a well defined client API? Then Haskell
integration gets a lot easier -- this would be like slime (common-lisp) for Haskell. Might be worth an
enquiry on the Haskell list as there is a Haskell API that might cover the requirement.

Simon Beaumont

-------------------
On 13 Jun 2013, at 06:18, Eric Schulte <schulte.eric <at> gmail.com> wrote:

> Simon Beaumont <simon <at> datalligator.com> writes:
> 
>> Well that's really odd: I modded the paths in init.el and did the following:
>> 
>> emacs -Q -l init.el foo.org
>> 
>> When I eval'ed the code block in foo.org (twice) I still get message:
(Continue reading)

Eric Schulte | 13 Jun 15:04 2013
Picon

Re: Bug: Babel Haskell mode [8.0.3 (8.0.3-30-g56b864-elpa <at> /Users/ix/.emacs.d/elpa/org-20130610/)]

Simon Beaumont <simon <at> datalligator.com> writes:

> Hi Eric,
>
> Thanks for investigating this.
>
> You got it! The blooming prompt! As you say the comint parser expects
> "Prelude>" and I have customised my prompt in .ghci (also this
> wouldn't work with module loads like :m +Mymodule.Foo as this changes
> the ghci prompt).
>
> BTW if I use a unicode sequence for the prompt (like a greek lambda as
> a few knights of the lambda calculus do) then accept-process-output
> hangs!
>

I would take this up either with the maintainers of comint-mode, or
possibly the inferior-haskell developers.  The function used by Org-mode
(namely `org-babel-comint-with-output') uses standard comint variables
(e.g., `comint-prompt-regexp'), so this is one area where the Babel ship
rises and falls with the quality of the Emacs tide.

>
> Well at least that's me fixed! Would it be possible for comint to
> learn the prompt by sending an empty line and then adapting? -- It
> would need to do this every time it sees a :command and at startup. Of
> course this is ghci specific.
>

I'd raise this with the inferior-haskell devs.
(Continue reading)


Gmane