You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 text was updated successfully, but these errors were encountered:
The two functions are used to parse types with the
Read
instance fromString
. 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:
String
ToString
Both approaches have benefits and drawbacks:
String
is more beginner-friendly and less surprises forrelude
users,ToString
is 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/String
where we can put more polymorphic functions, including the ones proposed in #161.The text was updated successfully, but these errors were encountered: