From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/13797 Path: news.gmane.org!not-for-mail From: mb21 Newsgroups: gmane.text.pandoc Subject: Re: Release road map - 1.14 and beyond Date: Sun, 25 Oct 2015 12:12:01 -0700 (PDT) Message-ID: <32e7774a-9532-497b-baa5-4d8730ddfb7e@googlegroups.com> References: <20150403170528.GA171@MacBook-Pro.local> <7c361579-6858-4b3d-a24d-814ac2c9a7cc@googlegroups.com> <55B67911.3020007@gmail.com> <4663f0c6-7e25-41ac-bb1e-b174639ea010@googlegroups.com> <134301db-83b8-4a95-a550-8cf46eb10f0b@googlegroups.com> <55B6A91D.3010901@gmail.com> <408eafa7-541e-4fb4-ade8-93cc0597c095@googlegroups.com> <20150806195701.GE4492@protagoras.berkeley.edu> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_251_420909310.1445800322022" X-Trace: ger.gmane.org 1445800338 13694 80.91.229.3 (25 Oct 2015 19:12:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Oct 2015 19:12:18 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDCMBBVJ5EFBBA6TWSYQKGQEVG4ZABI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Oct 25 20:12:06 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-vk0-f57.google.com ([209.85.213.57]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZqQi4-0004bS-Rs for gtp-pandoc-discuss@m.gmane.org; Sun, 25 Oct 2015 20:12:05 +0100 Original-Received: by vkfw189 with SMTP id w189sf31770371vkf.1 for ; Sun, 25 Oct 2015 12:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe; bh=BDNORPWu8KidwR0EanJAG//9GFSS3Vk6hX/WVjCj2AA=; b=f7FX8LQXZ8fTjYa3VYUwfzAb3lERfdL4IgfSz74hnNOqLDPUNzLChzVCRi8OzlYBdq bjXLZNEq7XT01wgDkMCXkQyB43LQMaEwHZQI0f7W9ZupvbyDcBeGLHPktD3lrjNYIzSU I+09ZPU9PxW1Pzpc98vUTfhbIdBbHdH1CkaTGwFYx5pnJ6Rs09uCYrxyjevCGp07hOY8 t8LsJ/rLV6DfC4RDQ99Gr1RiKkJzQnketvybZS7mhJdanBvGONTKeBZBge4QBdtVn6So kt1oupIY6IaeV3PnS61cIHcxX7788gRXWhHLJJb28+uzNEIDFOf711toKEFMktvW9bte DIyA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe; bh=BDNORPWu8KidwR0EanJAG//9GFSS3Vk6hX/WVjCj2AA=; b=k7vS1cU+rOrrU4tZtWJ1S7PYjqxluQfUPZz0A5etME25xtncWmTaUZjEByM/IMAfjt G71s7WC0+aU5Wh6nV6qJR/KFMXFie/CkvZ7FhS6vCZokVRu+tXR9g5LBaRETVL8Jm4Jy GTpIpzgqen48wnT2Vt8hIspIthLTM6mn5KHdwv/uIQh+IgcqujlmCewWbxb5EX+/qJ+3 sJoYERx4LrvDonT+L3pyWt+c0y9KxQRHOMytRr5LrB+8227yEVgdEunrK3qltW7wmtA+ HubtNlla4cia3aSEJkb/WCosnBkziNsWeV6Owh8MQV9hnVwFDUvX9OeEvpLDHcnpJLcc Q57w== X-Received: by 10.50.92.41 with SMTP id cj9mr13803igb.1.1445800324089; Sun, 25 Oct 2015 12:12:04 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.50.110.4 with SMTP id hw4ls684402igb.28.gmail; Sun, 25 Oct 2015 12:12:03 -0700 (PDT) X-Received: by 10.50.129.10 with SMTP id ns10mr252842igb.0.1445800323589; Sun, 25 Oct 2015 12:12:03 -0700 (PDT) In-Reply-To: X-Original-Sender: mauro.bieg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:13797 Archived-At: ------=_Part_251_420909310.1445800322022 Content-Type: multipart/alternative; boundary="----=_Part_252_1774072624.1445800322023" ------=_Part_252_1774072624.1445800322023 Content-Type: text/plain; charset=UTF-8 Has anyone thought about this some more? @jgm mentioned recently somewhere that we should at least convert Attr from a type to a newtype. That means changing `(ident, cls, kvs)` to `Attr ident cls kvs` in lots and lots of places, or is there an unorthodox way around this? (Also, if I were to do this, I'd probably put it in a separate commit that's after the image/link attributes in the history if that's okay... in the same pull request though?) About going even further and defining Attr as a GADT (see my previous message below), it's probably a tradeoff away from the flexibility of the list of string tuples (which permits arbitrary key value pairs without breaking the API for anyone) towards using Haskell's type system even more and embedding the semantics of the attributes directly in the types. I'd certainly prefer GADTs from a theoretical point of view, but seeing how hard it is to change pandoc-types I'm not so sure anymore (though future changes to, say, the image attribute would only affect users that make use of the ImageAttr constructor, thus being much more limited in scope). Finally, if we were to stick with dumb key value pairs, should we at least make it a HashMap? Basically, the question still is: what would be the optimal approach of handling attributes? So we can get it as right as possible this time. On Friday, August 7, 2015 at 3:54:41 PM UTC+2, mb21 wrote: > > Great, yeah I would like to see the image attributes shipped with the next > major release. I made a pull request: > https://github.com/jgm/pandoc/pull/2351 > > However, I also see the argument of: if we're already making breaking > changes, we might do a bunch of them, so whatever we can agree on to do > now, we probably should. > > It feels wrong somehow to keep adding Attr to more and more elements. > > > I know what you mean, but maybe it's just because Attr is kind of a hacky > type in itself (a three-tuple and not even newtype). But is there a better > alternative to adding Attr to more things? i.e. what would be ideal? > > Maybe Attr should ultimately be a GADT with record syntax (GADTs are a > GHC-extension that effectively provide subtyping, see > https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/data-type-extensions.html#gadt). > Something like: > > data Attr where > GeneralAttr :: { uid :: String -- unique identifier > , cls :: [String] -- classes > , others :: [(String, String)] -- key-value pairs > for filters etc > } -> Attr > ImageAttr :: { uid :: String > , cls :: [String] > , width :: Dimension > , height :: Dimension > , figure :: Bool > , others :: [(String, String)] > } -> Attr > CodeAttr :: { uid :: String > , cls :: [String] > , lang :: String > , others :: [(String, String)] > } -> Attr > HeaderAttr :: { uid :: String > , cls :: [String] > , numbered :: Bool > , others :: [(String, String)] > } -> Attr > deriving (Show) > > > nullAttr :: Attr > nullAttr = GeneralAttr "" [] [] > > > -- sample functions > > > getUid :: Attr -> String > getUid attr = uid attr > > > getClass :: Attr -> [String] > getClass = cls > > > But even so, we would still have to add Attr to a few more elements > (mainly to get ids to reference and classes to customize/specialize > elements)... or is there a better way? > > -- 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/32e7774a-9532-497b-baa5-4d8730ddfb7e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_252_1774072624.1445800322023 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Has anyone thought about this some more?

@jgm mentioned recently somewhere that we should at least convert At= tr from a type to a newtype. That means changing `(ident, cls, kvs)` to `At= tr ident cls kvs` in lots and lots of places, or is there an unorthodox way= around this? (Also, if I were to do this, I'd probably put it in a sep= arate commit that's after the image/link attributes in the history if t= hat's okay... in the same pull request though?)

About going even further and defining Attr as a GADT (see my previous mes= sage below), it's probably a tradeoff away from the flexibility of the = list of string tuples (which permits arbitrary key value pairs without brea= king the API for anyone) towards using Haskell's type system even more = and embedding the semantics of the attributes directly in the types. I'= d certainly prefer GADTs from a theoretical point of view, but seeing how h= ard it is to change pandoc-types I'm not so sure anymore (though future= changes to, say, the image attribute would only affect users that make use= of the ImageAttr constructor, thus being much more limited in scope).=C2= =A0Finally, if we were to stick with dumb = key value pairs, should we at least make it a HashMap?
Basically, the question still is: what would be the optimal app= roach of handling attributes? So we can get it as right as possible this ti= me.


On Friday, August 7, 2015 at 3:54:41 PM UTC+2, mb21 wrote:
Great, yea= h I would like to see the image attributes shipped with the next major rele= ase. I made a pull request: https://github= .com/jgm/pandoc/pull/2351

However, I also= see the argument of: if we're already making breaking changes, we migh= t do a bunch of them, so whatever we can agree on to do now, we probably sh= ould.

It feels wrong somehow to keep a= dding Attr to more and more elements.

I kno= w what you mean, but maybe it's just because Attr is kind of a hacky ty= pe in itself (a three-tuple and not even newtype). But is there a better al= ternative to adding Attr to more things? i.e. what would be ideal?

Maybe Attr should ultimately be a GADT with record syntax = (GADTs are a GHC-extension that effectively provide subtyping, see https://downloads.hask= ell.org/~ghc/latest/docs/html/users_guide/data-type-extensions.html#gadt). Something like:

=C2=A0 =C2=A0 data Attr where
=C2=A0 = =C2=A0 =C2=A0
GeneralAttr :: { uid =C2=A0 =C2=A0:: String =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- unique= identifier
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0
, cls =C2=A0 =C2=A0:: [String] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- classes
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0, others
:: <= span style=3D"color:#660">[(String= , String)] =C2=A0-- key-value pairs for filters etc
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
} -> Attr
=C2=A0 =C2=A0 =C2=A0
ImageAttr =C2=A0 <= /span>:: { uid =C2=A0= =C2=A0:: String
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0
, cls =C2=A0 =C2=A0:: [String]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0
, width =C2=A0:: Dimension
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0, height :: Dimension=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
,
figure ::
Bool
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
, others :: [(= String,= String= )]
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} ->
Attr

=C2=A0 =C2= =A0 =C2=A0
CodeAttr =C2=A0 =C2=A0:: { uid =C2=A0 =C2=A0:: String
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
, cls =C2=A0 =C2=A0:: [String]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
= , lang =C2=A0 :: String
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
, others :: [(String, String)]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0
} ->= Attr=C2=A0 =C2=A0 =C2=A0 HeaderAttr<= span style=3D"color:#000"> =C2=A0
:: { uid =C2=A0 =C2=A0= :: Stri= ng
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
= , cls =C2=A0 =C2=A0:: [String]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
, numbered :: Bool
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
, others :: [(String, String)]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0
} -> Attr
=C2=A0 =C2=A0 =C2=A0 deriving
(Show)


=C2=A0 =C2=A0 nullAttr
::
Attr
=C2=A0 =C2=A0= nullAttr
=3D GeneralAttr "" [] []


=C2=A0 =C2=A0
-- sample functions


=C2=A0 =C2=A0 ge= tUid
::= Attr <= /span>-> String=C2=A0 =C2=A0 getUid attr =3D uid attr


=C2=A0 =C2=A0 getClass
<= span style=3D"color:#660">::
Attr
-> [String]
=C2=A0 =C2=A0 get= Class
=3D cls


But even= so, we would still have to add Attr to a few more elements (mainly to get = ids to reference and classes to customize/specialize elements)... or is the= re a better way?

--
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/32e7774a-9532-497b-baa5-4d8730ddfb7e%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_252_1774072624.1445800322023-- ------=_Part_251_420909310.1445800322022--