-
Notifications
You must be signed in to change notification settings - Fork 41
Update TypeMismatch for multiple possible types. #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
show (ErrorAtIndex i e) = "Error at array index " <> show i <> ": " <> show e | ||
show (ErrorAtProperty prop e) = "Error at property " <> show prop <> ": " <> show e | ||
show (JSONError s) = "JSON error: " <> s | ||
show (TypeMismatch exps act) = "Type mismatch: expected " <> to_s exps <> ", found " <> act | ||
where | ||
to_s [] = "???" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to use a non-empty array, for this reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but just to say, purescript-nonempty
is in contrib currently and this is core.
Thanks! |
An alternative here is to move the non-empty array to the outer level: type F = Either (NonEmpty ForeignError) We probably don't want a dependency on any non core library for |
I can see the value of adding What are the requirements for a package to be in core vs contrib? |
The |
Yea I just did the easy thing first since I wasn't sure if I'll continue ahead with it if you don't think it'll be a problem and see how far I can get with the suggestion above with moving the dependency to the outer level. |
Played around with using The last commit on each is with Some notes: |
Per comment in paf31/purescript-foreign-generic#11