anchor.diff:              System.Activator.CreateInstance(t, tEls)
           | _ -> raise DecoderException
   
  +let setModule =
  +    typeof<Set<_>>.Assembly
  +        .GetType("Microsoft.FSharp.Collections.SetModule")
  +
  +let seqModule =
  +    typeof<Set<_>>.Assembly
  +        .GetType("Microsoft.FSharp.Collections.SeqModule")
  +
  +let makeEmptySetOf (t: System.Type) =
  +    setModule
  +        .GetMethod("Empty")
  +        .MakeGenericMethod(t.GetGenericArguments())
  +        .Invoke(null, [||])
  +
   let setEncoder dE (i: FormatSettings) (t: System.Type) =
       let tg = t.GetGenericArguments()
       if tg.Length <> 1 then raise EncoderException
       let dI = dE tg.[0]
  +    if i.FlattenCollections then
  +        let toSeq =
  +            FastInvoke.Compile(
  +                setModule.GetMethod("ToSeq").MakeGenericMethod(tg)
  +            ).Invoke1
  +        fun (x: obj) ->
  +            EncodedArray [for e in Seq.cast<obj> (toSeq x :?> _) -> dI e]
  +    else
       let treeF = t.GetFields(fieldFlags) |> Array.find (fun f -> f.Name.StartsWith "tree")
       let tR = FSV.PreComputeUnionTagReader(treeF.FieldType, flags)
       let uR =
  
positive.code:                     | true, x -> Some (epoch + System.TimeSpan.FromMilliseconds x)
                      | _ -> None
                  | _ -> None
              Pack = pack
          }
  
  
negative.code:                     | _ -> ()
              }
          match x with
          | Null -> empty
          | Object [ "tree", Object tr ] ->
              ofSeq (seqCast (walk tr))
          | _ -> raise DecoderException
  
  let enumEncoder dE (i: FormatSettings) (t: System.Type) =
  