-
-
Notifications
You must be signed in to change notification settings - Fork 419
Closed
Description
Background
Currently, the Scheme type in this package derives Show, but not Read.
As a result, it’s not possible to parse a Scheme value directly from a string using the standard Read interface (e.g. read "Http" :: Scheme).
Proposal
I propose adding a deriving (Read) clause to the Scheme data type, so that users can easily reconstruct Scheme values from textual representations.
Example:
data Scheme = Http | Https
deriving (Eq, Show, Read)Rationale
- Improves consistency with other simple enumerations that derive both
ShowandRead. - Enables convenient usage in debugging, testing, and serialization scenarios.
- The generated instance will match the existing constructor names (
"Http","Https"), which keeps it predictable.
Alternatives
- Keep as-is and let users define their own
Readinstance if needed. - Provide a custom parser instead of a
Readinstance.
Questions for Discussion
- Would adding
deriving (Read)be acceptable given backward compatibility expectations? - Should the
Readinstance be case-sensitive (default) or should we consider a custom, case-insensitive one?
If there’s consensus, I can prepare a small PR adding the Read derivation.
Metadata
Metadata
Assignees
Labels
No labels