Skip to content

Commit

Permalink
Bump version to GHC 8.6 and lts-13.8
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepakKapiswe committed Mar 25, 2019
1 parent 00610dd commit 780d172
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 11 additions & 5 deletions serialise/src/Codec/Serialise/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ module Codec.Serialise.Class
, GSerialiseSum(..)
, encodeVector
, decodeVector
, encodeContainerSkel
, encodeMapSkel
, decodeMapSkel
) where

import Control.Applicative
Expand Down Expand Up @@ -856,9 +859,10 @@ instance Serialise a => Serialise (Tree.Tree a) where
encode (Tree.Node r sub) = encodeListLen 2 <> encode r <> encode sub
decode = decodeListLenOf 2 *> (Tree.Node <$> decode <*> decode)

encodeContainerSkel :: (Word -> Encoding)
-> (container -> Int)
-> (accumFunc -> Encoding -> container -> Encoding)
-- | Patch functions together to obtain an 'Encoding' for a container.
encodeContainerSkel :: (Word -> Encoding) -- ^ encoder of the length
-> (container -> Int) -- ^ length
-> (accumFunc -> Encoding -> container -> Encoding) -- ^ foldr
-> accumFunc
-> container
-> Encoding
Expand Down Expand Up @@ -996,8 +1000,9 @@ instance (Serialise a, Hashable a, Eq a) => Serialise (HashSet.HashSet a) where
encode = encodeSetSkel HashSet.size HashSet.foldr
decode = decodeSetSkel HashSet.fromList

-- | A helper function for encoding maps.
encodeMapSkel :: (Serialise k, Serialise v)
=> (m -> Int)
=> (m -> Int) -- ^ obtain the length
-> ((k -> v -> Encoding -> Encoding) -> Encoding -> m -> Encoding)
-> m
-> Encoding
Expand All @@ -1009,8 +1014,9 @@ encodeMapSkel size foldrWithKey =
(\k v b -> encode k <> encode v <> b)
{-# INLINE encodeMapSkel #-}

-- | A utility function to construct a 'Decoder' for maps.
decodeMapSkel :: (Serialise k, Serialise v)
=> ([(k,v)] -> m)
=> ([(k,v)] -> m) -- ^ fromList
-> Decoder s m
decodeMapSkel fromList = do
n <- decodeMapLen
Expand Down
3 changes: 2 additions & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resolver: lts-13.8
resolver: lts-13.14

packages:
- 'cborg'
- 'serialise'
Expand Down

0 comments on commit 780d172

Please sign in to comment.