emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roland Coeurjoly <rolandcoeurjoly@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Babel Haskell. Print all results when header has :results output
Date: Tue, 28 Apr 2020 18:22:28 +0200	[thread overview]
Message-ID: <CAMdauZoVFdx=Jy1ZgNUNLQze3W7wnZ8WkHHho1L8Zx4zhU5i9Q@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 428 bytes --]

Right now, when executing the following source block

#+begin_src haskell :results output
[1..10]
"hello" == "hello"
   #+end_src

I get the following output:

#+RESULTS:
   : True

Whereas (for me) the desired result would be

#+RESULTS:
   : [1,2,3,4,5,6,7,8,9,10]
   : True

I created the attached patch that achieves the desired result.

Please notice that the default behaviour (without :results output) remains
unchanged.

[-- Attachment #1.2: Type: text/html, Size: 684 bytes --]

[-- Attachment #2: 0001-Print-all-results.patch --]
[-- Type: text/x-patch, Size: 879 bytes --]

From 0e7d2ac22a028507eaf5ecc85623b62572ee3de8 Mon Sep 17 00:00:00 2001
From: Roland Coeurjoly <rolandcoeurjoly@gmail.com>
Date: Tue, 28 Apr 2020 18:06:50 +0200
Subject: [PATCH] Print all results

---
 lisp/org/ob-haskell.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index d32a2f7bc0..e5ef0999e0 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -145,7 +145,7 @@ org-babel-interpret-Haskell
     (org-babel-reassemble-table
      (let ((result
             (pcase result-type
-              (`output (mapconcat #'identity (reverse (cdr results)) "\n"))
+              (`output (mapconcat #'identity (reverse results) "\n"))
               (`value (car results)))))
        (org-babel-result-cond (cdr (assq :result-params params))
 	 result (org-babel-script-escape result)))
-- 
2.20.1


             reply	other threads:[~2020-04-28 17:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 16:22 Roland Coeurjoly [this message]
2020-05-04 15:01 ` Babel Haskell. Print all results when header has :results output Nicolas Goaziou
2020-05-04 15:44   ` Roland Coeurjoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMdauZoVFdx=Jy1ZgNUNLQze3W7wnZ8WkHHho1L8Zx4zhU5i9Q@mail.gmail.com' \
    --to=rolandcoeurjoly@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).