anchor.diff:        match (SS.compress (f_b |> fst).sort).n with
         | Tm_app (_, _::is) ->
           is |> List.map fst |> List.map (SS.subst substs)
  -      | _ -> failwith "Impossible!" in  //AR: TODO: FIXME: raise error
  +      | _ -> raise_error (conjunction_t_error "f's type is not a repr type") r in
       List.fold_left2
         (fun g i1 f_i -> Env.conj_guard g (Rel.teq env i1 f_i))
         Env.trivial_guard is1 f_sort_is in
  
positive.code:  * Then we substitute [a/c1_a; b/c2_a] in <some binders>
   *
   * Next we create ?u1 ... ?un for each of the binders in <some binders>
   *   while subtituting [bi/?ui] in subsequent binders (so that their sorts are well-typed)
   *
   * Let substs = [a/c1_a; b/c2_a; bi/?ui]
   *
  
negative.code: 
  let fvar_const env lid =  S.fvar (Ident.set_lid_range lid (Env.get_range env)) delta_constant None
  
  
  (*
   * Conjunction combinator for layered effects
   *
   * let ct1 = M a (t1...tn)
   *     ct2 = M a (s1...sn)
   *
   *     M.conjunction = fun (a_b:Type) ..<some binders>.. (f:repr a i1...in) (g:repr a j1...jn) (p_b:Type0) -> repr a k1...n
   *
   * First we instantiate M.conjunction with [u_a]
   *
   * Then we create uvars ?u1..?un for each of the binders in <some binder>
   *   while substituting [a_b/a] and [bi/?ui] in subsequent binders (handled by Env.uvars_for_binders)
   *
   * let substs = [a_b/a; bi/?ui; p_b/p]
   *
   * let i_i = i_i[substs]
   * let j_i = i_i[substs]
   * let k_i = i_i[substs]
   *
   * Unify i_i with t_i (where t_i are the indices of ct1)
   * Unify j_i with s_i (where t_i are the indices of ct2)
   * 
   * And return k_i
   *)
  let mk_layered_conjunction env (ed:S.eff_decl) (u_a:universe) (a:term) (p:typ) (ct1:comp_typ) (ct2:comp_typ) (r:Range.range)
  : comp * guard_t =
  
    let _, conjunction = Env.inst_tscheme_with (ed.match_wps |> right).conjunction [u_a] in
    let is1, is2 = List.map fst ct1.effect_args, List.map fst ct2.effect_args in
  
    let conjunction_t_error (s:string) =
      (Errors.Fatal_UnexpectedEffect, BU.format2
        "conjunction %s does not have proper shape (reason:%s)"
        (Print.term_to_string conjunction) s) in
  
    let a_b, rest_bs, f_b, g_b, p_b, body =
      match (SS.compress conjunction).n with
      | Tm_abs (bs, body, _) when List.length bs >= 4 ->
        let (a_b::bs), body = SS.open_term bs body in
        let rest_bs, (f_b::g_b::p_b::[]) = List.splitAt (List.length bs - 3) bs in
        a_b, rest_bs, f_b, g_b, p_b, body |> U.unascribe
      | _ -> raise_error (conjunction_t_error "Either not an abstraction or not enough binders") r in
  
    let rest_bs_uvars, g_uvars = Env.uvars_for_binders
      env rest_bs [NT (a_b |> fst, a)]
      (fun b -> BU.format3
        "implicit var for binder %s of %s:conjunction at %s"
        (Print.binder_to_string b) (Ident.string_of_lid ed.mname)
        (r |> Range.string_of_range)) r in
  
    let substs = List.map2
      (fun b t -> NT (b |> fst, t))
  