mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 11:37:22 +03:00
Re-add Streamly.Serialize and fix cyclic dependency
This commit is contained in:
parent
41dcc9c9f0
commit
b5667ae59f
54
core/src/Streamly/Internal/Data/Serialize.hs
Normal file
54
core/src/Streamly/Internal/Data/Serialize.hs
Normal file
@ -0,0 +1,54 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- This is required as all the instances in this module are orphan instances.
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- |
|
||||
-- Module : Streamly.Internal.Data.Serialize
|
||||
-- Copyright : (c) 2023 Composewell Technologies
|
||||
-- License : BSD3-3-Clause
|
||||
-- Maintainer : streamly@composewell.com
|
||||
-- Portability : GHC
|
||||
--
|
||||
|
||||
module Streamly.Internal.Data.Serialize
|
||||
( module Streamly.Internal.Data.Serialize.Type
|
||||
) where
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Imports
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
import Data.Proxy (Proxy)
|
||||
import Streamly.Internal.Data.Serialize.Type
|
||||
import qualified Streamly.Internal.Data.Serialize.TH as Serialize
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Common instances
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Note
|
||||
-- ====
|
||||
--
|
||||
-- Even a non-functional change such as changing the order of constructors will
|
||||
-- change the instance derivation.
|
||||
--
|
||||
-- This will not pose a problem if both, encode, and decode are done by the same
|
||||
-- version of the application. There *might* be a problem if version that
|
||||
-- encodes differs from the version that decodes.
|
||||
--
|
||||
-- We need to add some compatibility tests using different versions of
|
||||
-- dependencies.
|
||||
--
|
||||
-- Although such chages for the most basic types won't happen we need to detect
|
||||
-- if it ever happens.
|
||||
--
|
||||
-- Should we worry about these kind of changes and this kind of compatibility?
|
||||
-- This is a problem for all types of derivations that depend on the order of
|
||||
-- constructors, for example, Enum.
|
||||
|
||||
$(Serialize.deriveSerialize ''Maybe)
|
||||
$(Serialize.deriveSerialize ''Either)
|
||||
$(Serialize.deriveSerializeWith
|
||||
(Serialize.defaultConfig {Serialize.unconstrained = ["t"]})
|
||||
''Proxy)
|
@ -27,7 +27,7 @@ import Streamly.Internal.System.IO (unsafeInlineIO)
|
||||
|
||||
import Language.Haskell.TH
|
||||
import Language.Haskell.TH.Syntax
|
||||
import Streamly.Internal.Data.Serialize
|
||||
import Streamly.Internal.Data.Serialize.Type
|
||||
|
||||
import qualified Streamly.Internal.Data.Unbox as Unbox
|
||||
|
||||
|
@ -421,6 +421,8 @@ library
|
||||
|
||||
, Streamly.Internal.Data.Array.Type
|
||||
|
||||
, Streamly.Internal.Data.Serialize.Type
|
||||
|
||||
, Streamly.Internal.Data.Producer.Type
|
||||
, Streamly.Internal.Data.Producer.Source
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user