anchor.diff:          (Print.term_to_string i.ityp)
           (i.idatas |> List.map (fun d -> Print.lid_to_string d.dname ^ " : " ^ Print.term_to_string d.dtyp) |> String.concat "\n\t\t")
   
  -let bundle_as_inductive_families env ses quals : list<inductive_family> =
  -    ses |> List.collect
  -        (fun se -> match se.sigel with
  +let bundle_as_inductive_families env ses quals : env * list<inductive_family> =
  +    let env, ifams =
  +        BU.fold_map
  +        (fun env se -> match se.sigel with
               | Sig_inductive_typ(l, _us, bs, t, _mut_i, datas) ->
                   let bs, t = SS.open_term bs t in
                   let datas = ses |> List.collect (fun se -> match se.sigel with
  
positive.code:              MLTD_Record fields
           | _ ->
               MLTD_DType ctors in
          let env = UEnv.extend_type_name env (S.lid_as_fv ind.iname Delta_constant None) in
          env,  (false, lident_as_mlsymbol ind.iname, None, ml_params, Some tbody) in
  
      match se.sigel, se.sigquals with
  
negative.code:           env, [MLM_Exn ctor]
  
          | Sig_bundle(ses, _), quals ->
            let env, ifams = bundle_as_inductive_families env ses quals in
  //          ifams |> List.iter print_ifamily;
            let env, td = BU.fold_map extract_one_family env ifams in
            env, [MLM_Ty td]
  