turtle icon indicating copy to clipboard operation
turtle copied to clipboard

Functions like `output` are partial with no documentation

Open Profpatsch opened this issue 10 years ago • 2 comments

When I try to write to a file where the directory doesn’t exist it crashes at runtime.

It would be nice if a) either the possible IOExceptions are documented or b) it returned a Maybe or Either or even c) it can be type-checked whether the system knows if this folder can exist (which probably is a silly idea)

Profpatsch avatar Apr 30 '15 13:04 Profpatsch

I'll probably go with (A). Can you give me the exact exception so that I can document it?

Also, you can in theory do a limited form of (C) where you can verify the existence of the folder once and then encode the existence in the types. Then you can guarantee that any downstream operation that depends on the folder existing will succeed (barring removal by some other method).

Gabriella439 avatar Apr 30 '15 14:04 Gabriella439

service-checker.hs: out/scripts/information: openFile: does not exist (No such file or directory)

Going with a) I think it should be sufficient to link to the System.IO function it calls.

Profpatsch avatar Apr 30 '15 18:04 Profpatsch