anchor.diff:               |> List.iter (fun t ->
                   if ruleSet.cache.rules.ContainsKey t |> not then
                     ruleSet.cache.rules.Add (t, rulesOf o t))
  -             let rules =
  -               tys
  -               |> List.fold (fun r t -> HashEqSet.add t r) ruleSet.rules
  -             let tree =
  -               match ruleSet.cache.trees.TryGetValue rules with
  -                | (true, tree) -> tree
  -                | (false, _) ->
  -                  let tree =
  -                    lazy (rules
  -                          |> HashEqSet.toSeq
  -                          |> Seq.collect (fun t ->
  -                             ruleSet.cache.rules.[t]
  -                             |> Seq.map (fun rule -> (rule.ReturnType, rule)))
  -                          |> TyTree.build
  -                          |> force)
  -                  ruleSet.cache.trees.Add (rules, tree)
  -                  tree
  -             {ruleSet with rules = rules; tree = tree}
  -
  -  let rulesFor (ruleSet: RuleSet) (desiredTy: Ty<_>) = seq {
  -    yield! TyTree.filter ruleSet.tree desiredTy
  -    match Ty.toMonoType desiredTy with
  -     | None -> ()
  -     | Some t ->
  -       if not t.IsAbstract then
  -         match t.GetConstructor [||] with
  -          | null -> ()
  -          | _ ->
  -            let t = if t.IsGenericType then t.GetGenericTypeDefinition() else t
  -            let returnType = Ty.ofType t
  -            let genArgs =
  -              lazy if t.IsGenericType
  -                   then t.GetGenericArguments () |> Array.map Ty.ofType
  -                   else [||]
  -            yield {new Rule<_> with
  -                    member this.ReturnType = returnType
  -                    member this.ParTypes = [||]
  -                    member this.GenericArgTypes = genArgs.Force ()
  -                    member this.Invoke (genArgTys: array<Type>,
  -                                        argTys: array<Type>,
  -                                        _: array<obj>) =
  -                     (if t.IsGenericType
  -                      then t.GetGenericTypeDefinition().MakeGenericType(genArgTys)
  -                      else t).GetConstructor([||]).Invoke [||] |> Some}
  -  }
  +             addRules tys ruleSet
  +
  +  let rulesFor (ruleSet: RuleSet) (desiredTy: Ty<_>) =
  +    TyTree.filter ruleSet.tree desiredTy
   
   ////////////////////////////////////////////////////////////////////////////////
   
  
positive.code:               trees = Dictionary<_, _> ()}
       rules = HashEqSet.empty
       tree = TyTree.build []}
  
    let maybeAddRulesObj (o: obj) ruleSet =
      match o with
  
negative.code:        | e -> raise <| Exception ("Rule raised an exception.", e)
  
  module RuleSet =
    type Rules<'x> = Rules'1
    let rulesTy t = typedefof<Rules<_>>.MakeGenericType [|t|]
    let tyOfRulesTy (t: Type) =
      if not t.IsGenericType ||
         t.GetGenericTypeDefinition () <> typedefof<Rules<_>>
      then failwith "Bug"
      else t.GetGenericArguments().[0]
  
    type Cache =
      {rules: Dictionary<Type, array<Rule<Type>>>
       trees: Dictionary<HashEqSet<Type>, TyTree<Rule<Type>>>}
  