@@ -0,0 +1,54 @@
1+{-# LANGUAGE TemplateHaskell #-}
3+-- This is required as all the instances in this module are orphan instances.
4+{-# OPTIONS_GHC -fno-warn-orphans #-}
7+-- Module : Streamly.Internal.Data.Serialize
8+-- Copyright : (c) 2023 Composewell Technologies
9+-- License : BSD3-3-Clause
10+-- Maintainer : streamly@composewell.com
14+module Streamly.Internal.Data.Serialize
15+ ( module Streamly.Internal.Data.Serialize.Type
18+--------------------------------------------------------------------------------
20+--------------------------------------------------------------------------------
22+import Data.Proxy (Proxy)
23+import Streamly.Internal.Data.Serialize.Type
24+import qualified Streamly.Internal.Data.Serialize.TH as Serialize
26+--------------------------------------------------------------------------------
28+--------------------------------------------------------------------------------
33+-- Even a non-functional change such as changing the order of constructors will
34+-- change the instance derivation.
36+-- This will not pose a problem if both, encode, and decode are done by the same
37+-- version of the application. There *might* be a problem if version that
38+-- encodes differs from the version that decodes.
40+-- We need to add some compatibility tests using different versions of
43+-- Although such chages for the most basic types won't happen we need to detect
44+-- if it ever happens.
46+-- Should we worry about these kind of changes and this kind of compatibility?
47+-- This is a problem for all types of derivations that depend on the order of
48+-- constructors, for example, Enum.
50+$(Serialize.deriveSerialize ''Maybe)
51+$(Serialize.deriveSerialize ''Either)
52+$(Serialize.deriveSerializeWith
53+ (Serialize.defaultConfig {Serialize.unconstrained = ["t"]})