Created
July 6, 2015 04:35
-
-
Save jneira/0ea54ff863bbb1c6bd71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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