Simon Raahauge DeSantis <[EMAIL PROTECTED]> writes:

> It seems to me that mode flags only really make sense when we're combining
> modes. To continue the tar example it might be a bit much to have
> extractVerbosePreserve, extractPreserve etc etc. This is also done in C by
> |'ing 'flags' together for things like open(). So mode flags make sense in
> UNIX and C. In Haskell we combine functions and use higher order functions,
> à la sortBy. For tar probably the best would be generating a list of the
> files in the archive, including information like modification time and
> permissions and then mapping onto that the composition of funtions that have
> type FileInfo -> IO FileInfo. So if you wanted to extract and preserve you'd
> do 'mapTar (extract . preserve)', adding in verbose and so on if you wanted.

Another option which preserves strong typing would be lists of
strongly-typed mode settings.  HOpenGL uses things like this in places
where the original OpenGL used bitflags.  Something like:

  tarExtract [Tar.PreservePermissions, Tar.Verbose] "foo.tar"

Carl Witty
[EMAIL PROTECTED]

Reply via email to