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 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@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'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-/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-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-/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_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-/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_oPFaDY0FEnLSSOVno2Ut6oq0VAK1q5gYKYZwfQmimg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.