
Hi, Am Montag, den 05.09.2011, 14:35 -0400 schrieb Gwern Branwen:
On Mon, Sep 5, 2011 at 1:43 PM, Joachim Breitner
wrote: Do you think this could be useful (from a user point of view)? Has this idea maybe already been proposed?
How does it compare with Oleg's typeclass approach? http://okmij.org/ftp/Haskell/types.html#Prepose
the big difference is that Oleg’s approach exploits the existing type system. This is elegant, as it does not need additional support by the compiler. The “disadvantage” is that you have to still have to adjust type signatures (quotes because there is some value in explicitly stating the use of parameters), and it might (possibly) interfere with other fancy usages of of the type system. My proposal adds a second layer of “type” checking, i.e. the terms have their types as before (and all guarantees by the type system prevail), and a second round of inference and checking ensures the additional property of properly setting and using the module¹ parameters. Another difference is that his system allows for local changes of parameters, while mine deliberately ensures that a parameter really has exactly one value during one execution of the program. Finally, I’d say that my approach is easier to grasp and use by the programmer. Greetings, Joachim ¹ I guess the same approach works even when parameters are not tied to a specific module, but live on their own. But I guess for clarity of syntax and use it makes sense to tie them to modules, at least at first. -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/