From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/12119 Path: news.gmane.org!not-for-mail From: Shahbaz Youssefi Newsgroups: gmane.text.pandoc Subject: Re: C bindings Date: Tue, 24 Feb 2015 15:51:05 +0100 Message-ID: References: <20130626171432.GA1663@protagoras.phil.berkeley.edu> <20130630183036.GA17415@Johns-MacBook-Pro.local> <01aacd0c-291e-455d-9fc0-0673a904671c@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0158ab72f35aa3050fd6a54d X-Trace: ger.gmane.org 1424789481 20094 80.91.229.3 (24 Feb 2015 14:51:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2015 14:51:21 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCROTOMZXUKRBW47WKTQKGQEIV4F7GI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 24 15:51:12 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-wi0-f185.google.com ([209.85.212.185]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YQGpI-0001WD-6L for gtp-pandoc-discuss@m.gmane.org; Tue, 24 Feb 2015 15:51:08 +0100 Original-Received: by mail-wi0-f185.google.com with SMTP id em10sf4574030wid.2 for ; Tue, 24 Feb 2015 06:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe; bh=evuR0IChnLICKCFOXvKtjlC/4Ek2R+HZTFjqJwlKnmU=; b=Dezv/ghB+gAVdXz9P6YTj0wE62Mb+VGpxmgabriAW23cS1fvydumC6RMw1BiDYbF73 TJKQcpWGXp6921jtyQ5JqliBT1zSvoUtr5EHhF6IcpUtlzCuV2ow9+F04TONRcb4Q7be db4kqDieQNVrVIBhVBJQmqrnZTzCFnRxO9uNLrblZytSxTshk9zYkbMRKr23fQwNTHkd 6qdRNEbpKXW8usp57vyFfoYlHZcejSi8+9sD1nlLXrOfvj4tF9rdmIveWxTp5H+CDS/0 4JDeXqbkIMTrNxVLR4A1ut/q80eDVaRfjN3qlalL+df75VELmYYUVq98g24JvnJyPfsH mQug== X-Received: by 10.152.6.1 with SMTP id w1mr139908law.25.1424789467867; Tue, 24 Feb 2015 06:51:07 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.152.207.101 with SMTP id lv5ls691319lac.22.gmail; Tue, 24 Feb 2015 06:51:06 -0800 (PST) X-Received: by 10.112.126.194 with SMTP id na2mr1920160lbb.18.1424789466771; Tue, 24 Feb 2015 06:51:06 -0800 (PST) Original-Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com. [2a00:1450:4010:c04::22a]) by gmr-mx.google.com with ESMTPS id mv2si4023755lbc.0.2015.02.24.06.51.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 06:51:06 -0800 (PST) Received-SPF: pass (google.com: domain of shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c04::22a as permitted sender) client-ip=2a00:1450:4010:c04::22a; Original-Received: by mail-lb0-x22a.google.com with SMTP id z11so25400300lbi.5 for ; Tue, 24 Feb 2015 06:51:06 -0800 (PST) X-Received: by 10.152.23.195 with SMTP id o3mr14188292laf.11.1424789465158; Tue, 24 Feb 2015 06:51:05 -0800 (PST) Original-Received: by 10.112.73.4 with HTTP; Tue, 24 Feb 2015 06:51:05 -0800 (PST) In-Reply-To: X-Original-Sender: shabbyX-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c04::22a as permitted sender) smtp.mail=shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dkim=pass header.i=@gmail.com; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:12119 Archived-At: --089e0158ab72f35aa3050fd6a54d Content-Type: text/plain; charset=UTF-8 I would imagine it would. I can't say I really understand what they are, but bottom line is that [`LibPandocSettings` in the libpandoc implementation]( https://github.com/ShabbyX/libpandoc/blob/master/src/LibPandoc/Settings.hs#L10) contains `ReaderOptions` and `WriterOptions` and wants `deriving (Data, Typeable)`. Again, I wouldn't know why `LibPandocSettings` wants to be derived from those two types. I'll try to play around in the meantime, see if I can just remove this requirement. On Tue, Feb 24, 2015 at 3:44 PM, Matthew Pickering < matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Would it just be easier if we derived Data and Typeable instances in > pandoc? > > On Tue, Feb 24, 2015 at 2:39 PM, Shahbaz Youssefi > wrote: > >> Hi, >> >> I'm updating libpandoc to align with pandoc 1.13, but I'm currently >> having a compilation issue that is beyond my understanding. >> >> In [LibPandoc/Instances.hs]( >> https://github.com/ShabbyX/libpandoc/blob/master/src/LibPandoc/Instances.hs), >> there is the following code, that had been working with pandoc 1.11: >> >> {-# LANGUAGE TemplateHaskell #-} >> >> module LibPandoc.Instances where >> >> import Data.Data >> import Data.DeriveTH >> import Text.Pandoc >> import Text.Pandoc.Shared >> import Text.Highlighting.Kate.Types >> >> $( derive makeTypeable ''ReaderOptions ) >> $( derive makeData ''ReaderOptions ) >> $( derive makeTypeable ''WriterOptions ) >> $( derive makeData ''WriterOptions ) >> ... >> >> From what I understand, `derive makeData` does some magic, so that later >> one could say `deriving (Data)` for a type that contains `ReaderOptions` >> and `WriterOptions`. With newer pandoc, it seems that some types were >> added. With `TrackChanges` used in `ReaderOptions`, I can add similar >> `derive makeTypeable/makeData` lines and everything is ok. With `MediaBag` >> used in `WriterOptions` however, I can't do this. >> >> Without `derive makeData` for `MediaBag`, I get the following error for >> `$( derive makeData WriterOptions )`: >> >> No instance for (Data MediaBag) arising from a use of `k' >> Possible fix: add an instance declaration for (Data MediaBag) >> In the expression: >> ... A VERY LONG EXPRESSION WITH A LOT OF `k` INFIX CALLS ... >> >> If I add `$( derive makeData MediaBag)` before, I get this error on it: >> >> Not in scope: data constructor `MediaBag' >> >> I have `import Text.Pandoc.MediaBag`. >> >> From what I could make out, the reason is probably that others, such as >> `TrackChanges` are defined with the `data` keyword, but `MediaBag` is >> defined with the `newtype` keyword. Is that so? How then, can I make `$( >> derive makeData ''MediaBag)` work? If not possible, how can I make `$( >> derive makeData ''WriterOptions )` work? >> >> Thanks for the help, >> Shahbaz >> >> On Sunday, June 30, 2013 at 8:30:37 PM UTC+2, fiddlosopher wrote: >>> >>> Thanks for doing this. I've updated pandoc-extras. >>> >>> +++ Shahbaz Youssefi [Jun 30 13 13:04 ]: >>> > Hi again, >>> > I updated libpandoc (for C bindings) to the current version of >>> pandoc >>> > and made some improvements. I sent a pull request to toyvo, but it >>> has >>> > been left unanswered (he's probably not so active on github). In >>> the >>> > meantime, you could >>> > [refer]([1]https://github.com/jgm/pandoc/wiki/Pandoc-Extras) to my >>> fork >>> > at: >>> > [2]https://github.com/ShabbyX/libpandoc >>> > Have a nice day, >>> > Shahbaz >>> > >>> >> -- >> 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/01aacd0c-291e-455d-9fc0-0673a904671c%40googlegroups.com >> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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/CALuQ0m_3c63CN4VLEqMM953bxi%3Dmou4M7%2Brukbdo9H1%3D7em7sQ%40mail.gmail.com > > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CALeOzZ9Ru015fD-%3DdjS34LYOryiaCXs6NnmbBP%3D51L-9ZxexTg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. --089e0158ab72f35aa3050fd6a54d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I would imagine it would. I can't say I really un= derstand what they are, but bottom line is that [`LibPandocSettings` in the= libpandoc implementation](https://github.com/ShabbyX/libpa= ndoc/blob/master/src/LibPandoc/Settings.hs#L10) contains `ReaderOptions= ` and `WriterOptions` and wants `deriving (Data, Typeable)`.

Agai= n, I wouldn't know why `LibPandocSettings` wants to be derived from tho= se two types. I'll try to play around in the meantime, see if I can jus= t remove this requirement.

On Tue, Feb 24, 2015 at 3:44 PM, Matthew Pickering <matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Would it just be easier if we derived Data= and Typeable instances in pandoc?

On Tue, Feb 24, 2015 at 2:3= 9 PM, Shahbaz Youssefi <shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi,

I'm updating libpan= doc to align with pandoc 1.13, but I'm currently having a compilation i= ssue that is beyond my understanding.

In [LibPandoc/Instances.hs](https://github.com/ShabbyX/libpandoc/blob/mast= er/src/LibPandoc/Instances.hs), there is the following code, that had b= een working with pandoc 1.11:

=C2=A0=C2=A0=C2=A0 {-# LANGUAGE Templa= teHaskell #-}

=C2=A0=C2=A0=C2=A0 module LibPandoc.Instances where
=C2=A0=C2=A0=C2=A0 import Data.Data
=C2=A0=C2=A0=C2=A0 import Data.= DeriveTH
=C2=A0=C2=A0=C2=A0 import Text.Pandoc
=C2=A0=C2=A0=C2=A0 imp= ort Text.Pandoc.Shared
=C2=A0=C2=A0=C2=A0 import Text.Highlighting.Kate.= Types

=C2=A0=C2=A0=C2=A0 $( derive makeTypeable ''ReaderOpti= ons )
=C2=A0=C2=A0=C2=A0 $( derive makeData ''ReaderOptions )=C2=A0=C2=A0=C2=A0 $( derive makeTypeable ''WriterOptions )
=C2= =A0=C2=A0=C2=A0 $( derive makeData ''WriterOptions )
=C2=A0=C2= =A0=C2=A0 ...

From what I understand, `derive makeData` does some ma= gic, so that later one could say `deriving (Data)` for a type that contains= `ReaderOptions` and `WriterOptions`.=C2=A0 With newer pandoc, it seems tha= t some types were added.=C2=A0 With `TrackChanges` used in `ReaderOptions`,= I can add similar `derive makeTypeable/makeData` lines and everything is o= k.=C2=A0 With `MediaBag` used in `WriterOptions` however, I can't do th= is.

Without `derive makeData` for `MediaBag`, I get the following er= ror for `$( derive makeData WriterOptions )`:

=C2=A0=C2=A0=C2=A0 No = instance for (Data MediaBag) arising from a use of `k'
=C2=A0=C2=A0= =C2=A0 Possible fix: add an instance declaration for (Data MediaBag)
=C2= =A0=C2=A0=C2=A0 In the expression:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 ... A VERY LONG EXPRESSION WITH A LOT OF `k` INFIX CALLS ...

= If I add `$( derive makeData MediaBag)` before, I get this error on it:
=
=C2=A0=C2=A0=C2=A0 Not in scope: data constructor `MediaBag'
I have `import Text.Pandoc.MediaBag`.

From what I could make out, t= he reason is probably that others, such as `TrackChanges` are defined with = the `data` keyword, but `MediaBag` is defined with the `newtype` keyword.= =C2=A0 Is that so? How then, can I make `$( derive makeData ''Media= Bag)` work? If not possible, how can I make `$( derive makeData ''W= riterOptions )` work?

Thanks for the help,
Shahbaz

On Sund= ay, June 30, 2013 at 8:30:37 PM UTC+2, fiddlosopher wrote:
Thanks for doing this.=C2=A0 I've updated pandoc= -extras.

+++ Shahbaz Youssefi [Jun 30 13 13:04 ]:
> =C2=A0 =C2=A0Hi again,
> =C2=A0 =C2=A0I updated libpandoc (for C bindings) to the current v= ersion of pandoc
> =C2=A0 =C2=A0and made some improvements. I sent a pull request to = toyvo, but it has
> =C2=A0 =C2=A0been left unanswered (he's probably not so active= on github). In the
> =C2=A0 =C2=A0meantime, you could
> =C2=A0 =C2=A0[refer]([1]https://github.com/jgm/pandoc/wiki/Pandoc-Extras) to my fork
> =C2=A0 =C2=A0at:
> =C2=A0 =C2=A0[2]https://github.com/ShabbyX/libpand= oc
> =C2=A0 =C2=A0Have a nice day,
> =C2=A0 =C2=A0Shahbaz
>=20

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https:= //groups.google.com/d/msgid/pandoc-discuss/01aacd0c-291e-455d-9fc0-0673a904= 671c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m_3c63C= N4VLEqMM953bxi%3Dmou4M7%2Brukbdo9H1%3D7em7sQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://gro= ups.google.com/d/msgid/pandoc-discuss/CALeOzZ9Ru015fD-%3DdjS34LYOryiaCXs6Nn= mbBP%3D51L-9ZxexTg%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--089e0158ab72f35aa3050fd6a54d--