1{-# OPTIONS -Wno-orphans #-}
2{-# LANGUAGE DeriveLift #-}
4module Holidays.EDay (EDay, eDayToDay) where
6import Data.ByteString.Char8
9import Data.Time.Calendar.OrdinalDate
10import qualified Data.Vector as V
11import Language.Haskell.TH.Lift
13data EDay = EDay {edYear :: Integer, edDay :: Int}
14 deriving stock (Eq,Ord,Show,Lift)
16eDayToDay :: EDay -> Day
17eDayToDay (EDay y d) = fromOrdinalDate y d
19instance FromField EDay where
20 parseField f = mkEDay <$> parseTimeM False defaultTimeLocale (iso8601DateFormat Nothing) (unpack f)
21 where mkEDay d = let (theYear,theDay) = toOrdinalDate d in EDay theYear theDay
23instance FromRecord EDay where
25 | n == 1 = unsafeIndex v 0
26 | otherwise = fail "Expected single field for a day"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list