Skip to content

Add buildListForResponseCoerce #23

@gromakovsky

Description

@gromakovsky

Sometimes response type to an endpoint is a list wrapped into newtype. If you want to use buildListForResponse you need to write something like this:

instance Buildable (ForResponseLog FileSummary) where
  build (ForResponseLog (FileSummary items)) =
    buildListForResponse (take 5) (ForResponseLog items)

I think we can define a version of buildListForResponse that takes ForResponseLog a such that a is coercible to [x]. Maybe we don't even need a separate function for that and can generalize buildListForResponse because [x] is coercible to [x]. Or maybe we can generalize it somehow differently so support other data types such as Vector. Or maybe this case is not so frequent and we don't to generalize anything 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions