@@ -1,15 +1,13 @@
11{-# LANGUAGE DerivingVia #-}
2−{-# LANGUAGE NamedFieldPuns #-}
32{-# LANGUAGE RecordWildCards #-}
43{-# LANGUAGE StandaloneDeriving #-}
5−{-# LANGUAGE ViewPatterns #-}
64{-# OPTIONS_GHC -fno-warn-orphans #-}
75
8−
9−module Flat.Instances where
6+module Flat.Orphans where
107
118import Data.Fixed
129import Data.Time
10+import Data.Vector
1311import Flat as F
1412
1513
@@ -21,7 +19,7 @@ instance Flat DiffTime where
2119 size = F.size . diffTimeToPicoseconds
2220
2321utcTimeToTuple :: UTCTime -> (Day, DiffTime)
24−utcTimeToTuple = ((,) <$> utctDay <*> utctDayTime)
22+utcTimeToTuple UTCTime{..} = (utctDay, utctDayTime)
2523
2624instance Flat UTCTime where
2725 encode = F.encode . utcTimeToTuple
@@ -67,3 +65,5 @@ instance Flat ZonedTime where
6765 size = F.size . zonedTimeToTuple
6866 encode = F.encode . zonedTimeToTuple
6967 decode = uncurry ZonedTime <$> F.decode
68+
69+deriving via (AsArray (Vector a)) instance Flat a => Flat (Vector a)