登入
選單
返回
Google圖書搜尋
Pattern Matching with Abstract Data Types
Simon Fraser University. Centre for Systems Science
出版
Simon Fraser University, Centre for Systems Science
, 1991
URL
http://books.google.com.hk/books?id=esJfHAAACAAJ&hl=&source=gbs_api
註釋
Two proposals have been made to generalize pattern matching to a broader class of data types: the laws mechanism of Miranda, which allows pattern matching with non-free algebraic types, and the views concept of Wadler (1987), which enables defining of arbitrary mappings between a physical implementation and a view supporting pattern matching. This paper proposes a third approach which unifies the laws and views mechanisms while avoiding their problems. The paper views pattern matching philosophically as a bundling of case recognition and component selection functions instead of a method for inverting data construction. This can be achieved by removing the implied equivalence between data constructors and pattern constructors. In practice, the proposal allows automatic mapping into a view but not out of a view. Equational reasoning can still be used with the resulting system.