some Haskell code

Hi,

since I started committing my work in a darcs2 repository, and since I
always appreciate feedback, even in such an early stage of
development, I decided to make the repository public here:
http://code.haskell.org/citeproc-hs/

It requires darcs2 (from http://darcs.net) and a GHC toolchain (from
http://haskell.org/ghc/). No external libraries are needed so far -
except for mtl, which usually comes with ghc.

You can grab the code with:
darcs get http://code.haskell.org/citeproc-hs/

Without having to compile everything, you can just cd citeproc-hs and
run the test suite with:

runhaskell -i=src/ test/test.hs

In test.hs you can see the internal representation of a style and a
reference.

This should be the output of running the above command without
changing anything in test.hs:

"Person {namePrefix = “”, givenName = “Andrea”, initials = “”,
articular = “”, familyName = “Rossato”, nameSuffix = “”}"
Diritto e architettura nello spazio digitale, Bologna, Date {year =
2006, month = 1, day = 0, other = “”} testoMacro Titolo: Diritto e
architettura nello spazio digitale testoMacro3 ciao ciao

As you can see this is just a start: only a small subset of the
language is supported: conditionals, macros and the text element. The
very very beginning. Still promising in my opinion.

Any feedback appreciated.

Andrea

This should be the output of running the above command without
changing anything in test.hs:

"Person {namePrefix = “”, givenName = “Andrea”, initials = “”,
articular = “”, familyName = “Rossato”, nameSuffix = “”}"
Diritto e architettura nello spazio digitale, Bologna, Date {year =
2006, month = 1, day = 0, other = “”} testoMacro Titolo: Diritto e
architettura nello spazio digitale testoMacro3 ciao ciao

Yup, that’s what I see.

For those curious and on a Mac, you can install darcs via macports:
“sudo port install darcs”.

Sometimes hugs doesn’t want to compile. but I had no problems recently.

As you can see this is just a start: only a small subset of the
language is supported: conditionals, macros and the text element. The
very very beginning. Still promising in my opinion.

Yes; I’ll be really psyched if I can use pandoc with csl!

Any feedback appreciated.

ATM, I just have one comment:

b. non-person agents (e.g. organizations)

Oops, it seems I misread your code. I guess this …

data Name = Entity String
> Person

… means that a name data type can either be a string, or a hash (for
a Person)?

Bruce

Yes. The type Name can be constructed with the type constructor Person
(which takes 6 strings) or the type constructor Entity, which takes a
single string. This means I can render them in two
distinct ways, but in a single function.

In test.hs, rossato2006.author and rossato2006.publisher have the same
type.

Andrea

Yes; I’ll be really psyched if I can use pandoc with csl!

I hope you’ll be able to try it soon!

How, BTW, are you planning to deal with data input? Some kind of
driver system would be nice.

CSL files will be parsed by citeproc-hs, obviously. The same for
bibliographic references: MODS will supported, and hopefully the
bibliontology too. I might write the bindings for bibutils, maybe:
Haskell has a very simple foreign function interface.

Basically a plug-in like system like the Python one, so that adding
input drivers should be trivial.

For document input, I plan to use Pandoc. In other words, citeproc-hs
will receive a list of citation, a style and a bibliographic database
and return a formatted citation or a formatted list of citation for
the bibliography. An output filter will translated into the Pandoc
datatype (or, with a plugin infrastructure, into other possible
formats).

Andrea