Working sort of

This commit is contained in:
Shaun Kerr 2018-06-22 16:23:58 +12:00
parent ac754cb570
commit 1bf94be1e9
8 changed files with 17 additions and 7 deletions

Binary file not shown.

BIN
Main Executable file

Binary file not shown.

BIN
Main.hi Normal file

Binary file not shown.

20
Main.hs
View File

@ -1,8 +1,10 @@
module Main2 where
module Main where
import System.Random
import Data.List
import Data.Maybe
import Data.Time.Clock
import Data.Time.Calendar
import Packs
data Timestamp = Ts Integer Integer Integer
@ -133,8 +135,8 @@ printLegal (l, p, b, r) = [
, "Datapacks: " ++ (intercalate ", " $ sort $ map (\(Dp n _) -> n) l)
]
printPreview :: Preview -> [String]
printPreview (i, o, (Bb bi), (Bb bo)) = [
printPreview :: Maybe Preview -> [String]
printPreview (Just (i, o, (Bb bi), (Bb bo))) = [
("In : " ++ (intercalate ", " $ (cleanDP i) ++ cbi))
, ("Out: " ++ (intercalate ", " $ (cleanDP o) ++ cbo))
]
@ -143,3 +145,15 @@ printPreview (i, o, (Bb bi), (Bb bo)) = [
cbi = catMaybes [bi]
cbo = catMaybes [bo]
cleanDP = map (\(Dp n _) -> n)
printPreview Nothing = []
toTS :: (Integer, Int, Int) -> Timestamp
toTS (y,m,d) = Ts (fromIntegral d) (fromIntegral m) y
main :: IO ()
main = do
t <- getCurrentTime >>= return . toGregorian . utctDay
let ts = toTS t
let state = getCurrentRotation ts
let out = (printLegal state) ++ [""] ++ (printPreview $ getPreview ts state)
mapM_ putStrLn $ out

BIN
Main.o Normal file

Binary file not shown.

BIN
Packs.hi Normal file

Binary file not shown.

BIN
Packs.o Normal file

Binary file not shown.

View File

@ -1,4 +0,0 @@
cleanMaybe :: Maybe String -> [String]
cleanMaybe (Just x) = [x]
cleanMaybe Nothing = []