emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Lawrence Bottorff <borgauf@gmail.com>,
	emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Haskell org-mode problems redux
Date: Thu, 30 May 2019 23:25:08 +0200	[thread overview]
Message-ID: <5cf03c32.1c69fb81.2b66a.5651@mx.google.com> (raw)
In-Reply-To: <CAFAhFSXDn9y1Bh3C86UX23ea0_FRGzKQ+R+r3r=WsNFwqoptZw@mail.gmail.com>


Hi Lawrence,


Lawrence Bottorff <borgauf@gmail.com> writes:

> I've been trying to get Haskell to work in babel code blocks for a long
> time. A year or so ago I tried and eventually gave up. I tried again
> recently . . . same old problems, i.e., the code block is evaluated
> exclusively by the ghci REPL, which doesn't understand or play well with an
> org babel code block.
>
...
> Soooo, any ideas?

I'm using the header arguments:


    :prologue ":{\n" :epilogue ":}\n" 

     

to request org to insert those multiline tags :{ :} 
(so, I'm not using ":set +m").

I'm defining these header args as headline properties (so that I don't
have to enter them again and again).  Something like that:

  #+begin_example
    ,** A title
       :PROPERTIES:
       :header-args:haskell: :prologue ":{\n" :epilogue ":}\n"
       :END:
  #+end_example

I'm telling ghci to not insert a prompt, when waiting for the end of a
multiline.

#+begin_src haskell
:set prompt-cont ""
#+end_src


Configured like this, it seems to be working quite well for me (great
job org and GHC teams!).


#+begin_src haskell
  doubleSmallNumber x =
      if x > 10
          then x
          else x * 2
#+end_src

No error.

#+begin_src haskell
let
    showMe :: Int -> [String]
    showMe x = [show x, show $ doubleSmallNumber x]
in 
  [ ["x", "doubleSmallNumber x"]
  , showMe 3
  , showMe 13
  ]
#+end_src

#+RESULTS:
    |  x | doubleSmallNumber x |
    |  3 |                   6 |
    | 13 |                  13 |



My config:

    | ghci  | 8.6.3 |
    | emacs |  26.1 |
    | org   | 9.2.3 |
    | OS    | linux |


If it doesn't work for you on GNU/Linux, post the example and I will try
it on my computer (sorry, I won't be able to help you with Microsoft
Windows though).



Bruno


> LB

  reply	other threads:[~2019-05-30 20:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 17:55 Haskell org-mode problems redux Lawrence Bottorff
2019-05-30 21:25 ` Bruno Barbier [this message]
2019-05-31  3:40   ` Lawrence Bottorff

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=5cf03c32.1c69fb81.2b66a.5651@mx.google.com \
    --to=brubar.cs@gmail.com \
    --cc=borgauf@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).