Skip to content

Instantly share code, notes, and snippets.

@jneira
Created July 6, 2015 04:35
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 jneira/0ea54ff863bbb1c6bd71 to your computer and use it in GitHub Desktop.
Save jneira/0ea54ff863bbb1c6bd71 to your computer and use it in GitHub Desktop.
{-# LANGUAGE RecordWildCards #-}
module Bloomberg where
import Data.Time
import Text.Format
data Issue = Issue {
title :: String,
price :: Double,
pages :: Int,
publishDate :: Day,
subject :: String
} deriving (Show)
publish Issue{..}= flip format $
[title,show price,show pages,show publishDate,subject]
message = unwords ["This is the issue {3} of {0}.",
"It is {2} pages long, ",
"and costs {1}. It is about {4}"]
main = do
let bbw = Issue "Bloomberg Businessweek" 5.99 112
(fromGregorian 2015 6 5) "code"
print $ publish bbw message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment