-
Notifications
You must be signed in to change notification settings - Fork 42
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
Prepare for 2.0 release #46
Conversation
Figured I may as well add the general |
Looks good, but let's discuss the use of |
I did start looking at that, but it wasn't really obvious to me how you'd actually get more than one failure out of the "parsing" anyway? |
Using |
i.e. using the |
Ok, sounds good to me. I take it we don't need the list in |
I think we could get rid of that, since that's more of an error message rendering problem, right? |
Yeah, exactly |
@@ -16,7 +16,7 @@ foreign import unsafeKeys :: Foreign -> Array String | |||
-- | Get an array of the properties defined on a foreign value | |||
keys :: Foreign -> F (Array String) | |||
keys value | |||
| isNull value = Left $ TypeMismatch (NE.singleton "object") "null" | |||
| isUndefined value = Left $ TypeMismatch (NE.singleton "object") "undefined" | |||
| isNull value = Left $ NE.singleton $ TypeMismatch "object" "null" |
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.
It might be worth extracting Left <<< NE.singleton <<< TypeMismatch
into a function here.
-- | dealing with foreign data. | ||
type F = Either ForeignError | ||
type F = Either (NE.NonEmpty List ForeignError) |
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.
Can this use Except
so that we get the right Alt
instance?
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.
Ah right, I was trying to avoid adding the -transformers
dependency, but yep, good point.
👍 Thanks for this. |
Maybe the |
Could we add it in |
Something like |
Never mind, I'm not sure what I was thinking. I think having a |
Yeah, it's fine here, just it seems like something that I'll want to use commonly with |
I could just make a new library for it I guess. |
Could it go into |
Yeah, I'll do that. |
What about leaving the type here for now, hiding its constructor and adding non-empty lists into |
Done at last I think! |
👍 Thanks, looks great! |
Resolves #37, resolves #41