--- -- This module provides functions for countable -- objects. Well, it is just an example for HDoc, so don't ask me what -- it is good for. More inforation about HDoc is available at -- -- www.fmi.uni-passau.de/~groessli/hdoc -- @version 0.3 module Countable where --- -- For things that consist of countable components. class Countable a where --- -- Counts the number of components. -- @param thing - the thing to count the components of. -- @return num - the number of components. count :: a -> Integer --- -- Lists are countable objects. -- Each element of the list is considered to be one component. instance Countable [a] where --- -- Counts the components in a list. -- As "one component" is interpreted as -- "one list element", the -- number of components in the list is equal to its length. -- -- @param list - the list to count -- @return num - the number of elements in the list. count = fromInt . length