anchor.diff:      // tryFindKey
       // tryPick
       // union
  +
  +
  +//
  +[<Sealed>]
  +[<DebuggerTypeProxy(typedefof<IntMapDebuggerProxy<int>>)>]
  +[<DebuggerDisplay("Count = {Count}")>]
  +type IntMap<'T> private (trie : PatriciaMap<'T>) =
  +    /// The empty IntMap.
  +    static member Empty
  +        with get () : IntMap<'T> =
  +            IntMap Empty
  +
  +    /// The number of bindings in the IntMap.
  +    member __.Count
  +        with get () : int =
  +            PatriciaMap.Count trie
  +
  +    /// Is the map empty?
  +    member __.IsEmpty
  +        with get () =
  +            match trie with
  +            | Empty -> true
  +            | _ -> false
  +
  +    /// Look up an element in the IntMap returning a Some value if the
  +    /// element is in the domain of the IntMap and None if not.
  +    member __.TryFind (key : int) : 'T option =
  +        PatriciaMap.TryFind (uint32 key, trie)
  +
  +    /// Look up an element in the IntMap, raising KeyNotFoundException
  +    /// if no binding exists in the IntMap.
  +    member __.Find (key : int) : 'T =
  +        match PatriciaMap.TryFind (uint32 key, trie) with
  +        | Some x -> x
  +        | None ->
  +            // TODO : Add a better error message which includes the key.
  +            raise <| System.Collections.Generic.KeyNotFoundException ()
  +
  +    /// Returns a new IntMap with the binding added to this IntMap.
  +    member __.Add (key : int) (value : 'T) : IntMap<'T> =
  +        IntMap (
  +            PatriciaMap.Insert (uint32 key, value, trie))
  +
  +    /// Removes an element from the domain of the IntMap.
  +    /// No exception is raised if the element is not present.
  +    member __.Remove (key : int) : IntMap<'T> =
  +        IntMap (
  +            PatriciaMap.Remove (uint32 key, trie))
  +
  +    /// Tests if an element is in the domain of the IntMap.
  +    member __.ContainsKey (key : int) : bool =
  +        PatriciaMap.ContainsKey (uint32 key, trie)
  +
  +    /// The IntMap containing the given binding.
  +    static member Singleton (key : int, value : 'T) : IntMap<'T> =
  +        IntMap (
  +            Lf (uint32 key, value))
  +
  +    /// Returns a new IntMap made from the given bindings.
  +    static member OfSeq (source : seq<int * 'T>) : IntMap<'T> =
  +        // Preconditions
  +        checkNonNull "source" source
  +
  +        IntMap (PatriciaMap.OfSeq source)
  +
  +    /// Returns a new IntMap made from the given bindings.
  +    static member OfList (source : (int * 'T) list) : IntMap<'T> =
  +        // Preconditions
  +        checkNonNull "source" source
  +
  +        // OPTIMIZATION : If the source is empty return immediately.
  +        if List.isEmpty source then
  +            IntMap.Empty
  +        else
  +            IntMap (PatriciaMap.OfList source)
  +
  +    /// Returns a new IntMap made from the given bindings.
  +    static member OfArray (source : (int * 'T)[]) : IntMap<'T> =
  +        // Preconditions
  +        checkNonNull "source" source
  +
  +        // OPTIMIZATION : If the source is empty return immediately.
  +        if Array.isEmpty source then
  +            IntMap.Empty
  +        else
  +            IntMap (PatriciaMap.OfArray source)
  +
  +    /// Returns a new IntMap made from the given bindings.
  +    static member OfMap (source : Map<int, 'T>) : IntMap<'T> =
  +        // Preconditions
  +        checkNonNull "source" source
  +
  +        // OPTIMIZATION : If the source is empty return immediately.
  +        if Map.isEmpty source then
  +            IntMap.Empty
  +        else
  +            IntMap (PatriciaMap.OfMap source)
  +
  +    //
  +    member __.ToArray () : (int * 'T)[] =
  +        trie.ToArray ()
  +
  +    //
  +    member internal __.ToKvpArray () : KeyValuePair<int, 'T>[] =
  +        let elements = ResizeArray (1024)
  +
  +        trie.Iterate <| fun key value ->
  +            elements.Add (
  +                KeyValuePair (key, value))
  +
  +        elements.ToArray ()
  +
  +    //
  +    member __.Iterate (action : int -> 'T -> unit) : unit =
  +        trie.Iterate action
  +
  +//
  +and [<Sealed>]
  +    internal IntMapDebuggerProxy<'T> (map : IntMap<'T>) =
  +
  +    [<DebuggerBrowsable(DebuggerBrowsableState.RootHidden)>]
  +    member __.Items
  +        with get () : KeyValuePair<int, 'T>[] =
  +            map.ToKvpArray ()
  +
  +
  +//
  +[<RequireQualifiedAccess; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
  +module IntMap =
  +    /// The empty IntMap.
  +    [<GeneralizableValue>]
  +    [<CompiledName("Empty")>]
  +    let empty<'T> =
  +        IntMap<'T>.Empty
  +
  +    /// Is the map empty?
  +    let inline isEmpty (map : IntMap<'T>) : bool =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.IsEmpty
  +
  +    /// Returns the number of bindings in the IntMap.
  +    let inline count (map : IntMap<'T>) : int =
  +        // Preconditions
  +        checkNonNull "map" map
  +        
  +        map.Count
  +
  +    /// The IntMap containing the given binding.
  +    let inline singleton (key : int) (value : 'T) : IntMap<'T> =
  +        IntMap.Singleton (key, value)
  +
  +    /// Look up an element in the IntMap returning a Some value if the
  +    /// element is in the domain of the IntMap and None if not.
  +    let inline tryFind (key : int) (map : IntMap<'T>) : 'T option =
  +        // Preconditions
  +        checkNonNull "map" map
  +        
  +        map.TryFind key
  +        
  +    //
  +    let inline find (key : int) (map : IntMap<'T>) : 'T =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.Find key
  +
  +    //
  +    let inline add (key : int) (value : 'T) (map : IntMap<'T>) : IntMap<'T> =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.Add key value
  +
  +    //
  +    let inline remove (key : int) (map : IntMap<'T>) : IntMap<'T> =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.Remove key
  +
  +    //
  +    let inline containsKey (key : int) (map : IntMap<'T>) : bool =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.ContainsKey key
  +
  +    //
  +    let inline ofSeq source : IntMap<'T> =
  +        // Preconditions are checked by the member.
  +        IntMap.OfSeq source
  +
  +    //
  +    let inline ofList source : IntMap<'T> =
  +        // Preconditions are checked by the member.
  +        IntMap.OfList source
  +
  +    //
  +    let inline ofArray source : IntMap<'T> =
  +        // Preconditions are checked by the member.
  +        IntMap.OfArray source
  +
  +    //
  +    let inline ofMap source : IntMap<'T> =
  +        // Preconditions are checked by the member.
  +        IntMap.OfMap source
  +
  +    //
  +    let inline toArray (map : IntMap<'T>) =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.ToArray ()
  +
  +    //
  +    let inline iter (action : int -> 'T -> unit) (map : IntMap<'T>) =
  +        // Preconditions
  +        checkNonNull "map" map
  +
  +        map.Iterate action
  +
  +
  +    // TODO
  +    // choose
  +    // exists
  +    // filter
  +    // findKey
  +    // fold, foldBack
  +    // iterBack
  +    // map
  +    // partition
  +    // pick
  +    // toList
  +    // toMap
  +    // toSeq
  +    // tryFindKey
  +    // tryPick
  +    // union
  +
  +
  +(* TODO : Can we just implement TagMap as a measure-annotated IntMap? *)
  +(*
  +[<MeasureAnnotatedAbbreviation>]
  +type TagMap<[<Measure>] 'Tag, 'T> =
  +    IntMap<'T>
  +*)
  +
  
positive.code: 
          elements.ToArray ()
  
  
  //
  [<Sealed>]
  [<DebuggerTypeProxy(typedefof<IntMapDebuggerProxy<int>>)>]
  [<DebuggerDisplay("Count = {Count}")>]
  type IntMap<'T> private (trie : PatriciaMap<'T>) =
      /// The empty IntMap.
      static member Empty
          with get () : IntMap<'T> =
              IntMap Empty
  
      /// The number of bindings in the IntMap.
      member __.Count
          with get () : int =
              PatriciaMap.Count trie
  
      /// Is the map empty?
      member __.IsEmpty
          with get () =
              match trie with
              | Empty -> true
              | _ -> false
  
      /// Look up an element in the IntMap returning a Some value if the
      /// element is in the domain of the IntMap and None if not.
      member __.TryFind (key : int) : 'T option =
          PatriciaMap.TryFind (uint32 key, trie)
  
      /// Look up an element in the IntMap, raising KeyNotFoundException
      /// if no binding exists in the IntMap.
      member __.Find (key : int) : 'T =
          match PatriciaMap.TryFind (uint32 key, trie) with
          | Some x -> x
          | None ->
              // TODO : Add a better error message which includes the key.
              raise <| System.Collections.Generic.KeyNotFoundException ()
  
      /// Returns a new IntMap with the binding added to this IntMap.
      member __.Add (key : int) (value : 'T) : IntMap<'T> =
          IntMap (
              PatriciaMap.Insert (uint32 key, value, trie))
  
      /// Removes an element from the domain of the IntMap.
      /// No exception is raised if the element is not present.
      member __.Remove (key : int) : IntMap<'T> =
          IntMap (
              PatriciaMap.Remove (uint32 key, trie))
  
      /// Tests if an element is in the domain of the IntMap.
      member __.ContainsKey (key : int) : bool =
          PatriciaMap.ContainsKey (uint32 key, trie)
  
      /// The IntMap containing the given binding.
      static member Singleton (key : int, value : 'T) : IntMap<'T> =
          IntMap (
              Lf (uint32 key, value))
  
      /// Returns a new IntMap made from the given bindings.
      static member OfSeq (source : seq<int * 'T>) : IntMap<'T> =
          // Preconditions
          checkNonNull "source" source
  
          IntMap (PatriciaMap.OfSeq source)
  
      /// Returns a new IntMap made from the given bindings.
      static member OfList (source : (int * 'T) list) : IntMap<'T> =
          // Preconditions
          checkNonNull "source" source
  
          // OPTIMIZATION : If the source is empty return immediately.
          if List.isEmpty source then
              IntMap.Empty
          else
              IntMap (PatriciaMap.OfList source)
  
      /// Returns a new IntMap made from the given bindings.
      static member OfArray (source : (int * 'T)[]) : IntMap<'T> =
          // Preconditions
          checkNonNull "source" source
  
          // OPTIMIZATION : If the source is empty return immediately.
          if Array.isEmpty source then
              IntMap.Empty
          else
              IntMap (PatriciaMap.OfArray source)
  
      /// Returns a new IntMap made from the given bindings.
      static member OfMap (source : Map<int, 'T>) : IntMap<'T> =
          // Preconditions
          checkNonNull "source" source
  
          // OPTIMIZATION : If the source is empty return immediately.
          if Map.isEmpty source then
              IntMap.Empty
          else
              IntMap (PatriciaMap.OfMap source)
  
      //
      member __.ToArray () : (int * 'T)[] =
          trie.ToArray ()
  
      //
      member internal __.ToKvpArray () : KeyValuePair<int, 'T>[] =
          let elements = ResizeArray (1024)
  
          trie.Iterate <| fun key value ->
              elements.Add (
                  KeyValuePair (key, value))
  
          elements.ToArray ()
  
      //
      member __.Iterate (action : int -> 'T -> unit) : unit =
          trie.Iterate action
  
  //
  and [<Sealed>]
      internal IntMapDebuggerProxy<'T> (map : IntMap<'T>) =
  
      [<DebuggerBrowsable(DebuggerBrowsableState.RootHidden)>]
      member __.Items
          with get () : KeyValuePair<int, 'T>[] =
              map.ToKvpArray ()
  
  
  //
  [<RequireQualifiedAccess; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
  module IntMap =
      /// The empty IntMap.
      [<GeneralizableValue>]
      [<CompiledName("Empty")>]
      let empty<'T> =
          IntMap<'T>.Empty
  
      /// Is the map empty?
      let inline isEmpty (map : IntMap<'T>) : bool =
          // Preconditions
          checkNonNull "map" map
  
          map.IsEmpty
  
      /// Returns the number of bindings in the IntMap.
      let inline count (map : IntMap<'T>) : int =
          // Preconditions
          checkNonNull "map" map
          
          map.Count
  
      /// The IntMap containing the given binding.
      let inline singleton (key : int) (value : 'T) : IntMap<'T> =
          IntMap.Singleton (key, value)
  
      /// Look up an element in the IntMap returning a Some value if the
      /// element is in the domain of the IntMap and None if not.
      let inline tryFind (key : int) (map : IntMap<'T>) : 'T option =
          // Preconditions
          checkNonNull "map" map
          
          map.TryFind key
          
      //
      let inline find (key : int) (map : IntMap<'T>) : 'T =
          // Preconditions
          checkNonNull "map" map
  
          map.Find key
  
      //
      let inline add (key : int) (value : 'T) (map : IntMap<'T>) : IntMap<'T> =
          // Preconditions
          checkNonNull "map" map
  
          map.Add key value
  
      //
      let inline remove (key : int) (map : IntMap<'T>) : IntMap<'T> =
          // Preconditions
          checkNonNull "map" map
  
          map.Remove key
  
      //
      let inline containsKey (key : int) (map : IntMap<'T>) : bool =
          // Preconditions
          checkNonNull "map" map
  
          map.ContainsKey key
  
      //
      let inline ofSeq source : IntMap<'T> =
          // Preconditions are checked by the member.
          IntMap.OfSeq source
  
      //
      let inline ofList source : IntMap<'T> =
          // Preconditions are checked by the member.
          IntMap.OfList source
  
      //
      let inline ofArray source : IntMap<'T> =
          // Preconditions are checked by the member.
          IntMap.OfArray source
  
      //
      let inline ofMap source : IntMap<'T> =
          // Preconditions are checked by the member.
          IntMap.OfMap source
  
      //
      let inline toArray (map : IntMap<'T>) =
          // Preconditions
          checkNonNull "map" map
  
          map.ToArray ()
  
      //
      let inline iter (action : int -> 'T -> unit) (map : IntMap<'T>) =
          // Preconditions
          checkNonNull "map" map
  
          map.Iterate action
  
  
      // TODO
      // choose
      // exists
  
negative.code:     // TODO : This is an experimental version of count which is optimized for performance.
      // It should work, but we need to do some tests to be sure. Once we're confident it's correct
      // we'll remove the original 'Count' function and use this once instead.
      static member FastCount (map : PatriciaMap<'T>) =
          match map with
          | Empty -> 0u
          | Lf (_,_) -> 1u
          | Br (_,_,_,_) as t ->
  