type UserName = private | UserName of string module UserName = let isValid s = System.String.IsNullOrWhiteSpace(s) |> not let create (str: string) = if isValid str then Some(UserName str) else None let value (UserName s) = s (* Применение *) match (UserName.create "Alice") with | Some name -> name |> UserName.value | None -> "empty"
t.me/perfect0sight
Комментарии
Отправить комментарий