emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Haskell org-mode problems redux


From: Bruno Barbier
Subject: Re: [O] Haskell org-mode problems redux
Date: Thu, 30 May 2019 23:25:08 +0200

Hi Lawrence,


Lawrence Bottorff <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]