Working sort of
This commit is contained in:
parent
ac754cb570
commit
1bf94be1e9
BIN
.Main.hs.swp
BIN
.Main.hs.swp
Binary file not shown.
20
Main.hs
20
Main.hs
@ -1,8 +1,10 @@
|
|||||||
module Main2 where
|
module Main where
|
||||||
|
|
||||||
import System.Random
|
import System.Random
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Data.Time.Clock
|
||||||
|
import Data.Time.Calendar
|
||||||
import Packs
|
import Packs
|
||||||
|
|
||||||
data Timestamp = Ts Integer Integer Integer
|
data Timestamp = Ts Integer Integer Integer
|
||||||
@ -133,8 +135,8 @@ printLegal (l, p, b, r) = [
|
|||||||
, "Datapacks: " ++ (intercalate ", " $ sort $ map (\(Dp n _) -> n) l)
|
, "Datapacks: " ++ (intercalate ", " $ sort $ map (\(Dp n _) -> n) l)
|
||||||
]
|
]
|
||||||
|
|
||||||
printPreview :: Preview -> [String]
|
printPreview :: Maybe Preview -> [String]
|
||||||
printPreview (i, o, (Bb bi), (Bb bo)) = [
|
printPreview (Just (i, o, (Bb bi), (Bb bo))) = [
|
||||||
("In : " ++ (intercalate ", " $ (cleanDP i) ++ cbi))
|
("In : " ++ (intercalate ", " $ (cleanDP i) ++ cbi))
|
||||||
, ("Out: " ++ (intercalate ", " $ (cleanDP o) ++ cbo))
|
, ("Out: " ++ (intercalate ", " $ (cleanDP o) ++ cbo))
|
||||||
]
|
]
|
||||||
@ -143,3 +145,15 @@ printPreview (i, o, (Bb bi), (Bb bo)) = [
|
|||||||
cbi = catMaybes [bi]
|
cbi = catMaybes [bi]
|
||||||
cbo = catMaybes [bo]
|
cbo = catMaybes [bo]
|
||||||
cleanDP = map (\(Dp n _) -> n)
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user