From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/12120 Path: news.gmane.org!not-for-mail From: Shahbaz Youssefi Newsgroups: gmane.text.pandoc Subject: Re: C bindings Date: Tue, 24 Feb 2015 16:00:53 +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=089e01493c2204efbb050fd6c923 X-Trace: ger.gmane.org 1424790059 30473 80.91.229.3 (24 Feb 2015 15:00:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2015 15:00:59 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCROTOMZXUKRBJVEWKTQKGQEJO6YVRI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 24 16:00:55 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-la0-f62.google.com ([209.85.215.62]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YQGyk-0006ry-L3 for gtp-pandoc-discuss@m.gmane.org; Tue, 24 Feb 2015 16:00:54 +0100 Original-Received: by lams18 with SMTP id s18sf5646984lam.7 for ; Tue, 24 Feb 2015 07:00:54 -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=yaRA0V5rKlVDVuGhNMl8mYPxnz8rmhwjpN0Zoc8Y6uY=; b=l+PmOEt/bFazcZnyUt2aQLlsuj7BZLXj9bkea9ku+M9QaaxPquBIqyrWsrAwIozFTF IUr8iZ9zGe2OGWwp++c2xTqTA9YSd9Uxt7imOAJXN8b7LsTW1rz10J4o37o8IU8D6Dpo Opd1qpdNUnkQMBGs+z7jUXwSaS8qLpZ33IsVV4TEYB4jXLqKy/78JEqUaPfC1FngnZNP 7LWh2E2A2LD+WAxMxHngHfmWkP+vF6OhFq0jpmyjq2EQRuks11DbONPO1HobmA+ulQgT /YgSoJd+5aL9dYuEkTb+Ti+mTZn+5jsubK+0DK9YPi9F1fzFMprx5YesfA/C7ikDkLDR 4JEw== X-Received: by 10.180.102.225 with SMTP id fr1mr101827wib.18.1424790054362; Tue, 24 Feb 2015 07:00:54 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.181.29.164 with SMTP id jx4ls792995wid.5.canary; Tue, 24 Feb 2015 07:00:53 -0800 (PST) X-Received: by 10.194.11.70 with SMTP id o6mr2197263wjb.6.1424790053662; Tue, 24 Feb 2015 07:00:53 -0800 (PST) Original-Received: from mail-la0-x22e.google.com (mail-la0-x22e.google.com. [2a00:1450:4010:c03::22e]) by gmr-mx.google.com with ESMTPS id mv2si4026584lbc.0.2015.02.24.07.00.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 07:00:53 -0800 (PST) Received-SPF: pass (google.com: domain of shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4010:c03::22e as permitted sender) client-ip=2a00:1450:4010:c03::22e; Original-Received: by mail-la0-x22e.google.com with SMTP id gf13so26150136lab.9 for ; Tue, 24 Feb 2015 07:00:53 -0800 (PST) X-Received: by 10.152.19.228 with SMTP id i4mr15018520lae.77.1424790053513; Tue, 24 Feb 2015 07:00:53 -0800 (PST) Original-Received: by 10.112.73.4 with HTTP; Tue, 24 Feb 2015 07:00:53 -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:c03::22e 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:12120 Archived-At: --089e01493c2204efbb050fd6c923 Content-Type: text/plain; charset=UTF-8 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/CALeOzZ9_oPFaDY0FEnLSSOVno2Ut6oq0VAK1q5gYKYZwfQmimg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. --089e01493c2204efbb050fd6c923 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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 <shabbyx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 deriv= ed from those two types. I'll try to play around in the meantime, see i= f I can just remove this requirement.

On Tu= e, Feb 24, 2015 at 3:44 PM, Matthew Pickering <matthewtpickering= @gmail.com> 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 <shabbyx@gmail.= com> wrote:
Hi,

I'm updating libpandoc to align with pandoc 1.13, but I= 9;m currently having a compilation issue that is beyond my understanding.
In [LibPandoc/Instances.hs](https://gi= thub.com/ShabbyX/libpandoc/blob/master/src/LibPandoc/Instances.hs), the= re 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 impor= t Text.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 $( = derive makeTypeable ''ReaderOptions )
=C2=A0=C2=A0=C2=A0 $( deri= ve makeData ''ReaderOptions )
=C2=A0=C2=A0=C2=A0 $( derive makeT= ypeable ''WriterOptions )
=C2=A0=C2=A0=C2=A0 $( derive makeData = ''WriterOptions )
=C2=A0=C2=A0=C2=A0 ...

From what I unde= rstand, `derive makeData` does some magic, so that later one could say `der= iving (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 `ReaderOptions`, I can add similar `derive makeTypeab= le/makeData` lines and everything is ok.=C2=A0 With `MediaBag` used in `Wri= terOptions` however, I can't do this.

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

=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 d= eclaration 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: da= ta constructor `MediaBag'

I have `import Text.Pandoc.MediaBag`.<= br>
From what I could make out, the reason is probably that others, such= as `TrackChanges` are defined with the `data` keyword, but `MediaBag` is d= efined with the `newtype` keyword.=C2=A0 Is that so? How then, can I make `= $( derive makeData ''MediaBag)` work? If not possible, how can I ma= ke `$( derive makeData ''WriterOptions )` work?

Thanks for t= he help,
Shahbaz

On Sunday, June 30, 2013 at 8:30:37 PM UTC+2, fi= ddlosopher wrote:
Thanks for doing t= his.=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://groups.= google.com/d/msgid/pandoc-discuss/CALeOzZ9_oPFaDY0FEnLSSOVno2Ut6oq0VAK1q5gY= KYZwfQmimg%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--089e01493c2204efbb050fd6c923--