-
Iustin Pop authored
This is the first part of the changes related to the 'Container' type. We currently handle this type as follows: it's a simple type alias over the Data.Map type, which means: - it's easy to use the Data.Map functions to change the type - however, since Data.Map already has a JSON instance, we have to very carefully always use custom show/read routines to handle this type The second point leads to potential bugs which are not caught by the type system, so let's improve the situation by making it a proper newtype, which can have its own JSON instance (with our desired behaviour). Once we do this change, accessing the type requires an extra function call, but it's as safe as before. On the positive side, we can use the implicit read/show JSON, which means we can remove (in the next patch) the "container" special casing. The patch also moves the type to outside of THH, since not all users of this will want to import that (as opposed to JSON.hs, which is smaller). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Agata Murawska <agatamurawska@google.com>
84835174