title: How to override string generation for all properties in FsCheck
body: <p>I have a bunch of types with strings all over the place. I want to write property tests for functions operating on these types, using FsCheck. For all of them, I know that I will never get strings that are null or are non alpha-numeric. 
  Ergo I want to restrict value generation for strings accordingly.</p>
  
  <p>I tried this:</p>
  
  <pre><code>let charSet= "abc" // simplified for the example
  let isValidString (s:string) = null&lt;&gt;s &amp;&amp; not (s |&gt; Seq.exists (fun c -&gt; not (charSet |&gt; Seq.contains c)))
  let createConfig left right = {LeftLanguageName= left; RightLanguageName= right}
  let generateString= Arb.generate&lt;string&gt; |&gt; Gen.filter isValidString
  let generateConfig= createConfig &lt;!&gt; generateString &lt;*&gt; generateString 
  
  type Generators =
    static member String() =
      { 
          new Arbitrary&lt;string&gt;() with
              override x.Generator = generateString
      }
    static member LanguageConfiguration()= 
      {
          new Arbitrary&lt;LanguageConfiguration&gt;() with
             override x.Generator = generateConfig
      }
  
  Arb.register&lt;Generators&gt;() |&gt; ignore
  
  </code></pre>
  
  <p>However, FsCheck keeps generating values like this</p>
  
  <pre><code>Falsifiable, after 14 tests (9 shrinks) (StdGen (2144073619,296598634)):
  Original:
  {LeftLanguageName = " 1c\J
  ";
   RightLanguageName = "\026z^k";} (At least one control character has been escaped as a char code, e.g. \023)
  Shrunk:
  {LeftLanguageName = "
  ";
   RightLanguageName = "";}
  </code></pre>
  
  <p>So obviously I am missing something, but I got no idea what.</p>
  
  <p>I looked at </p>
  
  <p><a href="https://stackoverflow.com/questions/23225948/how-to-generate-null-strings-for-fscheck-tests">How to generate null strings for FsCheck tests</a></p>
  
  <p>and </p>
  
  <p><a href="http://blog.nikosbaxevanis.com/2015/09/25/regex-constrained-strings-with-fscheck/" rel="nofollow noreferrer">http://blog.nikosbaxevanis.com/2015/09/25/regex-constrained-strings-with-fscheck/</a></p>
  
  <p>but neither of them tries to override string generation <em>globally</em> (within scope).</p>