From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/12118 Path: news.gmane.org!not-for-mail From: Matthew Pickering Newsgroups: gmane.text.pandoc Subject: Re: C bindings Date: Tue, 24 Feb 2015 14:44:27 +0000 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=047d7bf0d1523d8711050fd68ed4 X-Trace: ger.gmane.org 1424789078 12947 80.91.229.3 (24 Feb 2015 14:44:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2015 14:44:38 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCO2LGEC4AIBBS44WKTQKGQEP7SED3A-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 24 15:44:38 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-wi0-f189.google.com ([209.85.212.189]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YQGiq-0006By-RZ for gtp-pandoc-discuss@m.gmane.org; Tue, 24 Feb 2015 15:44:28 +0100 Original-Received: by mail-wi0-f189.google.com with SMTP id fb4sf4456577wid.6 for ; Tue, 24 Feb 2015 06:44:28 -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=qyn2FTsVzzt1yW9ZSPzyMHui4nW2K+bMCFauxUq22oA=; b=DbLPjNfwCodZKhkpgoidmzmFiXqwjvTHLogvrnwbV7m4BmI4P9y9ZK3SUsAL2SnNa1 IraCl5mN20weBQ6CP5WwasrFg9jhFcXYUvtse7nw5UUNRYhys5dKJTdxOVTKiPku3MXF fNGzLrOIduzfgDr6MZebK7Y2D2DzV3RQYN7yvTXjSrkAFN6QjY4LpZ/UfybVh+8grbqi c8GMTQPx9Ofim0wQdJDRaHu7HbRJAlQBXWUEfGCYaBfwgAHQlRrFFaP0tlwRVPJD/MRV zIK4eGY3T3Bx+M9CM5dp4FY/U97CepWOLwcXC8lQbAtDebtUv5IqPt+QXgVWYyiFRr60 nOtA== X-Received: by 10.152.21.6 with SMTP id r6mr132613lae.41.1424789068537; Tue, 24 Feb 2015 06:44:28 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.152.43.48 with SMTP id t16ls618738lal.55.gmail; Tue, 24 Feb 2015 06:44:27 -0800 (PST) X-Received: by 10.112.219.102 with SMTP id pn6mr1554351lbc.12.1424789067617; Tue, 24 Feb 2015 06:44:27 -0800 (PST) Original-Received: from mail-we0-x231.google.com (mail-we0-x231.google.com. [2a00:1450:400c:c03::231]) by gmr-mx.google.com with ESMTPS id r6si930795wix.0.2015.02.24.06.44.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 06:44:27 -0800 (PST) Received-SPF: pass (google.com: domain of matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:400c:c03::231 as permitted sender) client-ip=2a00:1450:400c:c03::231; Original-Received: by wesw62 with SMTP id w62so25558182wes.9 for ; Tue, 24 Feb 2015 06:44:27 -0800 (PST) X-Received: by 10.194.71.98 with SMTP id t2mr9318243wju.72.1424789067366; Tue, 24 Feb 2015 06:44:27 -0800 (PST) Original-Received: by 10.194.2.174 with HTTP; Tue, 24 Feb 2015 06:44:27 -0800 (PST) In-Reply-To: <01aacd0c-291e-455d-9fc0-0673a904671c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:400c:c03::231 as permitted sender) smtp.mail=matthewtpickering-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:12118 Archived-At: --047d7bf0d1523d8711050fd68ed4 Content-Type: text/plain; charset=UTF-8 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. --047d7bf0d1523d8711050fd68ed4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Would it just be easier if we derived Data and Typeable in= stances in pandoc?

On Tue, Feb 24, 2015 at 2:39 PM, Shahbaz Youssefi = <shabbyx-Re5JQEeQqe8@public.gmane.org= m> 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://gith= ub.com/ShabbyX/libpandoc/blob/master/src/LibPandoc/Instances.hs), there= is the following code, that had been working with pandoc 1.11:

=C2= =A0=C2=A0=C2=A0 {-# LANGUAGE TemplateHaskell #-}

=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 Te= xt.Pandoc
=C2=A0=C2=A0=C2=A0 import Text.Pandoc.Shared
=C2=A0=C2=A0= =C2=A0 import Text.Highlighting.Kate.Types

=C2=A0=C2=A0=C2=A0 $( der= ive makeTypeable ''ReaderOptions )
=C2=A0=C2=A0=C2=A0 $( derive = makeData ''ReaderOptions )
=C2=A0=C2=A0=C2=A0 $( derive makeType= able ''WriterOptions )
=C2=A0=C2=A0=C2=A0 $( derive makeData = 9;'WriterOptions )
=C2=A0=C2=A0=C2=A0 ...

From what I underst= and, `derive makeData` does some magic, so that later one could say `derivi= ng (Data)` for a type that contains `ReaderOptions` and `WriterOptions`.=C2= =A0 With newer pandoc, it seems that some types were added.=C2=A0 With `Tra= ckChanges` used in `ReaderOptions`, I can add similar `derive makeTypeable/= makeData` lines and everything is ok.=C2=A0 With `MediaBag` used in `Writer= Options` however, I can't do this.

Without `derive makeData` for= `MediaBag`, I get the following error for `$( derive makeData WriterOption= s )`:

=C2=A0=C2=A0=C2=A0 No instance for (Data MediaBag) arising fro= m a use of `k'
=C2=A0=C2=A0=C2=A0 Possible fix: add an instance decl= aration 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 L= OT OF `k` INFIX CALLS ...

If I add `$( derive makeData MediaBag)` be= fore, 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, the reason is probably that others, such as= `TrackChanges` are defined with the `data` keyword, but `MediaBag` is defi= ned with the `newtype` keyword.=C2=A0 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, fiddl= osopher 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 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://g= roups.google.com/d/msgid/pandoc-discuss/CALuQ0m_3c63CN4VLEqMM953bxi%3Dmou4M= 7%2Brukbdo9H1%3D7em7sQ%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--047d7bf0d1523d8711050fd68ed4--