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 |
| 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.
It might be worth extracting Left <<< NE.singleton <<< TypeMismatch into a function here.
| -- | An error monad, used in this library to encode possible failures when | ||
| -- | dealing with foreign data. | ||
| type F = Either ForeignError | ||
| type F = Either (NE.NonEmpty List ForeignError) |
There was a problem hiding this comment.
Can this use Except so that we get the right Alt instance?
There was a problem hiding this comment.
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