git.iko.soy/typeable/flat-instances
on 2d518ff help sign in
flat-instances.cabal+1−14
since splitsnapshots
unifiedsplit
@@ -4,26 +4,13 @@ name: flat-instances
4version: 0.1.0.0
4version: 0.1.0.0
5license-file: LICENSE
5license-file: LICENSE
6
6
7−Flag flat-servant
8− Description: Enable Flat serialization support
9− Default: True
10− Manual: False
11−
12library
7library
13 exposed-modules:
8 exposed-modules:
14− Flat.Orphans
9+ Flat.Instances
15 build-depends:
10 build-depends:
16 base,
11 base,
17 flat,
12 flat,
18 time,
13 time,
19− vector
20− if flag(flat-servant)
21− exposed-modules:
22− Flat.Servant
23− build-depends:
24− bytestring,
25− servant
26−
27 hs-source-dirs:
14 hs-source-dirs:
28 src
15 src
29 default-language:
16 default-language:
src/Flat/Orphans.hs → src/Flat/Instances.hsrenamed+4−5
@@ -1,13 +1,14 @@
1{-# LANGUAGE DerivingVia #-}
1{-# LANGUAGE DerivingVia #-}
2+{-# LANGUAGE NamedFieldPuns #-}
2{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE StandaloneDeriving #-}
4{-# LANGUAGE StandaloneDeriving #-}
4{-# OPTIONS_GHC -fno-warn-orphans #-}
5{-# OPTIONS_GHC -fno-warn-orphans #-}
5
6
7+
6−module Flat.Orphans where
8+module Flat.Instances where
7
9
8import Data.Fixed
10import Data.Fixed
9import Data.Time
11import Data.Time
10−import Data.Vector
11import Flat as F
12import Flat as F
12
13
13
14
@@ -19,7 +20,7 @@ instance Flat DiffTime where
19 size = F.size . diffTimeToPicoseconds
20 size = F.size . diffTimeToPicoseconds
20
21
21utcTimeToTuple :: UTCTime -> (Day, DiffTime)
22utcTimeToTuple :: UTCTime -> (Day, DiffTime)
22−utcTimeToTuple UTCTime{..} = (utctDay, utctDayTime)
23+utcTimeToTuple = ((,) <$> utctDay <*> utctDayTime)
23
24
24instance Flat UTCTime where
25instance Flat UTCTime where
25 encode = F.encode . utcTimeToTuple
26 encode = F.encode . utcTimeToTuple
@@ -65,5 +66,3 @@ instance Flat ZonedTime where
65 size = F.size . zonedTimeToTuple
66 size = F.size . zonedTimeToTuple
66 encode = F.encode . zonedTimeToTuple
67 encode = F.encode . zonedTimeToTuple
67 decode = uncurry ZonedTime <$> F.decode
68 decode = uncurry ZonedTime <$> F.decode
68−
69−deriving via (AsArray (Vector a)) instance Flat a => Flat (Vector a)
src/Flat/Servant.hsdeleted−19
@@ -1,19 +0,0 @@
1−{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
2−module Flat.Servant where
3−
4−import Data.Bifunctor
5−import Data.ByteString.Lazy
6−import Flat as F
7−import Servant.API
8−
9−
10−data FlatBinary
11−
12−instance Accept FlatBinary where
13− contentType _ = "application/octet-stream"
14−
15−instance Flat a => MimeRender FlatBinary a where
16− mimeRender _ = fromStrict . F.flat
17−
18−instance Flat a => MimeUnrender FlatBinary a where
19− mimeUnrender _ = first show . F.unflat
stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-19.33
1+resolver: lts-19.6
2
2
3packages:
3packages:
4- .
4- .
stack.yaml.lock+4−4
@@ -6,7 +6,7 @@
6packages: []
6packages: []
7snapshots:
7snapshots:
8- completed:
8- completed:
9− sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
9+ sha256: fb634b19f31da06684bb07ce02a20c75a3162138f279b388905b03ebd57bb50f
10− size: 619204
10+ size: 618876
11− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
11+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/6.yaml
12− original: lts-19.33
12+ original: lts-19.6