Skip to content

Instantly share code, notes, and snippets.

@23Skidoo
Created October 19, 2011 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 23Skidoo/1299937 to your computer and use it in GitHub Desktop.
Save 23Skidoo/1299937 to your computer and use it in GitHub Desktop.
Indentation error
type Title = String
type Author = String
data Product = Book Title Author
| Video Author
| CD Title Integer Author
deriving (Eq,Show)
getTitle (Book title _ ) = title
getTitle (Video title ) = title
getTitle (CD title _ _ ) =title
getTitles l = map (\x->getTitle x) l
lookupTitle _ [] = Nothing
lookupTitle x (y:ys) | getTitle y==x = Just y
|otherwise = lookupTitle x ys
lookupTitles a b = map (\x->lookupTitle x b) a
bookAuthors l = filter author l
where author (Book _ _) = True
author _ = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment