[Haskell-cafe] Anyone up for Google SoC 2010?

Johan Tibell johan.tibell at gmail.com
Fri Mar 5 02:07:47 EST 2010


On Fri, Mar 5, 2010 at 4:48 AM, iquiw <iku.iwasa at gmail.com> wrote:

> Hi Johan,
>
> On Fri, Mar 5, 2010 at 6:18 AM, Johan Tibell <johan.tibell at gmail.com>
> wrote:
> > Here's a proposal for a project I'd be willing to mentor:
> > = A high-performance HTML combinator library using Data.Text =
>
> Nice project! I would like to see the project will be accepted.
>
> Perhaps it's not scope of the project, but if compatibility doesn't
> matter, I want new HTML library have uniform naming convention
> for functions that based on element or attribute.
>
> For example, function name should be;
>  - "e_" + element name ("html", "head", "body" => "e_html", "e_head",
> "e_body")
>   "a_" + attribute name ("href", "id", "class" => "a_href", "a_id",
> "a_class")
> or
>  - "e" + capitalized element name ("html", "head", "body" => "eHtml",
> "eHead", "eBody")
>   "a" + capitalized attribute name ("href", "id", "class" => "aHref",
> "aId", "aClass")
>
> or some other convention.
>

I think I would use the module system for namespacing rather than using
function prefixes. Like so:

import Text.Html as E
import qualified Text.Html.Attribute as A

E.html ! [A.class_ "my-class"] (... more combinators ...)

(Assuming that "!" is used to introduce attributes.)

This allows you to use the element names and/or the attribute names
unclassified if you so desire.

html ! [class_ "my-class"] (... more combinators ...)

Function names in the 'html' library are unpredictable from
> corresponding element/attribute names...
>  ("head", "base", "a" => "header", "thebase", "anchor")
>

I'm of the same opinion. The combinators should match the element/attribute
names as far as possible. The rule that I had in mind was that the
combinators should have exactly the same name as the corresponding
element/tag except when the name collides with a keyword (e.g. "class"). If
the name collides with a keyword we could e.g. always append a "_".

Cheers,
Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100305/71fd4cea/attachment.html


More information about the Haskell-Cafe mailing list