Gabriella439 / turtle

Shell programming, Haskell style
BSD 3-Clause "New" or "Revised" License
939 stars 90 forks source link

Functions like `output` are partial with no documentation #40

Open Profpatsch opened 9 years ago

Profpatsch commented 9 years ago

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)

Gabriella439 commented 9 years ago

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).

Profpatsch commented 9 years ago
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.