Skip to content

Instantly share code, notes, and snippets.

@asayers
Created January 10, 2017 01:10
Show Gist options
  • Select an option

  • Save asayers/8414c6a3904b0db99fde446f701eddf6 to your computer and use it in GitHub Desktop.

Select an option

Save asayers/8414c6a3904b0db99fde446f701eddf6 to your computer and use it in GitHub Desktop.
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- timeOfDay (1:20) => TimeOfDay 1 20 0
-- timeOfDay (1:20:36) => TimeOfDay 1 20 36000000
-- timeOfDay (1:20:36.1) => TimeOfDay 1 20 36100000
timeOfDay :: [TimePart] -> TimeOfDay
timeOfDay xs = undefined
newtype TimePart = TimePart Int deriving (Num)
instance Num [TimePart] where fromInteger x = [TimePart (fromIntegral x)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment