toddmohney / json-api

Haskell Implementation of the JSON-API specification
http://hackage.haskell.org/package/json-api
MIT License
35 stars 14 forks source link

Add ability to specify document data field being single or array explicitly #28

Closed iand675 closed 7 years ago

iand675 commented 7 years ago

@toddmohney

Fixes #27

I'm open to other approaches to extending the interface if you don't like the approach I took.

toddmohney commented 7 years ago

@iand675 this looks good. Mind adding a test to confirm the JSON structure? Looks like I had been meaning to get around to that which would have caught this problem sooner :wink: https://github.com/toddmohney/json-api/blob/master/test/Network/JSONApi/DocumentSpec.hs#L23

yuliswe commented 7 years ago

Shall we rename the functions to something more intuitive? The convention in Haskell of suffixing a function with ' means the function is strict.

toddmohney commented 7 years ago

@YLiLarry hmm... I think agree with the current interface.

My understanding of the prime function convention is not that the function is strict, but that the prime indicates that the function is closely related to, often derivative of another function.

In this case mkDocument is implemented in terms of mkDocument' which is how I would expect things to work.