imalsogreg / reffit

Community mini-reviews for scientific papers
reffit.com
GNU General Public License v3.0
33 stars 3 forks source link

use of partial function (!!) #17

Open imalsogreg opened 10 years ago

imalsogreg commented 10 years ago

At CrossRef.hs line 68 FieldTag.hs line 94

Possibly elsewhere? If I remember, I found a crash when trying to add a paper, after erasing all the state (was trying to either render or process the New Document form). The crash was caused by DocumentClass being [].

AnneTheAgile commented 10 years ago

Sorry for dumb q, but what does this mean? How does partial function relate to the problem found? //AnneTheAgile

imalsogreg commented 10 years ago

Problem found was that reffit server crashed while I was testing because I tried to call (!!) on an empty list. (!!) is undefined for empty list (a 'partial function' is one that isn't defined over all well-typed inputs, and [] is a well-typed input). I try not to use partial functions because it's easy to forget where they are, and whether or not you proved that they're safe in the context they're in, even as you refactor that context. I'm sure that this one got in because i was lazily hacking something together, and forgot to come back and clean up. That's no good b/c if the server crashes my site goes down :/

AnneTheAgile commented 10 years ago

ah, ty!