This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ShortCode = private ShortCode of string | |
type ProductShortCode = private ProductShortCode of ShortCode | |
type AccountShortCode = private AccountShortCode of ShortCode | |
module ShortCode = | |
let create s = | |
if System.String.IsNullOrEmpty s then None | |
elif s.Length > 15 then None | |
else Some (ShortCode s) | |
let value (ShortCode s) = | |
s | |
module AccountShortCode = | |
let create s = | |
match ShortCode.create s with | |
| Some sc -> Some (AccountShortCode sc) | |
| None -> None | |
let value (AccountShortCode (ShortCode s)) = s | |
module ProductShortCode = | |
let create s = | |
match ShortCode.create s with | |
| Some sc -> Some (ProductShortCode sc) | |
| None -> None | |
let value (ProductShortCode (ShortCode s)) = s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment