@@ -559,7 +559,7 @@ def _haskell_cabal_library_impl(ctx):
559559
560560 (_ , runghc_manifest ) = ctx .resolve_tools (tools = [ctx .attr ._runghc ])
561561 json_args = ctx .actions .declare_file ("{}_cabal_wrapper_args.json" .format (ctx .label .name ))
562- ctx .actions .write (json_args , c .args . to_json ( ))
562+ ctx .actions .write (json_args , json . encode ( c .args ))
563563 ctx .actions .run (
564564 executable = c .cabal_wrapper ,
565565 arguments = [json_args .path ],
@@ -861,7 +861,7 @@ def _haskell_cabal_binary_impl(ctx):
861861 )
862862 (_ , runghc_manifest ) = ctx .resolve_tools (tools = [ctx .attr ._runghc ])
863863 json_args = ctx .actions .declare_file ("{}_cabal_wrapper_args.json" .format (ctx .label .name ))
864- ctx .actions .write (json_args , c .args . to_json ( ))
864+ ctx .actions .write (json_args , json . encode ( c .args ))
865865 ctx .actions .run (
866866 executable = c .cabal_wrapper ,
867867 arguments = [json_args .path ],
@@ -1291,7 +1291,7 @@ library
12911291 )
12921292
12931293 # Create a stack.yaml capturing user overrides to the snapshot.
1294- stack_yaml_content = struct (** {
1294+ stack_yaml_content = json . encode ( struct (** {
12951295 "resolver" : str (snapshot ),
12961296 "packages" : [resolve_package ] + core_packages + [
12971297 # Determines path to vendored package's root directory relative to
@@ -1311,7 +1311,7 @@ library
13111311 ])
13121312 for (pkg , flags ) in repository_ctx .attr .flags .items ()
13131313 },
1314- }). to_json ( )
1314+ }))
13151315 repository_ctx .file ("stack.yaml" , content = stack_yaml_content , executable = False )
13161316
13171317 # We declared core packages as local packages in stack.yaml for two reasons.
@@ -1679,7 +1679,7 @@ def _write_snapshot_json(repository_ctx, all_cabal_hashes, resolved):
16791679 "__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY" : checksum ,
16801680 "all-cabal-hashes" : repr (all_cabal_hashes ),
16811681 "resolved" : _pretty_print_kvs (1 , {
1682- name : struct (** spec ). to_json ( )
1682+ name : json . encode ( struct (** spec ))
16831683 for (name , spec ) in resolved .items ()
16841684 }),
16851685 }),
0 commit comments