samisagit / natskell

A NATS client library written in Haskell
MIT License
7 stars 0 forks source link

Refactor parsers #60

Closed samisagit closed 2 years ago

samisagit commented 2 years ago

Spike MR: #59

In order for NATS messages to be handled generically all parsers need to return the same type. A new type should be created for each, specifying wrapper/payload type constructor options for each parser.

In order to do this all parser functions must be in the same module so the proposal is to move all the types into a module of src/Types/Xyz.hs. parsers into src/Parsers.hs and transformers into src/Transformers.hs. This will allow the parsers to be self contained and the transformers to be self contained and avoid any cyclical imports.

At that point the client should be able to call a generic parse function against an incoming message and pattern match the result to decide what to do with it, as well as having access to the data.