Skip to content

Instantly share code, notes, and snippets.

@mankyKitty
Created October 4, 2016 11:15
Show Gist options
  • Save mankyKitty/77c13811ea5b25425516e810aa48c1ac to your computer and use it in GitHub Desktop.
Save mankyKitty/77c13811ea5b25425516e810aa48c1ac to your computer and use it in GitHub Desktop.
Need coffee....
module Sand
( Base (..)
, Time
)
where
data Base
= Sec
| Nano
| Pico
deriving (Show, Eq, Ord)
data Time
= Time Base Int
deriving Eq
getCurrentTime
:: MonadIO m
=> m Time
fromYeOldeTime
:: UTCTime
-> Time
fromStringly
:: IsString s
=> s
-> Maybe Time
>>> t <- getCurrentTime
>>> t ^. _Year
-- (2016, Time Sec 823742837423784) -- Don't know how this would work yet
>>> t ^. _Year . _Day
-- (278, Time Sec 823742837423784)
_Year
:: Prism' (Int, Time) Time
_Day
:: Prism' (Int, Time) Time
_Weekday
:: Prism' (String, Time) Time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment