all messages for Emacs-related lists mirrored at yhetil.org
 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

* Re: 1 character fix to make ob-haskell compatible with table outputs
  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.
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2023-03-15  8:54 UTC (permalink / raw)
  To: ParetoOptimalDev; +Cc: emacs-orgmode

ParetoOptimalDev via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:

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

The table is parsed and printed correctly on the latest main.
I use GHC 9.0.2-r3.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: 1 character fix to make ob-haskell compatible with table outputs
  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
  0 siblings, 1 reply; 4+ messages in thread
From: ParetoOptimalDev via General discussions about Org-mode. @ 2023-03-22  0:04 UTC (permalink / raw)
  To: emacs-orgmode


Oh, great to hear it's fixed!



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

* Re: 1 character fix to make ob-haskell compatible with table outputs
  2023-03-22  0:04   ` ParetoOptimalDev via General discussions about Org-mode.
@ 2023-03-22  7:54     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2023-03-22  7:54 UTC (permalink / raw)
  To: ParetoOptimalDev; +Cc: emacs-orgmode

ParetoOptimalDev via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:

> Oh, great to hear it's fixed!

Sorry, I was not clear.
I do not know if the bug existed to start with.
I just cannot reproduce on the latest main, which can be for many
reasons, starting from me misunderstanding the bug, or maybe me using
different GHC version.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.