{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-} module Main where import Data.Time.Clock import Data.Time.Calendar import Data.List import Data.Maybe import Packs import State import Format import Timestamp import Preview import Yesod import Config data Chhf = Chhf io :: MonadIO io => IO a -> io a io = liftIO putStrLnIO :: MonadIO io => String -> io () putStrLnIO = io . putStrLn mkYesod "Chhf" [parseRoutes| / HomeR GET |] instance Yesod Chhf inBoth :: (Eq a) => [a] -> [a] -> [a] inBoth x y = filter (\n -> n `elem` y) x getHomeR :: Handler Html getHomeR = do t <- io $ getCurrentTime >>= return . toGregorian . utctDay let ts = toTS t let ((i,o),b,r) = currentFormat ts let bx = (\(Bq x) -> x) let (_,ib,_) = initialRotation let bbout = map show $ catMaybes $ inBoth (bx ib) (tail $ bx b) let dpout = sort $ map show $ map (\(Ir n) -> n) i let pr = getPreview ts defaultLayout [whamlet|

CHHF - A Dunedin Netrunner Format

About

The Chris Hay Honourary Format, a post-cancellation Netrunner format. # The format consists of 18 packs at any time, and between 6 and 7 big boxes. # The following rotation rules are in place: