
Arie Peterson wrote:
J. Garrett Morris wrote (to Bulat Ziganshin):
Yes - you've reiterated Wadler's original design, with an automatic creation of a type class. Erwig and Peyton-Jones, _Pattern Guards and Transformational Patterns_ (http://research.microsoft.com/~simonpj/Papers/pat.htm) mentions problems with equational reasoning raised by this approach.
I just read this paper, in particular the part about the problems with equational reasoning that come up once you introduce (a certain form of) views.
The problems are not unsolvable - see the Pattern Matching Calculus http://www.cas.mcmaster.ca/~kahl/PMC/ for one way to re-introduce equational reasoning in pattern-matching. On another front, I am a big fan of the polar/cartesian 'view' of Complex numbers as being a fundamental test case for "full" views. In fact, that is quite restricted, one should instead be looking at the following views for R^2: bipolar, cardioid, cassinian, cartesian, elliptic, hyperbolic, invcassinian, invelliptic, logarithmic, logcosh, maxwell, parabolic, polar, rose, and tangent. In three dimensions, one then gets - bipolarcylindrical, bispherical, cardioidal, cardioidcylindrical, casscylindrical, confocalellip, confocalparab, conical, cylindrical, ellcylindrical, ellipsoidal, hypercylindrical, invcasscylindrical, invellcylindrical, invoblspheroidal, invprospheroidal, logcoshcylindrical, logcylindrical, maxwellcylindrical, oblatespheroidal, paraboloidal, paraboloidal2, paracylindrical, prolatespheroidal, rectangular, rosecylindrical, sixsphere, spherical, tangentcylindrical, tangentsphere, and toroidal. REFERENCES: Moon, P. and D.E.Spencer. "Field Theory Handbook, 2nd Ed." Berlin: Springer-Verlag, 1971. Spiegel, Murray R. "Mathematical Handbook of Formulas and Tables." New York: McGraw Hill Book Company, 1968. 126-130. Jacques