Skip to content

Improve fromBytes type signature #2

@MartinSStewart

Description

@MartinSStewart

This function should never return Nothing, but it uses Bytes.Decode.decode, which returns a Maybe String.

If this is the case, can't you modify fromBytes to look like this?

fromBytes : Bytes -> String
fromBytes =
    Decode.fromBytes |> Maybe.withDefault ""

The default value will never get used (if it does there's a bug which should be fixed anyway) and the user gets a nicer API to work with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions