Recursions on more complicated datatypes

Definition of the datatype list is recursive. So,when we define a function for such datatypes, it comes naturally to define the function recursively.

  1. length' :: forall a . [a] -> Integer
  2. length' [] = 0
  3. length' [x|xs] = 1 + length xs
  4. > length' "hamler"
  5. 6