[clean-list] Some examples about the Directory library
Ronny Wichers Schreur
ronny@cs.kun.nl
Thu, 18 Dec 2003 16:56:44 +0100
Jerzy Karczmarczuk writes (to the Clean discussion list):
> What's wrong with the following?
>
> module dirmod
> import StdEnv,StdIO,Directory
>
> ff world = getDirectoryContents
> (AbsolutePath "D" [PathDown "\\Work"]) world
>
> Start :: *World -> ([DirEntry],*World)
> Start world
> # ((a,b),world) = ff world
> = (b,world)
>
> //====
>
>
> Here 'a' is the error code, I *didn't want to look at*.
Shame on you!
> But it caught me anyway. The program compiled and responded:
>
> (fatal error: tried to evaluate an error value returned by
> function getDirectoryContents).
Seriously: the function expects that you only inspect b
if a is not an error. I don't like the design, but that's
the way it is.
Cheers,
Ronny Wichers Schreur