[Haskell-cafe] Fractional/negative fixity?
Henning Thielemann
lemming at henning-thielemann.de
Thu Nov 9 11:31:47 EST 2006
On Wed, 8 Nov 2006, Nils Anders Danielsson wrote:
> On Wed, 08 Nov 2006, Henning Thielemann <lemming at henning-thielemann.de> wrote:
>
> > If the Prelude would be splitted into modules, where (==) and (+)
> > are separated, and no module imports the other one, then we need a
> > third module, which states the relation between (==) and (+).
>
> Yes, presumably. However, currently a fixity declaration for an
> operator can only be given in the module where the operator is
> defined. In this hypothetical new system, how would one import/export
> fixity declarations? Should they be named, or should they be treated
> like instance declarations are treated today?
Good question. Today fixity can only be declared per symbol. Thus it is
natural to allow it only in the scope, where the symbol is defined. If
fixity definitions consists of relations, then there are multiple symbols
involved per relation. Is it sensible to restrict the definition to a
module where one of the involved symbols is defined? Will people define
non-exported dummy symbols in order to define fixities somewhere else?
Maybe making fixity declarations like type class instance declarations is
good. Is it good that instance declarations are anonymous, at all? There
can be instance clashes, say if several people feel that Prelude misses
Num instances for Strings, Boolean instances for Int and so on. I can't
hide them, if I find them more dangerous than helpful. Similar problems
apply to fixities. Maybe explicit fixity import or redeclaration, as
proposed recently
http://www.haskell.org/pipermail/haskell-cafe/2006-November/019364.html
is a good idea.
More information about the Haskell-Cafe
mailing list