登入選單
返回Google圖書搜尋
Pattern Matching with Abstract Data Types
註釋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.