anchor.diff:              cont Regex.empty
           | Negate (Negate regex) ->
               Regex.CanonicalizeImpl regex cont
  -        | Negate _ as notRegex ->
  -            // This regex is canonical
  -            cont notRegex
  +        | Negate r ->
  +            Regex.CanonicalizeImpl r <| fun r' ->
  +                Negate r'
  +                |> cont
   
           | Star (Star _ as ``r*``) ->
               Regex.CanonicalizeImpl ``r*`` cont
  
positive.code:             Regex.CanonicalizeImpl r <| fun r' ->
                  Star r'
                  |> cont
          | Star _ as ``r*`` ->
              // This regex is canonical
              cont ``r*``
  
          | Concat (Empty, _)
          | Concat (_, Empty) ->
  
negative.code:                     Concat (r', s')
                      |> cont
  
          | Or (Any, _)
          | Or (_, Any) ->
              cont Any
          | Or (Empty, r)
          | Or (r, Empty) ->
              Regex.CanonicalizeImpl r cont
          | Or (CharacterSet charSet1, CharacterSet charSet2) ->
              // 'Or' is the disjunction (union) of two Regexes.
              let charSetUnion = CharSet.union charSet1 charSet2
  
              // Return the simplest Regex for the union set.
              CharacterSet charSetUnion
              |> cont
  
          | Or (r, Or (s, t)) ->
              // Rewrite the expression so it's left-associative.
              let regex = Or (Or (r, s), t)
  