[ANN] Directory 1.0 released

Ronny Wichers Schreur ronny@cs.kun.nl
Fri, 03 Dec 1999 18:44:40 +0100


Hello,

Martin Wierich wrote the function:

> getCreationTime (WindowsFileInfo {winCreationTime}) = winCreationTime
> getCreationTime (MacFileInfo {macCreationTime}) = macCreationTime
> getCreationTime (UnixFileInfo _) = abort "This program is not supposed to\
                                                             run under Unix"
Fergus Henderson replies:

> I think the point is that that code should be in the library, not in the
> user's code.

But Martin doesn't agree:

> The above function is too specific to be put into the library. It's of no
> use for Unix users. I don't include definitions into a library that only in
> limited cases might be convenient and that everyone could define himself
> as well.

Isn't part of designing a library to relieve other people from writing their
own functions? I know, when discussing library design you quickly get to
differences in taste.

I would prefer a library that allows the application programmer to
discriminate by functionality, rather than operating system. Something
like

    :: GetCreationTime
        =   GetCreationTime DateTime
        |   GetCreationTimeNotSupported

    getCreationTime :: FileInfo -> GetCreationTime

with the obvious implementation. Or perhaps a separate function to test for
the functionality, where getCreationTime could abort for unsupported cases.
The application programmer can test for availability of getCreationTime and
degrade gracefully. Or abort after all, if getCreationTime is essential.


Cheers,

Ronny Wichers Schreur