Skip to content

Simplify 'Codec' abstraction #263

@chshersh

Description

@chshersh

Currently, we have the following Codec abstract data type:

data Codec r w c a = Codec
    { codecRead :: r a
    , codecWrite :: c -> w a
    }

But in this library it's used only for TomlCodec:

type TomlCodec a = Codec Env St a a

It could be a good simplification to combine two and have

data Codec in out = Codec
    { codecRead :: TomlEnv out
    , codecWrite :: in -> TomlState out
    }

type TomlCodec a = Codec a a

What do you think? With this approach, we can have a single module Toml.Codec with all general functions, encoding and decoding functions instead of two modules Toml.Monad and Toml.Code

Metadata

Metadata

Assignees

Labels

codecConversion between TOML and custom user data typesrefactoring

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions