[Haskell-cafe] Solving the configuration problem with parametrized modules

Joachim Breitner mail at joachim-breitner.de
Mon Sep 5 21:28:10 CEST 2011


Am Montag, den 05.09.2011, 14:35 -0400 schrieb Gwern Branwen:
> On Mon, Sep 5, 2011 at 1:43 PM, Joachim Breitner
> <mail at joachim-breitner.de> 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


¹ 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 at joachim-breitner.de  |  nomeata at debian.org  |  GPG: 0x4743206C
  xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110905/46e74bc0/attachment.pgp>

More information about the Haskell-Cafe mailing list