anchor.diff:  open Fantomas.FormatConfig
   open Fantomas.SourceParser
   open Fantomas.SourceTransformer
  +
  +let sortOpenDeclarations xs asOpenDecl =
  +
  +    let (|OpenDecl|_|) x : string option = asOpenDecl x
  +
  +    let rec groupAndSortContiguousOpenDecls decls = 
  +
  +        // 1 = open declartion, 2,3,4 = other declarations
  +        // returns [1;1],[2;3;4] for [1;1;2;3;4]
  +        // returns [],[2;1;1;2;3;4] for [2;1;1;2;3;4]
  +        let rec findContiguousOpenDecls openDecls = function
  +            | (OpenDecl _ as x)::xs -> findContiguousOpenDecls (x::openDecls) xs
  +            | decls -> openDecls, decls
  +
  +        // returns [[2],[1;1];[2];[3];[1;1];[4]] for [2;1;1;2;3;1;1;4]
  +        match findContiguousOpenDecls [] decls with
  +        | [], [] -> []
  +        | [], decl::decls -> [decl]::(groupAndSortContiguousOpenDecls decls)
  +        | openDecls, decls ->
  +             let openDeclsSorted = openDecls |> List.sortBy (asOpenDecl >> Option.get)
  +             openDeclsSorted::(groupAndSortContiguousOpenDecls decls)
  +
  +    xs |> groupAndSortContiguousOpenDecls |> List.collect id
   
   let rec genParsedInput = function
       | ImplFile im -> genImpFile im
  
positive.code:     +> genModuleDeclList mds
  
  and genSigModuleOrNamespace(SigModuleOrNamespace(ats, px, ao, s, mds, isModule)) =
      genPreXmlDoc px
      +> colPost sepNln sepNln ats genAttribute
      +> ifElse (s = "Tmp") sepNone (ifElse isModule (!- "module ") (!- "namespace ")
  
negative.code:     | ModuleAbbrevL(xs, ys) 
      | OpenL(xs, ys) 
      | OneLinerLetL(xs, ys) ->
          let xs = sortOpenDeclarations xs (|Open|_|)
          match ys with
          | [] -> col sepNln xs genModuleDecl
          | _ -> col sepNln xs genModuleDecl +> rep 2 sepNln +> genModuleDeclList ys
  
      | MultilineModuleDeclL(xs, ys) ->
          let xs = sortOpenDeclarations xs (|Open|_|)
          match ys with
          | [] -> col (rep 2 sepNln) xs genModuleDecl
          | _ -> col (rep 2 sepNln) xs genModuleDecl +> rep 2 sepNln +> genModuleDeclList ys
  