The two functions are used to parse types with the Read instance from String. However, they have a slightly different type (one is more polymorphic than the other):
readMaybe :: Read a => String -> Maybe a
readEither :: (ToString a, Read b) => a -> Either Text b
I think this difference in behaviour can be surprising for some users. So I propose to chose one of the following options:
- Both work with monomorphic
String
- Both work with polymorphic
ToString
Both approaches have benefits and drawbacks: String is more beginner-friendly and less surprises for relude users, ToString is more flexible and convenient.
My initial thought is that both functions should work with String, and we can have a module like Relude.Extra.Parse/Read/String where we can put more polymorphic functions, including the ones proposed in #161.
The two functions are used to parse types with the
Readinstance fromString. However, they have a slightly different type (one is more polymorphic than the other):readMaybe :: Read a => String -> Maybe areadEither :: (ToString a, Read b) => a -> Either Text bI think this difference in behaviour can be surprising for some users. So I propose to chose one of the following options:
StringToStringBoth approaches have benefits and drawbacks:
Stringis more beginner-friendly and less surprises forreludeusers,ToStringis more flexible and convenient.My initial thought is that both functions should work with
String, and we can have a module likeRelude.Extra.Parse/Read/Stringwhere we can put more polymorphic functions, including the ones proposed in #161.