emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 1 character fix to make ob-haskell compatible with table outputs
@ 2023-03-15  3:22 ParetoOptimalDev via General discussions about Org-mode.
  2023-03-15  8:54 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: ParetoOptimalDev via General discussions about Org-mode. @ 2023-03-15  3:22 UTC (permalink / raw)
  To: emacs-orgmode


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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-22  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15  3:22 1 character fix to make ob-haskell compatible with table outputs ParetoOptimalDev via General discussions about Org-mode.
2023-03-15  8:54 ` Ihor Radchenko
2023-03-22  0:04   ` ParetoOptimalDev via General discussions about Org-mode.
2023-03-22  7:54     ` Ihor Radchenko

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).