Testing Type Class Laws
Paper i proceeding, 2012

The specification of a class in Haskell often starts with stating, in comments, the laws that should be satisfied by methods defined in instances of the class, followed by the type of the methods of the class. This paper develops a framework that supports testing such class laws using QuickCheck. Our framework is a light-weight class law testing framework, which requires a limited amount of work per class law, and per datatype for which the class law is tested. We also show how to test class laws with partially-defined values. Using partially-defined values, we show that the standard lazy and strict implementations of the state monad do not satisfy the expected laws.

testing

classes

design

verification

laws

state monad

languages

Författare

J. Jeuring

Universiteit Utrecht

Patrik Jansson

Chalmers, Data- och informationsteknik, Programvaruteknik

Claudio Amaral

Chalmers, Data- och informationsteknik, Programvaruteknik

SIGPLAN Notices (ACM Special Interest Group on Programming Languages)

0362-1340 (ISSN)

Vol. 47 12 49-60

2012 ACM SIGPLAN Haskell Symposium, Haskell 2012.
Copenhagen, Denmark,

Ämneskategorier

Programvaruteknik

DOI

10.1145/2430532.2364514

Mer information

Senast uppdaterat

2021-07-22