@@ -1,14 +1,13 @@
11{-# LANGUAGE DerivingVia #-}
2−{-# LANGUAGE NamedFieldPuns #-}
32{-# LANGUAGE RecordWildCards #-}
43{-# LANGUAGE StandaloneDeriving #-}
54{-# OPTIONS_GHC -fno-warn-orphans #-}
65
7−
8−module Flat.Instances where
6+module Flat.Orphans where
97
108import Data.Fixed
119import Data.Time
10+import Data.Vector
1211import Flat as F
1312
1413
@@ -20,7 +19,7 @@ instance Flat DiffTime where
2019 size = F.size . diffTimeToPicoseconds
2120
2221utcTimeToTuple :: UTCTime -> (Day, DiffTime)
23−utcTimeToTuple = ((,) <$> utctDay <*> utctDayTime)
22+utcTimeToTuple UTCTime{..} = (utctDay, utctDayTime)
2423
2524instance Flat UTCTime where
2625 encode = F.encode . utcTimeToTuple
@@ -66,3 +65,5 @@ instance Flat ZonedTime where
6665 size = F.size . zonedTimeToTuple
6766 encode = F.encode . zonedTimeToTuple
6867 decode = uncurry ZonedTime <$> F.decode
68+
69+deriving via (AsArray (Vector a)) instance Flat a => Flat (Vector a)