[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pattern Binding



Original-Via: uk.ac.nsf; Fri, 7 Sep 90 18:52:32 BST
Date: Fri, 7 Sep 90 11:59:55 EDT
From: john peterson <peterson-john@cs.yale.edu>
To: Haskell@cs.yale.edu
Subject: Pattern Binding
Sender: haskell-request@cs.glasgow.ac.uk

I'd just like to clarify a few things regarding my earlier message.  I
apologize for any incorrect terminology in it - as a lowly implementor
I occasionally get the terminology confused.

John Hughes writes:

  Haskell can still be polymorphic, but they cannot be overloaded. So
  The restriction applies only to overloading.

This is entirely correct.  What we are objecting to is that overloaded
functions are being treated differently.  Thus the example

dict = (f1,f2,f3...)

only concerns us when one of the f's is overloaded.  Our compiler does
this transformation before type checking, so we do have difficulty
with this rule.  The Glasgow compiler has this same problem last time
we knew.  While we agree that there is a potential problem, we feel
that the proposed solution has made certain constructs extremely
inelegant.  The report would require that the above example be changed to

dict () = (f1,f2,f3,...)

and references to dict must all be changed to

(dict ())

We feel that this sort of situation, overloaded functions embedded in
some sort of constant, is common enough that the requirement to use
the above transformation is unreasonable.

Finally, I would point out that every defense I have seen so far of
the pattern binding rule involves scalars, as y is in

        f n = (y,y) where y=nfib 20

whereas our attacks always involve constants containing functions, as
in the `dict' example.  The pattern binding rule is triggered by
something that these two examples have in common: a variable bound to
a non-lambda.  Perhaps a different way can be found to distinguish
between these two cases.


  John Peterson