Skip to content

Use types to make interface more explicit #1

Description

@thoferon

Some feedback I received:

[...] possibly some type aliases / newtype wrappers would make the code more readable I think, take

data StreamFamily streamId eventId metadata event = StreamFamily
{ connectionPool :: forall a. (PG.Connection -> IO a) -> IO a
, relation :: PG.Query
, notificationChannel :: PG.Query
, parseNotification :: BS.ByteString -> Either String (streamId, eventId)
, streamIdentifierColumn :: PG.Query
, eventIdentifierColumn :: PG.Query
, metadataColumns :: [PG.Query]
, eventColumn :: PG.Query
}

all those PG.Query don't give much info, you need to look at the selector to understand their use (disclaimer: I like to look at type name more than anything else so I'm biased here). eventColumn maybe can be a bit clearer e.g. eventDataColumn / dataColumn or the likes?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions