Skip to content

Data type with no functionality (useful for testing)

License

Notifications You must be signed in to change notification settings

sanctuary-js/sanctuary-useless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sanctuary-useless

This package exports a single value, Useless, the sole member of the sanctuary-useless/Useless type:

//    Useless :: Useless
const Useless = require ('sanctuary-useless');

Useless, as its name suggests, has no functionality. This makes it useful for testing algebraic data types which satisfy various type classes.

The following assertion, in isolation, suggests that Identity a satisfies Z.Setoid for all a:

eq (Z.Setoid.test (Identity (0))) (true);

Identity Useless, though, does not satisfy Z.Setoid, indicating that a is constrained in some way:

eq (Z.Setoid.test (Identity (Useless))) (false);
eq (Z.Setoid.test (Identity (0))) (true);

Conversely, one can use Useless to demonstrate universal quantification where applicable:

eq (Z.Functor.test (Identity (Useless))) (true);