public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Literate Haskell code and testing functions
@ 2014-06-28  4:12 Shakthi Kannan
       [not found] ` <CABG-yt2krOAyLT6c8wRmYk4ce8F9NTWRgjZcObyx7szW3MxBQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Shakthi Kannan @ 2014-06-28  4:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi,

Consider the literate Haskell (line numbers mentioned only for
reference) in markdown text:

=== TEXT ===

1. A list 'a' is defined as a set with five integers, 1 to 5.
2.
3. > a :: [Int]
4. > a = [1, 2, 3, 4, 5]
5.
6. > -- The contents of a are:
7. > *Test> putStrLn "Contents of a:"
8. > *Test> a
9.
=== END ===

I want to be able to load the above text in GHCi, and be able to
execute the commands mentioned in "*Test>".

But, when generating the pandoc output document, I want only lines
1..5, without the testing code in "*Test>".  Is this possible?

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com


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

* Re: Literate Haskell code and testing functions
       [not found] ` <CABG-yt2krOAyLT6c8wRmYk4ce8F9NTWRgjZcObyx7szW3MxBQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-06-28  4:29   ` Ivan Lazar Miljenovic
       [not found]     ` <CA+u6gbz2U0vXp28ikA0RVmCo-GBRZMs=_MJBqRkADMcdMo-ghA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Lazar Miljenovic @ 2014-06-28  4:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 28 June 2014 14:12, Shakthi Kannan <shakthimaan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
>
> Consider the literate Haskell (line numbers mentioned only for
> reference) in markdown text:
>
> === TEXT ===
>
> 1. A list 'a' is defined as a set with five integers, 1 to 5.
> 2.
> 3. > a :: [Int]
> 4. > a = [1, 2, 3, 4, 5]
> 5.
> 6. > -- The contents of a are:
> 7. > *Test> putStrLn "Contents of a:"
> 8. > *Test> a
> 9.
> === END ===
>
> I want to be able to load the above text in GHCi, and be able to
> execute the commands mentioned in "*Test>".
>
> But, when generating the pandoc output document, I want only lines
> 1..5, without the testing code in "*Test>".  Is this possible?
>
> SK

If you're not generating LaTeX, maybe wrap it in \begin{code} ...
\end{code} or something?

(Or if you are generating LaTeX, wrap it in an HTML comment.)

>
> --
> Shakthi Kannan
> http://www.shakthimaan.com
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CABG-yt2krOAyLT6c8wRmYk4ce8F9NTWRgjZcObyx7szW3MxBQQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://IvanMiljenovic.wordpress.com


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

* Re: Literate Haskell code and testing functions
       [not found]     ` <CA+u6gbz2U0vXp28ikA0RVmCo-GBRZMs=_MJBqRkADMcdMo-ghA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-06-28  5:02       ` Shakthi Kannan
       [not found]         ` <CABG-yt24=fZUpwgXRgjGud3pcHHCBrd-3ouUUzpNDa8oerY0gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Shakthi Kannan @ 2014-06-28  5:02 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi,

--- On Sat, Jun 28, 2014 at 9:59 AM, Ivan Lazar Miljenovic
<ivan.miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
| If you're not generating LaTeX, maybe wrap it in \begin{code} ...
| \end{code} or something?
\--

You mean only for the test code, as in:

=== Input.lhs ===
A list 'a' is defined as a set with five integers, 1 to 5.

> a :: [Int]
> a = [1, 2, 3, 4, 5]

\begin{latex}

> a

\end{latex}
=== END ===

The above fails to load:

=== OUTPUT ===

$ ghci foo.lhs
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( Input.lhs, interpreted )

Input.lhs:8:3: Parse error: naked expression at top level
Failed, modules loaded: none.

=== END ===

I am actually generating PDF, but, would like to test the code in GHCi.

Thanks for your reply.

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com


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

* Re: Literate Haskell code and testing functions
       [not found]         ` <CABG-yt24=fZUpwgXRgjGud3pcHHCBrd-3ouUUzpNDa8oerY0gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-06-28  5:19           ` Ivan Lazar Miljenovic
  0 siblings, 0 replies; 4+ messages in thread
From: Ivan Lazar Miljenovic @ 2014-06-28  5:19 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Oh, you want ghci to automatically execute some lines?  I don't think
you can, sorry.

In this sense, Haskell isn't a scripting language like bash, python,
etc. where you can just add arbitrary lines to the end and have them
run when the file is loaded by the interpreter.

On 28 June 2014 15:02, Shakthi Kannan <shakthimaan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
>
> --- On Sat, Jun 28, 2014 at 9:59 AM, Ivan Lazar Miljenovic
> <ivan.miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> | If you're not generating LaTeX, maybe wrap it in \begin{code} ...
> | \end{code} or something?
> \--
>
> You mean only for the test code, as in:
>
> === Input.lhs ===
> A list 'a' is defined as a set with five integers, 1 to 5.
>
>> a :: [Int]
>> a = [1, 2, 3, 4, 5]
>
> \begin{latex}
>
>> a
>
> \end{latex}
> === END ===
>
> The above fails to load:
>
> === OUTPUT ===
>
> $ ghci foo.lhs
> GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> [1 of 1] Compiling Main             ( Input.lhs, interpreted )
>
> Input.lhs:8:3: Parse error: naked expression at top level
> Failed, modules loaded: none.
>
> === END ===
>
> I am actually generating PDF, but, would like to test the code in GHCi.
>
> Thanks for your reply.
>
> SK
>
> --
> Shakthi Kannan
> http://www.shakthimaan.com
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CABG-yt24%3DfZUpwgXRgjGud3pcHHCBrd-3ouUUzpNDa8oerY0gg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://IvanMiljenovic.wordpress.com


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

end of thread, other threads:[~2014-06-28  5:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-28  4:12 Literate Haskell code and testing functions Shakthi Kannan
     [not found] ` <CABG-yt2krOAyLT6c8wRmYk4ce8F9NTWRgjZcObyx7szW3MxBQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-28  4:29   ` Ivan Lazar Miljenovic
     [not found]     ` <CA+u6gbz2U0vXp28ikA0RVmCo-GBRZMs=_MJBqRkADMcdMo-ghA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-28  5:02       ` Shakthi Kannan
     [not found]         ` <CABG-yt24=fZUpwgXRgjGud3pcHHCBrd-3ouUUzpNDa8oerY0gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-28  5:19           ` Ivan Lazar Miljenovic

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 NNTP newsgroup(s).