    {-# LANGUAGE CPP #-}
    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE TypeFamilies #-}
    {-# LANGUAGE UndecidableInstances #-}
    {-# OPTIONS_GHC -fno-warn-orphans #-}

    module Data.SafeCopy.Instances where

    import Data.SafeCopy.SafeCopy

    import           Control.Monad
    import qualified Data.Array as Array
    import qualified Data.Array.Unboxed as UArray
    import qualified Data.Array.IArray as IArray
    import qualified Data.ByteString.Lazy.Char8 as L
    import qualified Data.ByteString.Char8 as B
    import qualified Data.Foldable as Foldable
    import           Data.Fixed (HasResolution, Fixed)
    import           Data.Int
    import qualified Data.IntMap as IntMap
    import qualified Data.IntSet as IntSet
    import           Data.Ix
    import qualified Data.List.NonEmpty as NonEmpty
    import qualified Data.Map as Map
    import           Data.Ratio (Ratio, (%), numerator, denominator)
    import qualified Data.Sequence as Sequence
    import           Data.Serialize
    import qualified Data.Set as Set
    import qualified Data.Text as T
    import qualified Data.Text.Encoding as T
    import qualified Data.Text.Lazy as TL
    import qualified Data.Text.Lazy.Encoding as TL
    import           Data.Time.Calendar (Day(..))
    import           Data.Time.Clock (DiffTime, NominalDiffTime, UniversalTime(..), UTCTime(..))
    import           Data.Time.Clock.TAI (AbsoluteTime, taiEpoch, addAbsoluteTime, diffAbsoluteTime)
    import           Data.Time.LocalTime (LocalTime(..), TimeOfDay(..), TimeZone(..), ZonedTime(..))
    import qualified Data.Tree as Tree
    import           Data.Typeable hiding (Proxy)
    import           Data.Word
    import           Numeric.Natural (Natural)
    import           System.Time (ClockTime(..), TimeDiff(..), CalendarTime(..), Month(..))
    import qualified System.Time as OT
    import qualified Data.Vector as V
    import qualified Data.Vector.Generic as VG
    import qualified Data.Vector.Primitive as VP
    import qualified Data.Vector.Storable as VS
    import qualified Data.Vector.Unboxed as VU

    instance SafeCopy a => SafeCopy (Prim a) where
      kind :: Kind (Prim a)
    kind = Kind (Prim a)
    forall a. Kind a
    primitive
      getCopy :: Contained (Get (Prim a))
    getCopy = Get (Prim a) -> Contained (Get (Prim a))
    forall a. a -> Contained a
    contain (Get (Prim a) -> Contained (Get (Prim a)))
    -> Get (Prim a) -> Contained (Get (Prim a))
    forall a b. (a -> b) -> a -> b
    $
                do e <- Contained (Get a) -> Get a
    forall a. Contained a -> a
    unsafeUnPack Contained (Get a)
    forall a. SafeCopy a => Contained (Get a)
    getCopy
                   return $ Prim e
      putCopy :: Prim a -> Contained Put
    putCopy (Prim a
    e)
        = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ Contained Put -> Put
    forall a. Contained a -> a
    unsafeUnPack (a -> Contained Put
    forall a. SafeCopy a => a -> Contained Put
    putCopy a
    e)

    instance SafeCopy a => SafeCopy [a] where
      getCopy :: Contained (Get [a])
    getCopy = Get [a] -> Contained (Get [a])
    forall a. a -> Contained a
    contain (Get [a] -> Contained (Get [a])) -> Get [a] -> Contained (Get [a])
    forall a b. (a -> b) -> a -> b
    $ do
        n <- Get Int
    forall t. Serialize t => Get t
    get
        g <- getSafeGet
        go g [] n
          where
            go :: Get a -> [a] -> Int -> Get [a]
            go :: forall a. Get a -> [a] -> Int -> Get [a]
    go Get a
    _ [a]
    as Int
    0 = [a] -> Get [a]
    forall a. a -> Get a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ([a] -> [a]
    forall a. [a] -> [a]
    reverse [a]
    as)
            go Get a
    g [a]
    as Int
    i = do x <- Get a
    g
                           x `seq` go g (x:as) (i - 1)
      putCopy :: [a] -> Contained Put
    putCopy [a]
    lst = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Putter Int
    forall t. Serialize t => Putter t
    put ([a] -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length [a]
    lst)
                                 PutM (a -> Put)
    forall a. SafeCopy a => PutM (a -> Put)
    getSafePut PutM (a -> Put) -> ((a -> Put) -> Put) -> Put
    forall a b. PutM a -> (a -> PutM b) -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= [a] -> (a -> Put) -> Put
    forall (t :: * -> *) (m :: * -> *) a b.
    (Foldable t, Monad m) =>
    t a -> (a -> m b) -> m ()
    forM_ [a]
    lst
      errorTypeName :: Proxy [a] -> String
    errorTypeName = Proxy [a] -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance SafeCopy a => SafeCopy (NonEmpty.NonEmpty a) where
        getCopy :: Contained (Get (NonEmpty a))
    getCopy = Get (NonEmpty a) -> Contained (Get (NonEmpty a))
    forall a. a -> Contained a
    contain (Get (NonEmpty a) -> Contained (Get (NonEmpty a)))
    -> Get (NonEmpty a) -> Contained (Get (NonEmpty a))
    forall a b. (a -> b) -> a -> b
    $ ([a] -> NonEmpty a) -> Get [a] -> Get (NonEmpty a)
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [a] -> NonEmpty a
    forall a. HasCallStack => [a] -> NonEmpty a
    NonEmpty.fromList Get [a]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: NonEmpty a -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (NonEmpty a -> Put) -> NonEmpty a -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> Put
    forall a. SafeCopy a => a -> Put
    safePut ([a] -> Put) -> (NonEmpty a -> [a]) -> NonEmpty a -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmpty a -> [a]
    forall a. NonEmpty a -> [a]
    NonEmpty.toList
        errorTypeName :: Proxy (NonEmpty a) -> String
    errorTypeName = Proxy (NonEmpty a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance SafeCopy a => SafeCopy (Maybe a) where
        getCopy :: Contained (Get (Maybe a))
    getCopy = Get (Maybe a) -> Contained (Get (Maybe a))
    forall a. a -> Contained a
    contain (Get (Maybe a) -> Contained (Get (Maybe a)))
    -> Get (Maybe a) -> Contained (Get (Maybe a))
    forall a b. (a -> b) -> a -> b
    $ do n <- Get Bool
    forall t. Serialize t => Get t
    get
                               if n then liftM Just safeGet
                                    else return Nothing
        putCopy :: Maybe a -> Contained Put
    putCopy (Just a
    a) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ Putter Bool
    forall t. Serialize t => Putter t
    put Bool
    True Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a
        putCopy Maybe a
    Nothing = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ Putter Bool
    forall t. Serialize t => Putter t
    put Bool
    False
        errorTypeName :: Proxy (Maybe a) -> String
    errorTypeName = Proxy (Maybe a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance (SafeCopy a, Ord a) => SafeCopy (Set.Set a) where
        getCopy :: Contained (Get (Set a))
    getCopy = Get (Set a) -> Contained (Get (Set a))
    forall a. a -> Contained a
    contain (Get (Set a) -> Contained (Get (Set a)))
    -> Get (Set a) -> Contained (Get (Set a))
    forall a b. (a -> b) -> a -> b
    $ ([a] -> Set a) -> Get [a] -> Get (Set a)
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [a] -> Set a
    forall a. [a] -> Set a
    Set.fromDistinctAscList Get [a]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Set a -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Set a -> Put) -> Set a -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> Put
    forall a. SafeCopy a => a -> Put
    safePut ([a] -> Put) -> (Set a -> [a]) -> Set a -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Set a -> [a]
    forall a. Set a -> [a]
    Set.toAscList
        errorTypeName :: Proxy (Set a) -> String
    errorTypeName = Proxy (Set a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance (SafeCopy a, SafeCopy b, Ord a) => SafeCopy (Map.Map a b) where
        getCopy :: Contained (Get (Map a b))
    getCopy = Get (Map a b) -> Contained (Get (Map a b))
    forall a. a -> Contained a
    contain (Get (Map a b) -> Contained (Get (Map a b)))
    -> Get (Map a b) -> Contained (Get (Map a b))
    forall a b. (a -> b) -> a -> b
    $ ([(a, b)] -> Map a b) -> Get [(a, b)] -> Get (Map a b)
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [(a, b)] -> Map a b
    forall k a. [(k, a)] -> Map k a
    Map.fromDistinctAscList Get [(a, b)]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Map a b -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Map a b -> Put) -> Map a b -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [(a, b)] -> Put
    forall a. SafeCopy a => a -> Put
    safePut ([(a, b)] -> Put) -> (Map a b -> [(a, b)]) -> Map a b -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Map a b -> [(a, b)]
    forall k a. Map k a -> [(k, a)]
    Map.toAscList
        errorTypeName :: Proxy (Map a b) -> String
    errorTypeName = Proxy (Map a b) -> String
    forall (c :: * -> * -> *) a b.
    Typeable c =>
    Proxy (c a b) -> String
    typeName2

    instance (SafeCopy a) => SafeCopy (IntMap.IntMap a) where
        getCopy :: Contained (Get (IntMap a))
    getCopy = Get (IntMap a) -> Contained (Get (IntMap a))
    forall a. a -> Contained a
    contain (Get (IntMap a) -> Contained (Get (IntMap a)))
    -> Get (IntMap a) -> Contained (Get (IntMap a))
    forall a b. (a -> b) -> a -> b
    $ ([(Int, a)] -> IntMap a) -> Get [(Int, a)] -> Get (IntMap a)
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [(Int, a)] -> IntMap a
    forall a. [(Int, a)] -> IntMap a
    IntMap.fromDistinctAscList Get [(Int, a)]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: IntMap a -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (IntMap a -> Put) -> IntMap a -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [(Int, a)] -> Put
    forall a. SafeCopy a => a -> Put
    safePut ([(Int, a)] -> Put) -> (IntMap a -> [(Int, a)]) -> IntMap a -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntMap a -> [(Int, a)]
    forall a. IntMap a -> [(Int, a)]
    IntMap.toAscList
        errorTypeName :: Proxy (IntMap a) -> String
    errorTypeName = Proxy (IntMap a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance SafeCopy IntSet.IntSet where
        getCopy :: Contained (Get IntSet)
    getCopy = Get IntSet -> Contained (Get IntSet)
    forall a. a -> Contained a
    contain (Get IntSet -> Contained (Get IntSet))
    -> Get IntSet -> Contained (Get IntSet)
    forall a b. (a -> b) -> a -> b
    $ ([Int] -> IntSet) -> Get [Int] -> Get IntSet
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Int] -> IntSet
    IntSet.fromDistinctAscList Get [Int]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: IntSet -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (IntSet -> Put) -> IntSet -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Int] -> Put
    forall a. SafeCopy a => a -> Put
    safePut ([Int] -> Put) -> (IntSet -> [Int]) -> IntSet -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> [Int]
    IntSet.toAscList
        errorTypeName :: Proxy IntSet -> String
    errorTypeName = Proxy IntSet -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance (SafeCopy a) => SafeCopy (Sequence.Seq a) where
        getCopy :: Contained (Get (Seq a))
    getCopy = Get (Seq a) -> Contained (Get (Seq a))
    forall a. a -> Contained a
    contain (Get (Seq a) -> Contained (Get (Seq a)))
    -> Get (Seq a) -> Contained (Get (Seq a))
    forall a b. (a -> b) -> a -> b
    $ ([a] -> Seq a) -> Get [a] -> Get (Seq a)
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [a] -> Seq a
    forall a. [a] -> Seq a
    Sequence.fromList Get [a]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Seq a -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Seq a -> Put) -> Seq a -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> Put
    forall a. SafeCopy a => a -> Put
    safePut ([a] -> Put) -> (Seq a -> [a]) -> Seq a -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Seq a -> [a]
    forall a. Seq a -> [a]
    forall (t :: * -> *) a. Foldable t => t a -> [a]
    Foldable.toList
        errorTypeName :: Proxy (Seq a) -> String
    errorTypeName = Proxy (Seq a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance (SafeCopy a) => SafeCopy (Tree.Tree a) where
        getCopy :: Contained (Get (Tree a))
    getCopy = Get (Tree a) -> Contained (Get (Tree a))
    forall a. a -> Contained a
    contain (Get (Tree a) -> Contained (Get (Tree a)))
    -> Get (Tree a) -> Contained (Get (Tree a))
    forall a b. (a -> b) -> a -> b
    $ (a -> [Tree a] -> Tree a) -> Get a -> Get [Tree a] -> Get (Tree a)
    forall (m :: * -> *) a1 a2 r.
    Monad m =>
    (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
    liftM2 a -> [Tree a] -> Tree a
    forall a. a -> [Tree a] -> Tree a
    Tree.Node Get a
    forall a. SafeCopy a => Get a
    safeGet Get [Tree a]
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Tree a -> Contained Put
    putCopy (Tree.Node a
    root [Tree a]
    sub) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    root Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> [Tree a] -> Put
    forall a. SafeCopy a => a -> Put
    safePut [Tree a]
    sub
        errorTypeName :: Proxy (Tree a) -> String
    errorTypeName = Proxy (Tree a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    iarray_getCopy :: (Ix i, SafeCopy e, SafeCopy i, IArray.IArray a e) => Contained (Get (a i e))
    iarray_getCopy :: forall i e (a :: * -> * -> *).
    (Ix i, SafeCopy e, SafeCopy i, IArray a e) =>
    Contained (Get (a i e))
    iarray_getCopy = Get (a i e) -> Contained (Get (a i e))
    forall a. a -> Contained a
    contain (Get (a i e) -> Contained (Get (a i e)))
    -> Get (a i e) -> Contained (Get (a i e))
    forall a b. (a -> b) -> a -> b
    $ do getIx <- Get (Get i)
    forall a. SafeCopy a => Get (Get a)
    getSafeGet
                                  liftM3 mkArray getIx getIx safeGet
        where
          mkArray :: i -> i -> [e] -> a i e
    mkArray i
    l i
    h [e]
    xs = (i, i) -> [e] -> a i e
    forall (a :: * -> * -> *) e i.
    (IArray a e, Ix i) =>
    (i, i) -> [e] -> a i e
    IArray.listArray (i
    l, i
    h) [e]
    xs
    {-# INLINE iarray_getCopy #-}

    iarray_putCopy :: (Ix i, SafeCopy e, SafeCopy i, IArray.IArray a e) => a i e -> Contained Put
    iarray_putCopy :: forall i e (a :: * -> * -> *).
    (Ix i, SafeCopy e, SafeCopy i, IArray a e) =>
    a i e -> Contained Put
    iarray_putCopy a i e
    arr = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do putIx <- PutM (i -> Put)
    forall a. SafeCopy a => PutM (a -> Put)
    getSafePut
                                      let (l,h) = IArray.bounds arr
                                      putIx l >> putIx h
                                      safePut (IArray.elems arr)
    {-# INLINE iarray_putCopy #-}

    instance (Ix i, SafeCopy e, SafeCopy i) => SafeCopy (Array.Array i e) where
        getCopy :: Contained (Get (Array i e))
    getCopy = Contained (Get (Array i e))
    forall i e (a :: * -> * -> *).
    (Ix i, SafeCopy e, SafeCopy i, IArray a e) =>
    Contained (Get (a i e))
    iarray_getCopy
        putCopy :: Array i e -> Contained Put
    putCopy = Array i e -> Contained Put
    forall i e (a :: * -> * -> *).
    (Ix i, SafeCopy e, SafeCopy i, IArray a e) =>
    a i e -> Contained Put
    iarray_putCopy
        errorTypeName :: Proxy (Array i e) -> String
    errorTypeName = Proxy (Array i e) -> String
    forall (c :: * -> * -> *) a b.
    Typeable c =>
    Proxy (c a b) -> String
    typeName2

    instance (IArray.IArray UArray.UArray e, Ix i, SafeCopy e, SafeCopy i) => SafeCopy (UArray.UArray i e) where
        getCopy :: Contained (Get (UArray i e))
    getCopy = Contained (Get (UArray i e))
    forall i e (a :: * -> * -> *).
    (Ix i, SafeCopy e, SafeCopy i, IArray a e) =>
    Contained (Get (a i e))
    iarray_getCopy
        putCopy :: UArray i e -> Contained Put
    putCopy = UArray i e -> Contained Put
    forall i e (a :: * -> * -> *).
    (Ix i, SafeCopy e, SafeCopy i, IArray a e) =>
    a i e -> Contained Put
    iarray_putCopy
        errorTypeName :: Proxy (UArray i e) -> String
    errorTypeName = Proxy (UArray i e) -> String
    forall (c :: * -> * -> *) a b.
    Typeable c =>
    Proxy (c a b) -> String
    typeName2

    instance (SafeCopy a, SafeCopy b) => SafeCopy (a,b) where
        getCopy :: Contained (Get (a, b))
    getCopy = Get (a, b) -> Contained (Get (a, b))
    forall a. a -> Contained a
    contain (Get (a, b) -> Contained (Get (a, b)))
    -> Get (a, b) -> Contained (Get (a, b))
    forall a b. (a -> b) -> a -> b
    $ (a -> b -> (a, b)) -> Get a -> Get b -> Get (a, b)
    forall (m :: * -> *) a1 a2 r.
    Monad m =>
    (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
    liftM2 (,) Get a
    forall a. SafeCopy a => Get a
    safeGet Get b
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: (a, b) -> Contained Put
    putCopy (a
    a,b
    b) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    b
        errorTypeName :: Proxy (a, b) -> String
    errorTypeName = Proxy (a, b) -> String
    forall (c :: * -> * -> *) a b.
    Typeable c =>
    Proxy (c a b) -> String
    typeName2
    instance (SafeCopy a, SafeCopy b, SafeCopy c) => SafeCopy (a,b,c) where
        getCopy :: Contained (Get (a, b, c))
    getCopy = Get (a, b, c) -> Contained (Get (a, b, c))
    forall a. a -> Contained a
    contain (Get (a, b, c) -> Contained (Get (a, b, c)))
    -> Get (a, b, c) -> Contained (Get (a, b, c))
    forall a b. (a -> b) -> a -> b
    $ (a -> b -> c -> (a, b, c))
    -> Get a -> Get b -> Get c -> Get (a, b, c)
    forall (m :: * -> *) a1 a2 a3 r.
    Monad m =>
    (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r
    liftM3 (,,) Get a
    forall a. SafeCopy a => Get a
    safeGet Get b
    forall a. SafeCopy a => Get a
    safeGet Get c
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: (a, b, c) -> Contained Put
    putCopy (a
    a,b
    b,c
    c) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    b Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> c -> Put
    forall a. SafeCopy a => a -> Put
    safePut c
    c
    instance (SafeCopy a, SafeCopy b, SafeCopy c, SafeCopy d) => SafeCopy (a,b,c,d) where
        getCopy :: Contained (Get (a, b, c, d))
    getCopy = Get (a, b, c, d) -> Contained (Get (a, b, c, d))
    forall a. a -> Contained a
    contain (Get (a, b, c, d) -> Contained (Get (a, b, c, d)))
    -> Get (a, b, c, d) -> Contained (Get (a, b, c, d))
    forall a b. (a -> b) -> a -> b
    $ (a -> b -> c -> d -> (a, b, c, d))
    -> Get a -> Get b -> Get c -> Get d -> Get (a, b, c, d)
    forall (m :: * -> *) a1 a2 a3 a4 r.
    Monad m =>
    (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r
    liftM4 (,,,) Get a
    forall a. SafeCopy a => Get a
    safeGet Get b
    forall a. SafeCopy a => Get a
    safeGet Get c
    forall a. SafeCopy a => Get a
    safeGet Get d
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: (a, b, c, d) -> Contained Put
    putCopy (a
    a,b
    b,c
    c,d
    d) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    b Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> c -> Put
    forall a. SafeCopy a => a -> Put
    safePut c
    c Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> d -> Put
    forall a. SafeCopy a => a -> Put
    safePut d
    d
    instance (SafeCopy a, SafeCopy b, SafeCopy c, SafeCopy d, SafeCopy e) =>
             SafeCopy (a,b,c,d,e) where
        getCopy :: Contained (Get (a, b, c, d, e))
    getCopy = Get (a, b, c, d, e) -> Contained (Get (a, b, c, d, e))
    forall a. a -> Contained a
    contain (Get (a, b, c, d, e) -> Contained (Get (a, b, c, d, e)))
    -> Get (a, b, c, d, e) -> Contained (Get (a, b, c, d, e))
    forall a b. (a -> b) -> a -> b
    $ (a -> b -> c -> d -> e -> (a, b, c, d, e))
    -> Get a -> Get b -> Get c -> Get d -> Get e -> Get (a, b, c, d, e)
    forall (m :: * -> *) a1 a2 a3 a4 a5 r.
    Monad m =>
    (a1 -> a2 -> a3 -> a4 -> a5 -> r)
    -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r
    liftM5 (,,,,) Get a
    forall a. SafeCopy a => Get a
    safeGet Get b
    forall a. SafeCopy a => Get a
    safeGet Get c
    forall a. SafeCopy a => Get a
    safeGet Get d
    forall a. SafeCopy a => Get a
    safeGet Get e
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: (a, b, c, d, e) -> Contained Put
    putCopy (a
    a,b
    b,c
    c,d
    d,e
    e) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    b Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> c -> Put
    forall a. SafeCopy a => a -> Put
    safePut c
    c Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> d -> Put
    forall a. SafeCopy a => a -> Put
    safePut d
    d Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> e -> Put
    forall a. SafeCopy a => a -> Put
    safePut e
    e
    instance (SafeCopy a, SafeCopy b, SafeCopy c, SafeCopy d, SafeCopy e, SafeCopy f) =>
             SafeCopy (a,b,c,d,e,f) where
        getCopy :: Contained (Get (a, b, c, d, e, f))
    getCopy = Get (a, b, c, d, e, f) -> Contained (Get (a, b, c, d, e, f))
    forall a. a -> Contained a
    contain (Get (a, b, c, d, e, f) -> Contained (Get (a, b, c, d, e, f)))
    -> Get (a, b, c, d, e, f) -> Contained (Get (a, b, c, d, e, f))
    forall a b. (a -> b) -> a -> b
    $ (,,,,,) (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
    -> Get a -> Get (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get a
    forall a. SafeCopy a => Get a
    safeGet Get (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
    -> Get b -> Get (c -> d -> e -> f -> (a, b, c, d, e, f))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get b
    forall a. SafeCopy a => Get a
    safeGet Get (c -> d -> e -> f -> (a, b, c, d, e, f))
    -> Get c -> Get (d -> e -> f -> (a, b, c, d, e, f))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get c
    forall a. SafeCopy a => Get a
    safeGet Get (d -> e -> f -> (a, b, c, d, e, f))
    -> Get d -> Get (e -> f -> (a, b, c, d, e, f))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get d
    forall a. SafeCopy a => Get a
    safeGet Get (e -> f -> (a, b, c, d, e, f))
    -> Get e -> Get (f -> (a, b, c, d, e, f))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get e
    forall a. SafeCopy a => Get a
    safeGet Get (f -> (a, b, c, d, e, f)) -> Get f -> Get (a, b, c, d, e, f)
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get f
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: (a, b, c, d, e, f) -> Contained Put
    putCopy (a
    a,b
    b,c
    c,d
    d,e
    e,f
    f) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    b Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> c -> Put
    forall a. SafeCopy a => a -> Put
    safePut c
    c Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> d -> Put
    forall a. SafeCopy a => a -> Put
    safePut d
    d Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >>
                                          e -> Put
    forall a. SafeCopy a => a -> Put
    safePut e
    e Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> f -> Put
    forall a. SafeCopy a => a -> Put
    safePut f
    f
    instance (SafeCopy a, SafeCopy b, SafeCopy c, SafeCopy d, SafeCopy e, SafeCopy f, SafeCopy g) =>
             SafeCopy (a,b,c,d,e,f,g) where
        getCopy :: Contained (Get (a, b, c, d, e, f, g))
    getCopy = Get (a, b, c, d, e, f, g) -> Contained (Get (a, b, c, d, e, f, g))
    forall a. a -> Contained a
    contain (Get (a, b, c, d, e, f, g)
     -> Contained (Get (a, b, c, d, e, f, g)))
    -> Get (a, b, c, d, e, f, g)
    -> Contained (Get (a, b, c, d, e, f, g))
    forall a b. (a -> b) -> a -> b
    $ (,,,,,,) (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
    -> Get a
    -> Get (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get a
    forall a. SafeCopy a => Get a
    safeGet Get (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
    -> Get b -> Get (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get b
    forall a. SafeCopy a => Get a
    safeGet Get (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
    -> Get c -> Get (d -> e -> f -> g -> (a, b, c, d, e, f, g))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get c
    forall a. SafeCopy a => Get a
    safeGet Get (d -> e -> f -> g -> (a, b, c, d, e, f, g))
    -> Get d -> Get (e -> f -> g -> (a, b, c, d, e, f, g))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get d
    forall a. SafeCopy a => Get a
    safeGet Get (e -> f -> g -> (a, b, c, d, e, f, g))
    -> Get e -> Get (f -> g -> (a, b, c, d, e, f, g))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
                                         Get e
    forall a. SafeCopy a => Get a
    safeGet Get (f -> g -> (a, b, c, d, e, f, g))
    -> Get f -> Get (g -> (a, b, c, d, e, f, g))
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get f
    forall a. SafeCopy a => Get a
    safeGet Get (g -> (a, b, c, d, e, f, g))
    -> Get g -> Get (a, b, c, d, e, f, g)
    forall a b. Get (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get g
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: (a, b, c, d, e, f, g) -> Contained Put
    putCopy (a
    a,b
    b,c
    c,d
    d,e
    e,f
    f,g
    g) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    b Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> c -> Put
    forall a. SafeCopy a => a -> Put
    safePut c
    c Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> d -> Put
    forall a. SafeCopy a => a -> Put
    safePut d
    d Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >>
                                            e -> Put
    forall a. SafeCopy a => a -> Put
    safePut e
    e Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> f -> Put
    forall a. SafeCopy a => a -> Put
    safePut f
    f Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> g -> Put
    forall a. SafeCopy a => a -> Put
    safePut g
    g

    instance SafeCopy Int where
        getCopy :: Contained (Get Int)
    getCopy = Get Int -> Contained (Get Int)
    forall a. a -> Contained a
    contain Get Int
    forall t. Serialize t => Get t
    get; putCopy :: Int -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Putter Int -> Int -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Putter Int
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Int -> String
    errorTypeName = Proxy Int -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Integer where
        getCopy :: Contained (Get Integer)
    getCopy = Get Integer -> Contained (Get Integer)
    forall a. a -> Contained a
    contain Get Integer
    forall t. Serialize t => Get t
    get; putCopy :: Integer -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Integer -> Put) -> Integer -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Integer -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Integer -> String
    errorTypeName = Proxy Integer -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Natural where
        getCopy :: Contained (Get Natural)
    getCopy = Get Natural -> Contained (Get Natural)
    forall a. a -> Contained a
    contain Get Natural
    forall t. Serialize t => Get t
    get; putCopy :: Natural -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Natural -> Put) -> Natural -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Natural -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Natural -> String
    errorTypeName = Proxy Natural -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    -- | cereal changed the formats for Float/Double in 0.5.*
    --
    -- https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced
    -- https://github.com/GaloisInc/cereal/issues/35
    newtype CerealFloat040 = CerealFloat040 { CerealFloat040 -> Float
    unCerealFloat040 :: Float} deriving (Int -> CerealFloat040 -> ShowS
    [CerealFloat040] -> ShowS
    CerealFloat040 -> String
    (Int -> CerealFloat040 -> ShowS)
    -> (CerealFloat040 -> String)
    -> ([CerealFloat040] -> ShowS)
    -> Show CerealFloat040
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CerealFloat040 -> ShowS
    showsPrec :: Int -> CerealFloat040 -> ShowS
    $cshow :: CerealFloat040 -> String
    show :: CerealFloat040 -> String
    $cshowList :: [CerealFloat040] -> ShowS
    showList :: [CerealFloat040] -> ShowS
    Show)
    instance SafeCopy CerealFloat040 where
        getCopy :: Contained (Get CerealFloat040)
    getCopy = Get CerealFloat040 -> Contained (Get CerealFloat040)
    forall a. a -> Contained a
    contain (Float -> CerealFloat040
    CerealFloat040 (Float -> CerealFloat040) -> Get Float -> Get CerealFloat040
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Integer -> Int -> Float) -> Get Integer -> Get Int -> Get Float
    forall (m :: * -> *) a1 a2 r.
    Monad m =>
    (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
    liftM2 Integer -> Int -> Float
    forall a. RealFloat a => Integer -> Int -> a
    encodeFloat Get Integer
    forall t. Serialize t => Get t
    get Get Int
    forall t. Serialize t => Get t
    get)
        putCopy :: CerealFloat040 -> Contained Put
    putCopy (CerealFloat040 Float
    float) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Putter (Integer, Int)
    forall t. Serialize t => Putter t
    put (Float -> (Integer, Int)
    forall a. RealFloat a => a -> (Integer, Int)
    decodeFloat Float
    float))
        errorTypeName :: Proxy CerealFloat040 -> String
    errorTypeName = Proxy CerealFloat040 -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance Migrate Float where
      type MigrateFrom Float = CerealFloat040
      migrate :: MigrateFrom Float -> Float
    migrate (CerealFloat040 Float
    d) = Float
    d

    instance SafeCopy Float where
      version :: Version Float
    version = Int32 -> Version Float
    forall a. Int32 -> Version a
    Version Int32
    1
      kind :: Kind Float
    kind = Kind Float
    forall a. Migrate a => Kind a
    extension
      getCopy :: Contained (Get Float)
    getCopy = Get Float -> Contained (Get Float)
    forall a. a -> Contained a
    contain Get Float
    forall t. Serialize t => Get t
    get
      putCopy :: Float -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Float -> Put) -> Float -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Float -> Put
    forall t. Serialize t => Putter t
    put
      errorTypeName :: Proxy Float -> String
    errorTypeName = Proxy Float -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    -- | cereal changed the formats for Float/Double in 0.5.*
    --
    -- https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced
    -- https://github.com/GaloisInc/cereal/issues/35
    newtype CerealDouble040 = CerealDouble040 { CerealDouble040 -> Double
    unCerealDouble040 :: Double} deriving (Int -> CerealDouble040 -> ShowS
    [CerealDouble040] -> ShowS
    CerealDouble040 -> String
    (Int -> CerealDouble040 -> ShowS)
    -> (CerealDouble040 -> String)
    -> ([CerealDouble040] -> ShowS)
    -> Show CerealDouble040
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CerealDouble040 -> ShowS
    showsPrec :: Int -> CerealDouble040 -> ShowS
    $cshow :: CerealDouble040 -> String
    show :: CerealDouble040 -> String
    $cshowList :: [CerealDouble040] -> ShowS
    showList :: [CerealDouble040] -> ShowS
    Show)
    instance SafeCopy CerealDouble040 where
        getCopy :: Contained (Get CerealDouble040)
    getCopy = Get CerealDouble040 -> Contained (Get CerealDouble040)
    forall a. a -> Contained a
    contain (Double -> CerealDouble040
    CerealDouble040 (Double -> CerealDouble040) -> Get Double -> Get CerealDouble040
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Integer -> Int -> Double) -> Get Integer -> Get Int -> Get Double
    forall (m :: * -> *) a1 a2 r.
    Monad m =>
    (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
    liftM2 Integer -> Int -> Double
    forall a. RealFloat a => Integer -> Int -> a
    encodeFloat Get Integer
    forall t. Serialize t => Get t
    get Get Int
    forall t. Serialize t => Get t
    get)
        putCopy :: CerealDouble040 -> Contained Put
    putCopy (CerealDouble040 Double
    double) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Putter (Integer, Int)
    forall t. Serialize t => Putter t
    put (Double -> (Integer, Int)
    forall a. RealFloat a => a -> (Integer, Int)
    decodeFloat Double
    double))
        errorTypeName :: Proxy CerealDouble040 -> String
    errorTypeName = Proxy CerealDouble040 -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance Migrate Double where
      type MigrateFrom Double = CerealDouble040
      migrate :: MigrateFrom Double -> Double
    migrate (CerealDouble040 Double
    d) = Double
    d

    instance SafeCopy Double where
      version :: Version Double
    version = Int32 -> Version Double
    forall a. Int32 -> Version a
    Version Int32
    1
      kind :: Kind Double
    kind = Kind Double
    forall a. Migrate a => Kind a
    extension
      getCopy :: Contained (Get Double)
    getCopy = Get Double -> Contained (Get Double)
    forall a. a -> Contained a
    contain Get Double
    forall t. Serialize t => Get t
    get
      putCopy :: Double -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Double -> Put) -> Double -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Double -> Put
    forall t. Serialize t => Putter t
    put
      errorTypeName :: Proxy Double -> String
    errorTypeName = Proxy Double -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy L.ByteString where
        getCopy :: Contained (Get ByteString)
    getCopy = Get ByteString -> Contained (Get ByteString)
    forall a. a -> Contained a
    contain Get ByteString
    forall t. Serialize t => Get t
    get; putCopy :: ByteString -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (ByteString -> Put) -> ByteString -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy ByteString -> String
    errorTypeName = Proxy ByteString -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy B.ByteString where
        getCopy :: Contained (Get ByteString)
    getCopy = Get ByteString -> Contained (Get ByteString)
    forall a. a -> Contained a
    contain Get ByteString
    forall t. Serialize t => Get t
    get; putCopy :: ByteString -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (ByteString -> Put) -> ByteString -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy ByteString -> String
    errorTypeName = Proxy ByteString -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Char where
        getCopy :: Contained (Get Char)
    getCopy = Get Char -> Contained (Get Char)
    forall a. a -> Contained a
    contain Get Char
    forall t. Serialize t => Get t
    get; putCopy :: Char -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Char -> Put) -> Char -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Char -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Char -> String
    errorTypeName = Proxy Char -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Word where
        getCopy :: Contained (Get Word)
    getCopy = Get Word -> Contained (Get Word)
    forall a. a -> Contained a
    contain Get Word
    forall t. Serialize t => Get t
    get; putCopy :: Word -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Word -> Put) -> Word -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Word -> String
    errorTypeName = Proxy Word -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Word8 where
        getCopy :: Contained (Get Word8)
    getCopy = Get Word8 -> Contained (Get Word8)
    forall a. a -> Contained a
    contain Get Word8
    forall t. Serialize t => Get t
    get; putCopy :: Word8 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Word8 -> Put) -> Word8 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word8 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Word8 -> String
    errorTypeName = Proxy Word8 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Word16 where
        getCopy :: Contained (Get Word16)
    getCopy = Get Word16 -> Contained (Get Word16)
    forall a. a -> Contained a
    contain Get Word16
    forall t. Serialize t => Get t
    get; putCopy :: Word16 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Word16 -> Put) -> Word16 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word16 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Word16 -> String
    errorTypeName = Proxy Word16 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Word32 where
        getCopy :: Contained (Get Word32)
    getCopy = Get Word32 -> Contained (Get Word32)
    forall a. a -> Contained a
    contain Get Word32
    forall t. Serialize t => Get t
    get; putCopy :: Word32 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Word32 -> Put) -> Word32 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word32 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Word32 -> String
    errorTypeName = Proxy Word32 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Word64 where
        getCopy :: Contained (Get Word64)
    getCopy = Get Word64 -> Contained (Get Word64)
    forall a. a -> Contained a
    contain Get Word64
    forall t. Serialize t => Get t
    get; putCopy :: Word64 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Word64 -> Put) -> Word64 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word64 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Word64 -> String
    errorTypeName = Proxy Word64 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Ordering where
        getCopy :: Contained (Get Ordering)
    getCopy = Get Ordering -> Contained (Get Ordering)
    forall a. a -> Contained a
    contain Get Ordering
    forall t. Serialize t => Get t
    get; putCopy :: Ordering -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Ordering -> Put) -> Ordering -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Ordering -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Ordering -> String
    errorTypeName = Proxy Ordering -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Int8 where
        getCopy :: Contained (Get Int8)
    getCopy = Get Int8 -> Contained (Get Int8)
    forall a. a -> Contained a
    contain Get Int8
    forall t. Serialize t => Get t
    get; putCopy :: Int8 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Int8 -> Put) -> Int8 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int8 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Int8 -> String
    errorTypeName = Proxy Int8 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Int16 where
        getCopy :: Contained (Get Int16)
    getCopy = Get Int16 -> Contained (Get Int16)
    forall a. a -> Contained a
    contain Get Int16
    forall t. Serialize t => Get t
    get; putCopy :: Int16 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Int16 -> Put) -> Int16 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int16 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Int16 -> String
    errorTypeName = Proxy Int16 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Int32 where
        getCopy :: Contained (Get Int32)
    getCopy = Get Int32 -> Contained (Get Int32)
    forall a. a -> Contained a
    contain Get Int32
    forall t. Serialize t => Get t
    get; putCopy :: Int32 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Int32 -> Put) -> Int32 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int32 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Int32 -> String
    errorTypeName = Proxy Int32 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Int64 where
        getCopy :: Contained (Get Int64)
    getCopy = Get Int64 -> Contained (Get Int64)
    forall a. a -> Contained a
    contain Get Int64
    forall t. Serialize t => Get t
    get; putCopy :: Int64 -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Int64 -> Put) -> Int64 -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int64 -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Int64 -> String
    errorTypeName = Proxy Int64 -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance (Integral a, SafeCopy a) => SafeCopy (Ratio a) where
        getCopy :: Contained (Get (Ratio a))
    getCopy   = Get (Ratio a) -> Contained (Get (Ratio a))
    forall a. a -> Contained a
    contain (Get (Ratio a) -> Contained (Get (Ratio a)))
    -> Get (Ratio a) -> Contained (Get (Ratio a))
    forall a b. (a -> b) -> a -> b
    $ do n <- Get a
    forall a. SafeCopy a => Get a
    safeGet
                                 d <- safeGet
                                 return (n % d)
        putCopy :: Ratio a -> Contained Put
    putCopy Ratio a
    r = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do a -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Ratio a -> a
    forall a. Ratio a -> a
    numerator   Ratio a
    r)
                                 a -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Ratio a -> a
    forall a. Ratio a -> a
    denominator Ratio a
    r)
        errorTypeName :: Proxy (Ratio a) -> String
    errorTypeName = Proxy (Ratio a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1
    instance (HasResolution a, Fractional (Fixed a), Typeable a) => SafeCopy (Fixed a) where
        getCopy :: Contained (Get (Fixed a))
    getCopy   = Get (Fixed a) -> Contained (Get (Fixed a))
    forall a. a -> Contained a
    contain (Get (Fixed a) -> Contained (Get (Fixed a)))
    -> Get (Fixed a) -> Contained (Get (Fixed a))
    forall a b. (a -> b) -> a -> b
    $ Rational -> Fixed a
    forall a. Fractional a => Rational -> a
    fromRational (Rational -> Fixed a) -> Get Rational -> Get (Fixed a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Rational
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Fixed a -> Contained Put
    putCopy   = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (Fixed a -> Put) -> Fixed a -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Rational -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Rational -> Put) -> (Fixed a -> Rational) -> Fixed a -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Fixed a -> Rational
    forall a. Real a => a -> Rational
    toRational
        errorTypeName :: Proxy (Fixed a) -> String
    errorTypeName = Proxy (Fixed a) -> String
    forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1

    instance SafeCopy () where
        getCopy :: Contained (Get ())
    getCopy = Get () -> Contained (Get ())
    forall a. a -> Contained a
    contain Get ()
    forall t. Serialize t => Get t
    get; putCopy :: () -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (() -> Put) -> () -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . () -> Put
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy () -> String
    errorTypeName = Proxy () -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance SafeCopy Bool where
        getCopy :: Contained (Get Bool)
    getCopy = Get Bool -> Contained (Get Bool)
    forall a. a -> Contained a
    contain Get Bool
    forall t. Serialize t => Get t
    get; putCopy :: Bool -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Putter Bool -> Bool -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Putter Bool
    forall t. Serialize t => Putter t
    put; errorTypeName :: Proxy Bool -> String
    errorTypeName = Proxy Bool -> String
    forall a. Typeable a => Proxy a -> String
    typeName
    instance (SafeCopy a, SafeCopy b) => SafeCopy (Either a b) where
        getCopy :: Contained (Get (Either a b))
    getCopy = Get (Either a b) -> Contained (Get (Either a b))
    forall a. a -> Contained a
    contain (Get (Either a b) -> Contained (Get (Either a b)))
    -> Get (Either a b) -> Contained (Get (Either a b))
    forall a b. (a -> b) -> a -> b
    $ do n <- Get Bool
    forall t. Serialize t => Get t
    get
                               if n then liftM Right safeGet
                                    else liftM Left safeGet
        putCopy :: Either a b -> Contained Put
    putCopy (Right b
    a) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ Putter Bool
    forall t. Serialize t => Putter t
    put Bool
    True Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> b -> Put
    forall a. SafeCopy a => a -> Put
    safePut b
    a
        putCopy (Left a
    a) = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ Putter Bool
    forall t. Serialize t => Putter t
    put Bool
    False Put -> Put -> Put
    forall a b. PutM a -> PutM b -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> a -> Put
    forall a. SafeCopy a => a -> Put
    safePut a
    a

        errorTypeName :: Proxy (Either a b) -> String
    errorTypeName = Proxy (Either a b) -> String
    forall (c :: * -> * -> *) a b.
    Typeable c =>
    Proxy (c a b) -> String
    typeName2

    --  instances for 'text' library

    instance SafeCopy T.Text where
        kind :: Kind Text
    kind = Kind Text
    forall a. Kind a
    base
        getCopy :: Contained (Get Text)
    getCopy = Get Text -> Contained (Get Text)
    forall a. a -> Contained a
    contain (Get Text -> Contained (Get Text))
    -> Get Text -> Contained (Get Text)
    forall a b. (a -> b) -> a -> b
    $ ByteString -> Text
    T.decodeUtf8 (ByteString -> Text) -> Get ByteString -> Get Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get ByteString
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Text -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Text -> Put) -> Text -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Put
    forall a. SafeCopy a => a -> Put
    safePut (ByteString -> Put) -> (Text -> ByteString) -> Text -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> ByteString
    T.encodeUtf8
        errorTypeName :: Proxy Text -> String
    errorTypeName = Proxy Text -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy TL.Text where
        kind :: Kind Text
    kind = Kind Text
    forall a. Kind a
    base
        getCopy :: Contained (Get Text)
    getCopy = Get Text -> Contained (Get Text)
    forall a. a -> Contained a
    contain (Get Text -> Contained (Get Text))
    -> Get Text -> Contained (Get Text)
    forall a b. (a -> b) -> a -> b
    $ ByteString -> Text
    TL.decodeUtf8 (ByteString -> Text) -> Get ByteString -> Get Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get ByteString
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Text -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Text -> Put) -> Text -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Put
    forall a. SafeCopy a => a -> Put
    safePut (ByteString -> Put) -> (Text -> ByteString) -> Text -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> ByteString
    TL.encodeUtf8
        errorTypeName :: Proxy Text -> String
    errorTypeName = Proxy Text -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    -- instances for 'time' library

    instance SafeCopy Day where
        kind :: Kind Day
    kind = Kind Day
    forall a. Kind a
    base
        getCopy :: Contained (Get Day)
    getCopy = Get Day -> Contained (Get Day)
    forall a. a -> Contained a
    contain (Get Day -> Contained (Get Day)) -> Get Day -> Contained (Get Day)
    forall a b. (a -> b) -> a -> b
    $ Integer -> Day
    ModifiedJulianDay (Integer -> Day) -> Get Integer -> Get Day
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Integer
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: Day -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Day -> Put) -> Day -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Integer -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Integer -> Put) -> (Day -> Integer) -> Day -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Day -> Integer
    toModifiedJulianDay
        errorTypeName :: Proxy Day -> String
    errorTypeName = Proxy Day -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy DiffTime where
        kind :: Kind DiffTime
    kind = Kind DiffTime
    forall a. Kind a
    base
        getCopy :: Contained (Get DiffTime)
    getCopy = Get DiffTime -> Contained (Get DiffTime)
    forall a. a -> Contained a
    contain (Get DiffTime -> Contained (Get DiffTime))
    -> Get DiffTime -> Contained (Get DiffTime)
    forall a b. (a -> b) -> a -> b
    $ Rational -> DiffTime
    forall a. Fractional a => Rational -> a
    fromRational (Rational -> DiffTime) -> Get Rational -> Get DiffTime
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Rational
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: DiffTime -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (DiffTime -> Put) -> DiffTime -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Rational -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Rational -> Put) -> (DiffTime -> Rational) -> DiffTime -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . DiffTime -> Rational
    forall a. Real a => a -> Rational
    toRational
        errorTypeName :: Proxy DiffTime -> String
    errorTypeName = Proxy DiffTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy UniversalTime where
        kind :: Kind UniversalTime
    kind = Kind UniversalTime
    forall a. Kind a
    base
        getCopy :: Contained (Get UniversalTime)
    getCopy = Get UniversalTime -> Contained (Get UniversalTime)
    forall a. a -> Contained a
    contain (Get UniversalTime -> Contained (Get UniversalTime))
    -> Get UniversalTime -> Contained (Get UniversalTime)
    forall a b. (a -> b) -> a -> b
    $ Rational -> UniversalTime
    ModJulianDate (Rational -> UniversalTime) -> Get Rational -> Get UniversalTime
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Rational
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: UniversalTime -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (UniversalTime -> Put) -> UniversalTime -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Rational -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Rational -> Put)
    -> (UniversalTime -> Rational) -> UniversalTime -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . UniversalTime -> Rational
    getModJulianDate
        errorTypeName :: Proxy UniversalTime -> String
    errorTypeName = Proxy UniversalTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy UTCTime where
        kind :: Kind UTCTime
    kind = Kind UTCTime
    forall a. Kind a
    base
        getCopy :: Contained (Get UTCTime)
    getCopy   = Get UTCTime -> Contained (Get UTCTime)
    forall a. a -> Contained a
    contain (Get UTCTime -> Contained (Get UTCTime))
    -> Get UTCTime -> Contained (Get UTCTime)
    forall a b. (a -> b) -> a -> b
    $ do day      <- Get Day
    forall a. SafeCopy a => Get a
    safeGet
                                 diffTime <- safeGet
                                 return (UTCTime day diffTime)
        putCopy :: UTCTime -> Contained Put
    putCopy UTCTime
    u = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Day -> Put
    forall a. SafeCopy a => a -> Put
    safePut (UTCTime -> Day
    utctDay UTCTime
    u)
                                 DiffTime -> Put
    forall a. SafeCopy a => a -> Put
    safePut (UTCTime -> DiffTime
    utctDayTime UTCTime
    u)
        errorTypeName :: Proxy UTCTime -> String
    errorTypeName = Proxy UTCTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy NominalDiffTime where
        kind :: Kind NominalDiffTime
    kind = Kind NominalDiffTime
    forall a. Kind a
    base
        getCopy :: Contained (Get NominalDiffTime)
    getCopy = Get NominalDiffTime -> Contained (Get NominalDiffTime)
    forall a. a -> Contained a
    contain (Get NominalDiffTime -> Contained (Get NominalDiffTime))
    -> Get NominalDiffTime -> Contained (Get NominalDiffTime)
    forall a b. (a -> b) -> a -> b
    $ Rational -> NominalDiffTime
    forall a. Fractional a => Rational -> a
    fromRational (Rational -> NominalDiffTime)
    -> Get Rational -> Get NominalDiffTime
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Rational
    forall a. SafeCopy a => Get a
    safeGet
        putCopy :: NominalDiffTime -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (NominalDiffTime -> Put) -> NominalDiffTime -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Rational -> Put
    forall a. SafeCopy a => a -> Put
    safePut (Rational -> Put)
    -> (NominalDiffTime -> Rational) -> NominalDiffTime -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NominalDiffTime -> Rational
    forall a. Real a => a -> Rational
    toRational
        errorTypeName :: Proxy NominalDiffTime -> String
    errorTypeName = Proxy NominalDiffTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy TimeOfDay where
        kind :: Kind TimeOfDay
    kind = Kind TimeOfDay
    forall a. Kind a
    base
        getCopy :: Contained (Get TimeOfDay)
    getCopy   = Get TimeOfDay -> Contained (Get TimeOfDay)
    forall a. a -> Contained a
    contain (Get TimeOfDay -> Contained (Get TimeOfDay))
    -> Get TimeOfDay -> Contained (Get TimeOfDay)
    forall a b. (a -> b) -> a -> b
    $ do hour <- Get Int
    forall a. SafeCopy a => Get a
    safeGet
                                 mins <- safeGet
                                 sec  <- safeGet
                                 return (TimeOfDay hour mins sec)
        putCopy :: TimeOfDay -> Contained Put
    putCopy TimeOfDay
    t = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Putter Int
    forall a. SafeCopy a => a -> Put
    safePut (TimeOfDay -> Int
    todHour TimeOfDay
    t)
                                 Putter Int
    forall a. SafeCopy a => a -> Put
    safePut (TimeOfDay -> Int
    todMin TimeOfDay
    t)
                                 Pico -> Put
    forall a. SafeCopy a => a -> Put
    safePut (TimeOfDay -> Pico
    todSec TimeOfDay
    t)
        errorTypeName :: Proxy TimeOfDay -> String
    errorTypeName = Proxy TimeOfDay -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy TimeZone where
        kind :: Kind TimeZone
    kind = Kind TimeZone
    forall a. Kind a
    base
        getCopy :: Contained (Get TimeZone)
    getCopy   = Get TimeZone -> Contained (Get TimeZone)
    forall a. a -> Contained a
    contain (Get TimeZone -> Contained (Get TimeZone))
    -> Get TimeZone -> Contained (Get TimeZone)
    forall a b. (a -> b) -> a -> b
    $ do mins       <- Get Int
    forall a. SafeCopy a => Get a
    safeGet
                                 summerOnly <- safeGet
                                 zoneName   <- safeGet
                                 return (TimeZone mins summerOnly zoneName)
        putCopy :: TimeZone -> Contained Put
    putCopy TimeZone
    t = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Putter Int
    forall a. SafeCopy a => a -> Put
    safePut (TimeZone -> Int
    timeZoneMinutes TimeZone
    t)
                                 Putter Bool
    forall a. SafeCopy a => a -> Put
    safePut (TimeZone -> Bool
    timeZoneSummerOnly TimeZone
    t)
                                 String -> Put
    forall a. SafeCopy a => a -> Put
    safePut (TimeZone -> String
    timeZoneName TimeZone
    t)
        errorTypeName :: Proxy TimeZone -> String
    errorTypeName = Proxy TimeZone -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy LocalTime where
        kind :: Kind LocalTime
    kind = Kind LocalTime
    forall a. Kind a
    base
        getCopy :: Contained (Get LocalTime)
    getCopy   = Get LocalTime -> Contained (Get LocalTime)
    forall a. a -> Contained a
    contain (Get LocalTime -> Contained (Get LocalTime))
    -> Get LocalTime -> Contained (Get LocalTime)
    forall a b. (a -> b) -> a -> b
    $ do day <- Get Day
    forall a. SafeCopy a => Get a
    safeGet
                                 tod <- safeGet
                                 return (LocalTime day tod)
        putCopy :: LocalTime -> Contained Put
    putCopy LocalTime
    t = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Day -> Put
    forall a. SafeCopy a => a -> Put
    safePut (LocalTime -> Day
    localDay LocalTime
    t)
                                 TimeOfDay -> Put
    forall a. SafeCopy a => a -> Put
    safePut (LocalTime -> TimeOfDay
    localTimeOfDay LocalTime
    t)
        errorTypeName :: Proxy LocalTime -> String
    errorTypeName = Proxy LocalTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy ZonedTime where
        kind :: Kind ZonedTime
    kind = Kind ZonedTime
    forall a. Kind a
    base
        getCopy :: Contained (Get ZonedTime)
    getCopy   = Get ZonedTime -> Contained (Get ZonedTime)
    forall a. a -> Contained a
    contain (Get ZonedTime -> Contained (Get ZonedTime))
    -> Get ZonedTime -> Contained (Get ZonedTime)
    forall a b. (a -> b) -> a -> b
    $ do localTime <- Get LocalTime
    forall a. SafeCopy a => Get a
    safeGet
                                 timeZone  <- safeGet
                                 return (ZonedTime localTime timeZone)
        putCopy :: ZonedTime -> Contained Put
    putCopy ZonedTime
    t = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do LocalTime -> Put
    forall a. SafeCopy a => a -> Put
    safePut (ZonedTime -> LocalTime
    zonedTimeToLocalTime ZonedTime
    t)
                                 TimeZone -> Put
    forall a. SafeCopy a => a -> Put
    safePut (ZonedTime -> TimeZone
    zonedTimeZone ZonedTime
    t)
        errorTypeName :: Proxy ZonedTime -> String
    errorTypeName = Proxy ZonedTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    instance SafeCopy AbsoluteTime where
      getCopy :: Contained (Get AbsoluteTime)
    getCopy = Get AbsoluteTime -> Contained (Get AbsoluteTime)
    forall a. a -> Contained a
    contain (Get AbsoluteTime -> Contained (Get AbsoluteTime))
    -> Get AbsoluteTime -> Contained (Get AbsoluteTime)
    forall a b. (a -> b) -> a -> b
    $ (DiffTime -> AbsoluteTime) -> Get DiffTime -> Get AbsoluteTime
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM DiffTime -> AbsoluteTime
    toAbsoluteTime Get DiffTime
    forall a. SafeCopy a => Get a
    safeGet
        where
          toAbsoluteTime :: DiffTime -> AbsoluteTime
          toAbsoluteTime :: DiffTime -> AbsoluteTime
    toAbsoluteTime DiffTime
    dt = DiffTime -> AbsoluteTime -> AbsoluteTime
    addAbsoluteTime DiffTime
    dt AbsoluteTime
    taiEpoch
      putCopy :: AbsoluteTime -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put)
    -> (AbsoluteTime -> Put) -> AbsoluteTime -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . DiffTime -> Put
    forall a. SafeCopy a => a -> Put
    safePut (DiffTime -> Put)
    -> (AbsoluteTime -> DiffTime) -> AbsoluteTime -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . AbsoluteTime -> DiffTime
    fromAbsoluteTime
        where
          fromAbsoluteTime :: AbsoluteTime -> DiffTime
          fromAbsoluteTime :: AbsoluteTime -> DiffTime
    fromAbsoluteTime AbsoluteTime
    at = AbsoluteTime -> AbsoluteTime -> DiffTime
    diffAbsoluteTime AbsoluteTime
    at AbsoluteTime
    taiEpoch
      errorTypeName :: Proxy AbsoluteTime -> String
    errorTypeName = Proxy AbsoluteTime -> String
    forall a. Typeable a => Proxy a -> String
    typeName

    -- instances for old-time

    instance SafeCopy ClockTime where
        kind :: Kind ClockTime
    kind = Kind ClockTime
    forall a. Kind a
    base
        getCopy :: Contained (Get ClockTime)
    getCopy = Get ClockTime -> Contained (Get ClockTime)
    forall a. a -> Contained a
    contain (Get ClockTime -> Contained (Get ClockTime))
    -> Get ClockTime -> Contained (Get ClockTime)
    forall a b. (a -> b) -> a -> b
    $ do secs <- Get Integer
    forall a. SafeCopy a => Get a
    safeGet
                               pico <- safeGet
                               return (TOD secs pico)
        putCopy :: ClockTime -> Contained Put
    putCopy (TOD Integer
    secs Integer
    pico) =
                  Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Integer -> Put
    forall a. SafeCopy a => a -> Put
    safePut Integer
    secs
                               Integer -> Put
    forall a. SafeCopy a => a -> Put
    safePut Integer
    pico

    instance SafeCopy TimeDiff where
        kind :: Kind TimeDiff
    kind = Kind TimeDiff
    forall a. Kind a
    base
        getCopy :: Contained (Get TimeDiff)
    getCopy   = Get TimeDiff -> Contained (Get TimeDiff)
    forall a. a -> Contained a
    contain (Get TimeDiff -> Contained (Get TimeDiff))
    -> Get TimeDiff -> Contained (Get TimeDiff)
    forall a b. (a -> b) -> a -> b
    $ do year    <- Get Int
    forall t. Serialize t => Get t
    get
                                 month   <- get
                                 day     <- get
                                 hour    <- get
                                 mins    <- get
                                 sec     <- get
                                 pico    <- get
                                 return (TimeDiff year month day hour mins sec pico)
        putCopy :: TimeDiff -> Contained Put
    putCopy TimeDiff
    t = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Putter Int
    forall t. Serialize t => Putter t
    put (TimeDiff -> Int
    tdYear TimeDiff
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put (TimeDiff -> Int
    tdMonth TimeDiff
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put (TimeDiff -> Int
    tdDay TimeDiff
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put (TimeDiff -> Int
    tdHour TimeDiff
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put (TimeDiff -> Int
    tdMin TimeDiff
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put (TimeDiff -> Int
    tdSec TimeDiff
    t)
                                 Integer -> Put
    forall t. Serialize t => Putter t
    put (TimeDiff -> Integer
    tdPicosec TimeDiff
    t)

    instance SafeCopy OT.Day where
        kind :: Kind Day
    kind = Kind Day
    forall a. Kind a
    base ; getCopy :: Contained (Get Day)
    getCopy = Get Day -> Contained (Get Day)
    forall a. a -> Contained a
    contain (Get Day -> Contained (Get Day)) -> Get Day -> Contained (Get Day)
    forall a b. (a -> b) -> a -> b
    $ Int -> Day
    forall a. Enum a => Int -> a
    toEnum (Int -> Day) -> Get Int -> Get Day
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Int
    forall t. Serialize t => Get t
    get ; putCopy :: Day -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Day -> Put) -> Day -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Putter Int
    forall t. Serialize t => Putter t
    put Putter Int -> (Day -> Int) -> Day -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Day -> Int
    forall a. Enum a => a -> Int
    fromEnum

    instance SafeCopy Month where
        kind :: Kind Month
    kind = Kind Month
    forall a. Kind a
    base ; getCopy :: Contained (Get Month)
    getCopy = Get Month -> Contained (Get Month)
    forall a. a -> Contained a
    contain (Get Month -> Contained (Get Month))
    -> Get Month -> Contained (Get Month)
    forall a b. (a -> b) -> a -> b
    $ Int -> Month
    forall a. Enum a => Int -> a
    toEnum (Int -> Month) -> Get Int -> Get Month
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Int
    forall t. Serialize t => Get t
    get ; putCopy :: Month -> Contained Put
    putCopy = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> (Month -> Put) -> Month -> Contained Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Putter Int
    forall t. Serialize t => Putter t
    put Putter Int -> (Month -> Int) -> Month -> Put
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Month -> Int
    forall a. Enum a => a -> Int
    fromEnum

    instance SafeCopy CalendarTime where
        kind :: Kind CalendarTime
    kind = Kind CalendarTime
    forall a. Kind a
    base
        getCopy :: Contained (Get CalendarTime)
    getCopy   = Get CalendarTime -> Contained (Get CalendarTime)
    forall a. a -> Contained a
    contain (Get CalendarTime -> Contained (Get CalendarTime))
    -> Get CalendarTime -> Contained (Get CalendarTime)
    forall a b. (a -> b) -> a -> b
    $ do year   <- Get Int
    forall t. Serialize t => Get t
    get
                                 month  <- safeGet
                                 day    <- get
                                 hour   <- get
                                 mins   <- get
                                 sec    <- get
                                 pico   <- get
                                 wday   <- safeGet
                                 yday   <- get
                                 tzname <- safeGet
                                 tz     <- get
                                 dst    <- get
                                 return (CalendarTime year month day hour mins sec pico wday yday tzname tz dst)
        putCopy :: CalendarTime -> Contained Put
    putCopy CalendarTime
    t = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctYear CalendarTime
    t)
                                 Month -> Put
    forall a. SafeCopy a => a -> Put
    safePut (CalendarTime -> Month
    ctMonth CalendarTime
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctDay CalendarTime
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctHour CalendarTime
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctMin CalendarTime
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctSec CalendarTime
    t)
                                 Integer -> Put
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Integer
    ctPicosec CalendarTime
    t)
                                 Day -> Put
    forall a. SafeCopy a => a -> Put
    safePut (CalendarTime -> Day
    ctWDay CalendarTime
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctYDay CalendarTime
    t)
                                 String -> Put
    forall a. SafeCopy a => a -> Put
    safePut (CalendarTime -> String
    ctTZName CalendarTime
    t)
                                 Putter Int
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Int
    ctTZ CalendarTime
    t)
                                 Putter Bool
    forall t. Serialize t => Putter t
    put     (CalendarTime -> Bool
    ctIsDST CalendarTime
    t)

    typeName :: Typeable a => Proxy a -> String
    typeName :: forall a. Typeable a => Proxy a -> String
    typeName Proxy a
    proxy = TypeRep -> String
    forall a. Show a => a -> String
    show (a -> TypeRep
    forall a. Typeable a => a -> TypeRep
    typeOf (a
    forall a. HasCallStack => a
    undefined a -> Proxy a -> a
    forall a. a -> Proxy a -> a
    `asProxyType` Proxy a
    proxy))

    #if MIN_VERSION_base(4,10,0)
    typeName1 :: (Typeable c) => Proxy (c a) -> String
    typeName2 :: (Typeable c) => Proxy (c a b) -> String
    #else
    typeName1 :: (Typeable1 c) => Proxy (c a) -> String
    typeName2 :: (Typeable2 c) => Proxy (c a b) -> String
    #endif

    typeName1 :: forall (c :: * -> *) a. Typeable c => Proxy (c a) -> String
    typeName1 Proxy (c a)
    proxy = TypeRep -> String
    forall a. Show a => a -> String
    show (c a -> TypeRep
    forall (t :: * -> *) a. Typeable t => t a -> TypeRep
    typeOf1 (c a
    forall a. HasCallStack => a
    undefined c a -> Proxy (c a) -> c a
    forall a. a -> Proxy a -> a
    `asProxyType` Proxy (c a)
    proxy))
    typeName2 :: forall (c :: * -> * -> *) a b.
    Typeable c =>
    Proxy (c a b) -> String
    typeName2 Proxy (c a b)
    proxy = TypeRep -> String
    forall a. Show a => a -> String
    show (c a b -> TypeRep
    forall (t :: * -> * -> *) a b. Typeable t => t a b -> TypeRep
    typeOf2 (c a b
    forall a. HasCallStack => a
    undefined c a b -> Proxy (c a b) -> c a b
    forall a. a -> Proxy a -> a
    `asProxyType` Proxy (c a b)
    proxy))

    getGenericVector :: (SafeCopy a, VG.Vector v a) => Contained (Get (v a))
    getGenericVector :: forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    Contained (Get (v a))
    getGenericVector = Get (v a) -> Contained (Get (v a))
    forall a. a -> Contained a
    contain (Get (v a) -> Contained (Get (v a)))
    -> Get (v a) -> Contained (Get (v a))
    forall a b. (a -> b) -> a -> b
    $ do n <- Get Int
    forall t. Serialize t => Get t
    get
                                    getSafeGet >>= VG.replicateM n

    putGenericVector :: (SafeCopy a, VG.Vector v a) => v a -> Contained Put
    putGenericVector :: forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    v a -> Contained Put
    putGenericVector v a
    v = Put -> Contained Put
    forall a. a -> Contained a
    contain (Put -> Contained Put) -> Put -> Contained Put
    forall a b. (a -> b) -> a -> b
    $ do Putter Int
    forall t. Serialize t => Putter t
    put (v a -> Int
    forall (v :: * -> *) a. Vector v a => v a -> Int
    VG.length v a
    v)
                                      PutM (a -> Put)
    forall a. SafeCopy a => PutM (a -> Put)
    getSafePut PutM (a -> Put) -> ((a -> Put) -> Put) -> Put
    forall a b. PutM a -> (a -> PutM b) -> PutM b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= v a -> (a -> Put) -> Put
    forall (m :: * -> *) (v :: * -> *) a b.
    (Monad m, Vector v a) =>
    v a -> (a -> m b) -> m ()
    VG.forM_ v a
    v

    instance SafeCopy a => SafeCopy (V.Vector a) where
        getCopy :: Contained (Get (Vector a))
    getCopy = Contained (Get (Vector a))
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    Contained (Get (v a))
    getGenericVector
        putCopy :: Vector a -> Contained Put
    putCopy = Vector a -> Contained Put
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    v a -> Contained Put
    putGenericVector

    instance (SafeCopy a, VP.Prim a) => SafeCopy (VP.Vector a) where
        getCopy :: Contained (Get (Vector a))
    getCopy = Contained (Get (Vector a))
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    Contained (Get (v a))
    getGenericVector
        putCopy :: Vector a -> Contained Put
    putCopy = Vector a -> Contained Put
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    v a -> Contained Put
    putGenericVector

    instance (SafeCopy a, VS.Storable a) => SafeCopy (VS.Vector a) where
        getCopy :: Contained (Get (Vector a))
    getCopy = Contained (Get (Vector a))
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    Contained (Get (v a))
    getGenericVector
        putCopy :: Vector a -> Contained Put
    putCopy = Vector a -> Contained Put
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    v a -> Contained Put
    putGenericVector

    instance (SafeCopy a, VU.Unbox a) => SafeCopy (VU.Vector a) where
        getCopy :: Contained (Get (Vector a))
    getCopy = Contained (Get (Vector a))
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    Contained (Get (v a))
    getGenericVector
        putCopy :: Vector a -> Contained Put
    putCopy = Vector a -> Contained Put
    forall a (v :: * -> *).
    (SafeCopy a, Vector v a) =>
    v a -> Contained Put
    putGenericVector