Skip to content

Instantly share code, notes, and snippets.

@moonmaster9000
Created May 1, 2010 21:49
Show Gist options
  • Save moonmaster9000/386687 to your computer and use it in GitHub Desktop.
Save moonmaster9000/386687 to your computer and use it in GitHub Desktop.
module Library where
data Author =
Author {
name :: String,
books :: [Book]
} deriving (Show)
data Book =
Book {
title :: String,
authors :: [Author]
} deriving (Show)
createAuthor a bs = let books = map (`createBook` [a]) bs
in Author a books
createBook b as = let authors = map (`createAuthor` [b]) as
in Book b authors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment