
On Fri, Apr 28, 2006 at 08:47:40AM +0100, David House wrote:
On 27/04/06, John Meacham
wrote: my favorite example is the featureful yet short grep, supporting quite a few non-trivial options as well as a detailed '--help' message. :)
Does getOptions really take an arbitrary n-tuple? Why? That seems a very odd way of doing things. The only advantage I can think of over lists is that tuples don't have to be typically homogeneous, but I would have thought that you could get your ?? and ==> operators to spit out the correct types.
Because the entire point of the module is to not only be type-safe, but to infer your intent from the type. if everything conformed to the same type, you wouldn't be able to ensure you lined up your arguments and your options properly and worse, you wouldn't be able to use the results directly as youd have to wrap them in some container. each of the return values is of a different type. So, the entire point of the module was to not use a list. unlike the other options out there. :) that is what makes it neat and enables very concise, very typesafe, code. tuples arn't particularly special, you can use HLists with the appropriate instances for instance. John -- John Meacham - ⑆repetae.net⑆john⑈