User:Rudis/Sandbox

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Example: Module without type signatures

module StringManip where

import Data.Char

uppercase = map toUpper
lowercase = map toLower
capitalise x = 
  let capWord []     = []
      capWord (x:xs) = toUpper x : xs
  in unwords (map capWord (words x))

Example: Example

YourName.hs:3:26:
    Couldn't match expected type `[Char]'
           against inferred type `IO String'
YourName.hs:3:26:
    Couldn't match expected type `[Char]'
           against inferred type `IO String'