From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/12153 Path: news.gmane.org!not-for-mail From: Shahbaz Youssefi Newsgroups: gmane.text.pandoc Subject: Re: C bindings Date: Thu, 26 Feb 2015 19:56:13 +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=001a11c3d8ca5947730510024ef0 X-Trace: ger.gmane.org 1424976976 7428 80.91.229.3 (26 Feb 2015 18:56:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Feb 2015 18:56:16 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCROTOMZXUKRBTWYXWTQKGQE52LQ7NI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Feb 26 19:56:15 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-la0-f60.google.com ([209.85.215.60]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YR3bb-0003yz-Cx for gtp-pandoc-discuss@m.gmane.org; Thu, 26 Feb 2015 19:56:15 +0100 Original-Received: by labgd6 with SMTP id gd6sf3732427lab.3 for ; Thu, 26 Feb 2015 10:56:15 -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=Qqcv/ZR9hdhgGCF+ahl4YLChzfJmRf17upT6GBzZyqg=; b=B56x2o3WVzH4erH4hWT/vLli3BHS5TFOL+5jjU3L+z1ijtB23RmjqclSyvPTS1we87 fImlLcMTAXAdXFYh5A9TRNJB38Y6mUOuUvLp+q+vYLPJG8+bRL4iaJ3UPabK9XAFCgFk ldGSr5FcpIsqSGL2Dg028SKmA70tITI9NZJhwjtofWDUrEKZiHYyMXb+pf9/UEEugZFS kxWbKR6fmxr2WDwmoPzByiiFEYbjZ2JndmKJnKD9xBNKI9hgoQIJtZsNpLBXeX5CsFoy S6KfiAIL8cUuyZxMKZsrbna9DRLNqMBl7SwmmRxKg9f9RqGddj9Q4R//1gUfH1tpcgsS cuwg== X-Received: by 10.180.14.68 with SMTP id n4mr114708wic.20.1424976975066; Thu, 26 Feb 2015 10:56:15 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.180.90.43 with SMTP id bt11ls1238142wib.37.canary; Thu, 26 Feb 2015 10:56:14 -0800 (PST) X-Received: by 10.180.13.98 with SMTP id g2mr3930600wic.3.1424976974155; Thu, 26 Feb 2015 10:56:14 -0800 (PST) Original-Received: from mail-lb0-x22d.google.com (mail-lb0-x22d.google.com. [2a00:1450:4010:c04::22d]) by gmr-mx.google.com with ESMTPS id mv2si193812lbc.0.2015.02.26.10.56.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Feb 2015 10:56:14 -0800 (PST) Received-SPF: pass (google.com: domain of shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c04::22d as permitted sender) client-ip=2a00:1450:4010:c04::22d; Original-Received: by lbvp9 with SMTP id p9so12820864lbv.0 for ; Thu, 26 Feb 2015 10:56:14 -0800 (PST) X-Received: by 10.112.235.10 with SMTP id ui10mr9257822lbc.77.1424976974004; Thu, 26 Feb 2015 10:56:14 -0800 (PST) Original-Received: by 10.112.73.4 with HTTP; Thu, 26 Feb 2015 10:56:13 -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::22d 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:12153 Archived-At: --001a11c3d8ca5947730510024ef0 Content-Type: text/plain; charset=UTF-8 @Matthew, so is that what's going to happen? Should I just wait for the next release of pandoc and those types would be derived? On Tue, Feb 24, 2015 at 4:00 PM, Shahbaz Youssefi wrote: > P.S. libpandoc derives LibPandocSettings from those types because it uses > a Data.Generics.Rep.toRep function on it. > > On Tue, Feb 24, 2015 at 3:51 PM, Shahbaz Youssefi > wrote: > >> 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/CALeOzZ8xyQC6w3xadF4q7szJW7XhXwGytHuvS1oX8S_b2AzKHA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. --001a11c3d8ca5947730510024ef0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
@Matthew, so is that what's going to happen? Should I = just wait for the next release of pandoc and those types would be derived?<= br>

On Tue, = Feb 24, 2015 at 4:00 PM, Shahbaz Youssefi <shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
P.S. libpandoc = derives LibPandocSettings from those types because it uses a Data.Generics.= Rep.toRep function on it.
=

On Tue, Feb 24, 2= 015 at 3:51 PM, Shahbaz Youssefi <shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:<= br>
I would imagine it = would. I can't say I really understand what they are, but bottom line i= s that [`LibPandocSettings` in the libpandoc implementation](https://github.com/ShabbyX/libpandoc/blob/master/src/Li= bPandoc/Settings.hs#L10) contains `ReaderOptions` and `WriterOptions` a= nd 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 meantim= e, see if I can just remove this requirement.

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

On Tue, Feb 2= 4, 2015 at 2:39 PM, Shahbaz Youssefi <shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wro= te:
Hi,

I'm u= pdating libpandoc to align with pandoc 1.13, but I'm currently having a= compilation issue that is beyond my understanding.

In [LibPandoc/In= stances.hs](https://github.com/ShabbyX/libpa= ndoc/blob/master/src/LibPandoc/Instances.hs), there is the following co= de, that had been working with pandoc 1.11:

=C2=A0=C2=A0=C2=A0 {-# L= ANGUAGE TemplateHaskell #-}

=C2=A0=C2=A0=C2=A0 module LibPandoc.Inst= ances 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 import Text.Pandoc.Shared
=C2=A0=C2=A0=C2=A0 import Text.Hi= ghlighting.Kate.Types

=C2=A0=C2=A0=C2=A0 $( derive makeTypeable '= ;'ReaderOptions )
=C2=A0=C2=A0=C2=A0 $( derive makeData ''Re= aderOptions )
=C2=A0=C2=A0=C2=A0 $( derive makeTypeable ''Writer= Options )
=C2=A0=C2=A0=C2=A0 $( derive makeData ''WriterOptions = )
=C2=A0=C2=A0=C2=A0 ...

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`.=C2=A0 With newer pandoc= , it seems that some types were added.=C2=A0 With `TrackChanges` used in `R= eaderOptions`, I can add similar `derive makeTypeable/makeData` lines and e= verything is ok.=C2=A0 With `MediaBag` used in `WriterOptions` however, I c= an't do this.

Without `derive makeData` for `MediaBag`, I get th= e following error for `$( derive makeData WriterOptions )`:

=C2=A0= =C2=A0=C2=A0 No instance for (Data MediaBag) arising from a use of `k'<= br>=C2=A0=C2=A0=C2=A0 Possible fix: add an instance declaration for (Data M= ediaBag)
=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 CA= LLS ...

If I add `$( derive makeData MediaBag)` before, I get this e= rror on it:

=C2=A0=C2=A0=C2=A0 Not in scope: data constructor `Media= Bag'

I have `import Text.Pandoc.MediaBag`.

From what I co= uld make out, the reason is probably that others, such as `TrackChanges` ar= e defined with the `data` keyword, but `MediaBag` is defined with the `newt= ype` keyword.=C2=A0 Is that so? How then, can I make `$( derive makeData &#= 39;'MediaBag)` work? If not possible, how can I make `$( derive makeDat= a ''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.=C2=A0 I've u= pdated 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://groups.= google.com/d/msgid/pandoc-discuss/CALeOzZ8xyQC6w3xadF4q7szJW7XhXwGytHuvS1oX= 8S_b2AzKHA%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a11c3d8ca5947730510024ef0--