Support different de/serialization strategies
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- haskell
- Domain
- distributed-systems
Research direction
Start by reading the current Process abstraction and the send entry point to understand how Binary-based serialization is wired. Compare that API with the proposed Serialize strategy and Servant's MimeRender/MimeUnrender; done would mean agreeing on the abstraction and updating the affected types and examples without breaking serialization-agnostic programs.
Written by the indexing model from the issue text.
Description
Currently, all messages are de/serialized via the Binary instance.
This is an implementation detail; there is strict required beyond the existence of two functions, encode :: a -> ByteString and decode :: ByteString -> Either String a. However, discussions in the DataHaskell group have raised the point that serialization for data science structures (e.g. dataframes) could be made more efficient by leveraging Parquet over the wire.
I'm thinking of an extension of the current Process monad, to support also a de/serialization strategy. This is strongly inspired by Servant's MimeRender and MimeUnrender classes. Consider:
newtype Process strategy a = Process ... -- Monad is unchanged, type has a new `strategy`
class Serialize strategy a where
encode :: Proxy strategy -> a -> ByteString
decode :: Proxy strategy -> ByteString -> Either String a
An example for JSON would be:
import Data.Aeson
data JSON
class (ToJSON a, FromJSON a) => Serialize JSON a where
encode _ = encode
decode _ = eitherDecodeStrict
Then, for the actual message sending e.g. via send, the type would become:
send :: Serialize strategy a => ProcessId -> a -> Process strategy ()
Then, programs that are agnostic of serialization are of type Process strategy a (instead of Process a), while programs which require a specific serialization method, such as JSON, will be of type Process JSON a.
- Dominant language
- Haskell
- Stars
- 751
- Forks
- 99
- Avg merge
- 45m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haskell-distributed/distributed-process
-
enhancement Feature Request
Difficulty 5/5 Over a week Newbie friendliness 25/100
haskell-distributed/distributed-process#486 · 1 comment · 1 reaction ·
-
enhancement Feature Request
Difficulty 5/5 Over a week Newbie friendliness 15/100
haskell-distributed/distributed-process#476 · 2 reactions ·
-
enhancement Feature Request
haskell-distributed/distributed-process#475 · 3 reactions · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
haskell-distributed/distributed-process#473 · 4 comments · 1 reaction ·
-
enhancement network-transport-tcp newcomer
Difficulty 3/5 1-2 days Newbie friendliness 25/100
All issues in haskell-distributed/distributed-process
Similar issues
-
time-manager-0.4.0 Openfailure: bounds
Difficulty 1/5 Under an hour Newbie friendliness 72/100
commercialhaskell/stackage#8122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
simplex-chat/simplex-chat#7547 ·
-
chore
Difficulty 1/5 Under an hour Newbie friendliness 90/100
alunduil/alunduil-chezmoi#775 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
objectionary/phino#1350 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100