p7/Main.hs

27 lines
807 B
Haskell
Raw Normal View History

2018-06-22 00:23:58 -04:00
module Main where
2018-06-21 22:24:42 -04:00
2018-06-22 00:23:58 -04:00
import Data.Time.Clock
import Data.Time.Calendar
2018-06-24 19:21:29 -04:00
import Data.Maybe
2018-06-21 22:24:42 -04:00
import Packs
2018-06-24 17:26:43 -04:00
import State
2018-06-24 19:21:29 -04:00
import Format
import Timestamp
2018-06-22 00:23:58 -04:00
main :: IO ()
main = do
t <- getCurrentTime >>= return . toGregorian . utctDay
2018-06-24 19:21:29 -04:00
mapM_ putStrLn $ showState (currentFormat $ toTS t)
toTS :: (Integer, Int, Int) -> Timestamp
toTS (y,m,d) = Ts (fromIntegral d) (fromIntegral m) y
showState :: State -> [String]
showState ((i, o), (Bq b), _) =
[
"Legal Packs:\n" ++ concat (map (\(Ir n) -> " " ++ show n ++ "\n") i)
, "Legal Boxes:\n" ++ concat (map (\x -> " " ++ show x ++ "\n") (catMaybes $ tail b))
, "Rotated Packs:\n" ++ concat (map (\(Or n _) -> " " ++ show n ++ "\n") o)
, "Rotated Boxes:\n" ++ concat (map (\x -> " " ++ show x ++ "\n") (catMaybes $ [head b]))
]