Closed gleachkr closed 9 years ago
I'll work on this as it shouldn't be too hard. We just need to decide on a file format that has the needed student information in it. Also how you specify what the students need to prove. Should there be multiple proofs in a single file?
Ok, Great. I think multiple proofs in one file would make sense. YAML would work for the student information, perhaps via http://hackage.haskell.org/package/HsSyck. Or is that overkill?
So are students going to write the YAML themselves or are they going to use a website to fill this in (which avoids teaching students YAML)? If they are going to use a webpage then JSON might be a better choice.
And no, I don't think YAML is overkill. Overkill would be writing our own implementation rather than using something we already have pre-made for us.
I was thinking that the site would generate it (to avoid headaches related to typos). JSON is simpler in that case?
On Jul 28, 2015, at 3:25 PM, Jake Ehrlich notifications@github.com wrote:
So are students going to write the YAML themselves or are they going to use a website to fill this in (which avoids teaching students YAML)? If they are going to use a webpage then JSON might be a better choice.
― Reply to this email directly or view it on GitHub.
Well maybe. I say this because javascript has a built in function (that GHCJS should expose to Haskell) that can convert javascript objects to JSON objects. JSON objects basically just represent Javascript objects sans functions and cyclic data so the conversion is trivial. Also I had never heard of YAML until now but JSON is really widely used.
This all said I might be splitting hairs. We are talking about very little data. YAML looks really easy to use and we have to build the object one way or another.
On the one hand, YAML might be a little easier to read, if someone wants to just open up the file and examine or edit the metadata manually.
On the other hand, the fact that JSON is built in to JS is nice. For some reason, both major Haskell YAML libraries appear to rely on C libraries, so it's unclear that we could use them with ghcjs. That's no problem for the CLI, but when we generate the YAML inside GHCJS, we'd need to do so by hand. That will almost certainly be trivial (maybe not in general, but at least for the particular cases we might want). But it is not maximally elegant.
Maybe this would be a way of avoiding generating YAML by hand: http://jsontoyaml.com. We'd just use javascript (called from GHCJS) on the browser side, and use a Haskell YAML library in the CLI.
Ok, we've got a basic prototype as of 0d721b1802b09d2576baa01e872dd8c4153e2644. It reads a fragment of YAML, and the url program writes a fragment of YAML. I don't think we'll need more than this fragment for a while, but I think the option is still there (as are other options for enhancing the CLI---we can add these as separate issues).
It would be nice to have a simple CLI binary, for batch processing of homework.