emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: ParetoOptimalDev via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: emacs-orgmode@gnu.org
Subject: 1 character fix to make ob-haskell compatible with table outputs
Date: Tue, 14 Mar 2023 22:22:13 -0500	[thread overview]
Message-ID: <87bkkuitqy.fsf@mailfence.com> (raw)


Just change the `[` and `]` to `(` and `)` respectively.

List of lists aren't parsed correctly by ob-haskell, but tuples of
tuples are.

That means this code change I just tested works:

(defun org-babel-haskell-var-to-haskell (var)
  "Convert an elisp value VAR into a haskell variable.
The elisp VAR is converted to a string of haskell source code
specifying a variable of the same value."
  (if (listp var)
      (concat "(" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") ")")
    (format "%S" var)))

For something like:

name:tbl
#+begin_src sh
echo -e "1\t2\t3"
#+end_src

#+RESULTS:
| 1 | 2 | 3 |

#+begin_src haskell :var table=tbl
print table
#+end_src

#+RESULTS:
| 1 | 2 | 3 |

Whereas before it would not print the table out because it isn't parsed correctly.



             reply	other threads:[~2023-03-15  5:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15  3:22 ParetoOptimalDev via General discussions about Org-mode. [this message]
2023-03-15  8:54 ` 1 character fix to make ob-haskell compatible with table outputs Ihor Radchenko
2023-03-22  0:04   ` ParetoOptimalDev via General discussions about Org-mode.
2023-03-22  7:54     ` Ihor Radchenko

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=87bkkuitqy.fsf@mailfence.com \
    --to=emacs-orgmode@gnu.org \
    --cc=pareto.optimal@mailfence.com \
    /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).