rahn at ira.uka.de
Tue May 2 08:27:28 EDT 2006
Tomasz Zielonka wrote:
>>and handle options as functions from Config to Config:
> I find this approach very convenient, but I push it a bit further. Some
> time ago I wrote a small article about this:
> -- Here we thread startOptions through all supplied option actions
> opts <- foldl (>>=) (return startOptions) actions
So the order in actions is important and therefore the order of options
on the commandline is important.
But how to handle dependencies between options using this technique? I
can image two solutions:
1: Every dependency 'a implies b' has to be checked in both functions,
the one for a and the one for b.
2: An order for the actions has to be specified, maybe by decorating the
option list with priorities.
But both solutions seems to be tedious and error prone.
In contrast the sum-type technique first reads all options and then
post-processes the complete set. Here the order of options on the
commandline has no impact on the final result.
Regards, Mirko Rahn
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
More information about the Haskell-Cafe