git.iko.soy/typeable/flat-instances
on 2d518ff help sign in
5 files changed+10−43
since splitsnapshots
unifiedsplit
flat-instances.cabal+1−14 src/Flat/Orphans.hs → src/Flat/Instances.hs+4−5 src/Flat/Servant.hs−19 stack.yaml+1−1 stack.yaml.lock+4−4
flat-instances.cabal+1−14
@@ -4,26 +4,13 @@ name: flat-instances
44version: 0.1.0.0
55license-file: LICENSE
66
7−Flag flat-servant
8− Description: Enable Flat serialization support
9− Default: True
10− Manual: False
11−
127library
138 exposed-modules:
14− Flat.Orphans
9+ Flat.Instances
1510 build-depends:
1611 base,
1712 flat,
1813 time,
19− vector
20− if flag(flat-servant)
21− exposed-modules:
22− Flat.Servant
23− build-depends:
24− bytestring,
25− servant
26−
2714 hs-source-dirs:
2815 src
2916 default-language:
src/Flat/Orphans.hs → src/Flat/Instances.hsrenamed+4−5
@@ -1,13 +1,14 @@
11{-# LANGUAGE DerivingVia #-}
2+{-# LANGUAGE NamedFieldPuns #-}
23{-# LANGUAGE RecordWildCards #-}
34{-# LANGUAGE StandaloneDeriving #-}
45{-# OPTIONS_GHC -fno-warn-orphans #-}
56
6−module Flat.Orphans where
7+
8+module Flat.Instances where
79
810import Data.Fixed
911import Data.Time
10−import Data.Vector
1112import Flat as F
1213
1314
@@ -19,7 +20,7 @@ instance Flat DiffTime where
1920 size = F.size . diffTimeToPicoseconds
2021
2122utcTimeToTuple :: UTCTime -> (Day, DiffTime)
22−utcTimeToTuple UTCTime{..} = (utctDay, utctDayTime)
23+utcTimeToTuple = ((,) <$> utctDay <*> utctDayTime)
2324
2425instance Flat UTCTime where
2526 encode = F.encode . utcTimeToTuple
@@ -65,5 +66,3 @@ instance Flat ZonedTime where
6566 size = F.size . zonedTimeToTuple
6667 encode = F.encode . zonedTimeToTuple
6768 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
22
33packages:
44- .
stack.yaml.lock+4−4
@@ -6,7 +6,7 @@
66packages: []
77snapshots:
88- completed:
9− sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
10− size: 619204
11− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
12− original: lts-19.33
9+ sha256: fb634b19f31da06684bb07ce02a20c75a3162138f279b388905b03ebd57bb50f
10+ size: 618876
11+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/6.yaml
12+ original: lts-19.6