Created
February 22, 2024 09:10
-
-
Save stijnmoreels/b1373fd68a00ba50556ae208f4b0b062 to your computer and use it in GitHub Desktop.
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
open FPrimitive | |
type Guest = | |
private { Name : string } with | |
static member create name = result { | |
let! name = specModel id name { | |
notNullOrWhiteSpace "guest name should not be blank" | |
alphabetical "guest name should only contain alphabetical characters" } | |
return { Name = name } } | |
type GuestList = | |
private GuestList of Guest list with | |
static member none = GuestList [] | |
static member create guests = specModel GuestList guests { | |
unique (fun g -> g.Name) "guest list requires unique guest names" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment