-
Notifications
You must be signed in to change notification settings - Fork 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
Rework underlying API for encoding/decoding #72
Comments
If we're going to have a fromJson CE (not a bad idea) would it make sense to introduce a toJson CE as well? The json CE would probably remain as a more "general" CE perhaps... |
Yeah. I've just been re-looking at the |
The |
Right. I can see that. Maybe I just haven't had a use case for doing reading during a |
Ok, I can see a reason for the |
Yeah that sounds about right. Your point about reading in a ToJson or writing in a FromJson is completely valid - optics are just general like that. It'll be interesting to see how it works out - I can see ending up with two special case CEs and a general "work with JSON" CE - that might not be a bad thing (I don't tend to use the CEs anyway, but I know they are used). Saying that does raise one issue in my head. At the moment there's only one type signature for all operations. Breaking that down in to multiple may make the maintenance of operators more complex - you would potentially introduce a requirement to have separate operators for each type. One way round that might be statically resolved operators, but it remains to be seen... |
The current primary interface for using Chiron is based around functions which use statically-resolved type parameters (SRTP). This API should remain in place, but it should instead be based on an API that doesn't rely on SRTP.
type Decoder<'a> = Json -> JsonResult<'a>
type Encoder<'a> = 'a -> Json -> Json
ToJsonDefaults
andFromJsonDefaults
into functions underEncode
andDecode
modules, respectivelyDecoder<'a>
Encoder<'a>
fromJson {}
computation expression, adapted fromjson {}
toJson {}
computation expression.The text was updated successfully, but these errors were encountered: