anchor.diff:              else
                   Failure StringError.NotASCIIString
   
  +    let generate len =
  +        let rnd = System.Random()
  +        let res = 
  +            Array.init len (fun _ -> byte (rnd.Next(32, 127)))
  +            |> getString 
  +            |> Result.get
  +            |> ASCIIString
  +        res
  +
       let apply f (ASCIIString s) = f s
       let unwrap (ASCIIString s) = s
   
  
positive.code:     let getBytes (IpAddress ip) = getBytes ip |> Result.get
  
  module PositiveInt =
      type T = PositiveInt of uint64
  
      type Error =
  
negative.code:     match dcpp_message with
      | DcppSendMessage.Search s_msg ->
          [
              "$Search " |> getBytes |> Result.get
              IpAddress.getBytes s_msg.listen_info.ip
              ":" |> getBytes |> Result.get
              (PortData.unwrap s_msg.listen_info.port).ToString() |> getBytes |> Result.get
              " " |> getBytes |> Result.get
              "F?F?0?1?" |> getBytes |> Result.get
              s_msg.search_str |> getBytes |> Result.get // TODO validate search_str
              "$$" |> getBytes |> Result.get
              "|" |> getBytes |> Result.get
          ]
          |> Array.concat
      | DcppSendMessage.MyPass mp_msg ->
          [
              "$MyPass " |> getBytes |> Result.get
              PasswordData.apply ASCIIString.getBytes mp_msg.password
              "|" |> getBytes |> Result.get
          ]
          |> Array.concat
  
      | DcppSendMessage.ValidateNick vn_msg ->
          [
              // TODO extract key into separate message
              "$Key " |> getBytes |> Result.get
              KeyData.unwrap vn_msg.key
              "|$ValidateNick " |> getBytes |> Result.get
              NickData.apply ASCIIString.getBytes vn_msg.nick
              "|" |> getBytes |> Result.get
          ]
          |> Array.concat
      | DcppSendMessage.Key k_msg ->
          [
              "$Key " |> getBytes |> Result.get
              KeyData.unwrap k_msg.key
              "|" |> getBytes |> Result.get
          ]
          |> Array.concat
  