anchor.diff:                        then t.GetGenericTypeDefinition().MakeGenericType(genArgTys)
                         else t).GetConstructor([||]).Invoke [||] |> Some}
     }
  -
  -  let maybeAddRules (o: obj) (infRuleSet: RuleSet) =
  -    match o with
  -     | null ->
  -       infRuleSet
  -     | o ->
  -       if o.GetType () |> getInferenceRules |> Option.isSome
  -          && HashEqMap.tryFind o infRuleSet |> Option.isNone
  -       then HashEqMap.add o (preprocess o) infRuleSet
  -       else infRuleSet
   
   /////////////////////////////////////////////////////////////////////////
   
  
positive.code:                   | _ -> false) -> None
  
  module RuleSet =
    type RuleSet = HashEqMap<obj, TyTree<Rule<Type>>>
  
    let getInferenceRules (ty: Type) =
      ty.GetCustomAttributes<InferenceRules> true
      |> Seq.tryPick Some
  
    let preprocess infRules =
      let rec collectRules ty =
        match getInferenceRules ty with
         | None -> Seq.empty
         | Some _ ->
           [ty.GetMethods BindingFlags.PublicDeclaredInstance
            |> Seq.map (fun infRule ->
               RuleMethod (infRule, infRules) :> Rule<_>)
            collectRules ty.BaseType]
           |> Seq.concat
      infRules.GetType ()
      |> collectRules
      |> Seq.map (fun rule -> (rule.ReturnType, rule))
      |> TyTree.build
  
    let ofSeq infRules : RuleSet =
      infRules
      |> Seq.fold
          (fun rulesMap rules ->
            HashEqMap.add
             rules
             (preprocess rules)
             rulesMap)
          HashEqMap.empty
  
    let rulesFor (infRuleSet: RuleSet) (desiredTy: Ty<_>) = seq {
      yield! HashEqMap.toSeq infRuleSet
             |> Seq.collect (fun (_, infRulesTree) ->
                TyTree.filter infRulesTree desiredTy)
      match Ty.toMonoType desiredTy with
       | None -> ()
       | Some t ->
  
negative.code: 
    let tryGenerate (rules: obj) : option<'a> =
      let desTy = typeof<'a> |> Ty.ofType |> mapVars (Fresh.newMapper ())
      let rules = RuleSet.maybeAddRules rules RuleSet.empty
      seq {1 .. Int32.MaxValue}
      |> Seq.tryPick (fun limit ->
         tryGenerate' limit rules HashEqMap.empty HashEqMap.empty [] desTy
  