[darcs-users] machine-readable formats

Max Battcher me at worldmaker.net
Sun Sep 5 19:24:28 UTC 2010


On 9/3/2010 18:43, Petr Rockai wrote:
> I guess the only reasonable way to YAML [(a, b)] is a list of singleton
> maps, right... or is a list of two-element lists better? (As opposed to
> [a ->  b] which is an actual YAML map.)

Maybe the list of two-element lists *is* preferable? There is a subtle 
order sometimes implied by summary information, anyway. One possible 
YAML example:

- [A, file1.txt]
- [M, file1.txt]
- [Move, file1.txt, file2.txt]
- [M, file2.txt]

>> I've got a gut feeling that I'd rather see darcs properly escape things in a
>> clear character-oriented format for its machine-readable output than deal with
>> verbatim output, anyway.
>
> Yes, but that's just because you are a python programmer and not a perl
> programmer (or a shell programmer, or an awk programmer). I suspect
> emacs-lispers will prefer the regular language output too.

True to a point, but I've still seen almost my fair share of old shell 
scripts that have to be rejiggered due to subtle changes in some other 
tool's output.

Also, Python is as fine and qualified as a shell scripting language as 
perl is (Python even has -e), if not better (for being more readable :P).

# One liner to convert annotate YAML to JSON
darcs ann --yaml|python -e "import json, sys, yaml; print 
json.dumps(yaml.load(sys.stdin))"

> PS: We still need a YAML library. Shame that all that are on Hackage are
> essentially undocumented. I'll just hope that someone will be able to
> implement the above two yaml :: a ->  ByteString functions for me. They
> could actually be a (->  Handle) ->  IO () if that helps any.

Hmm...

--
--Max Battcher--
http://worldmaker.net


More information about the darcs-users mailing list