AC-MiniTest-1.1.1: A simple test framework.

Safe HaskellSafe-Infered



Defines the Label type, for making values showable.



data Label x Source

The Label type.

A value of type Label x is really a value of type x, but with a textual label. The Show instance returns this label.

This can be tremendously useful for allowing you to show values which would not otherwise be printable. For example, functions. Rather than passing a function, you can pass a labelled function. This allows you to know, at runtime, which function you're dealing with, which is very useful for test purposes.

You can use label to extract the label text, and value to extract the actual data value.

The Show instance uses the label, but the other instances use only the value, ignoring the label. (In particular, any operations which alter the value leave the label untouched.)




label :: String
value :: !x


Bounded x => Bounded (Label x) 
Enum x => Enum (Label x) 
Eq x => Eq (Label x) 
Ord x => Ord (Label x) 
Show (Label x) 

data Label1 c x1 Source

This type is similar to Label. However, Label cannot be made an instance of higher-kinded classes such as Functor and Monad. This type gets around that irritating limitation.




label1 :: String
value1 :: c x1


Monad c => Monad (Label1 c) 
Functor c => Functor (Label1 c) 
Bounded (c x1) => Bounded (Label1 c x1) 
Enum (c x1) => Enum (Label1 c x1) 
Eq (c x1) => Eq (Label1 c x1) 
Ord (c x1) => Ord (Label1 c x1) 
Show (Label1 c x1)