[Haskell] Annoying naming clashes
Stefan Holdermans
sholderm at students.cs.uu.nl
Thu Jun 17 06:30:03 EDT 2004
Ben,
BY> it is nice to use 'maybe', 'either' functions. However, with
BY> data types with more than 2 constructors, using such function
BY> tends to be tedious than pattern match, where, you can pick
BY> specific constructors of interest.
BY> And in order to use pattern match, I have to expose my
BY> constructors.
Well, you've just identified the well-known trade-off between abstraction
and induction. A language extension involving 'views' [4, 1, 3] has been
proposed [2] to deal with this issue.
Regards,
Stefan
[1] Warren Burton and Robert Cameron. Pattern matching with abstract data
types. Journal of Functional Programming, 3(2):171-190, 1993.
http://citeseer.ist.psu.edu/context/176591/0/
[2] Warren Burton, Erik Meijer, Patrick Sansom, Simon Thompson, and Philip
Wadler. Views: An extension to Haskell pattern matching, 1996.
http://www.haskell.org/development/views.html
[3] Chris Okasaki. Views for Standard ML, 1998. 1998 ACM SIGPLAN Workshop on
ML.
http://citeseer.ist.psu.edu/okasaki98views.html
[4] Philip Wadler. Views: A way for pattern matching to cohabit with data
abstraction. In Steve Munchnik, editor, Proceedings of the 14th Symposium on
Principles of Programming Languages, pages 307-312. Association for
Computing Machinery, 1987.
http://citeseer.ist.psu.edu/wadler87views.html
More information about the Haskell
mailing list