Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open FPrimitive
- /// Composible specifications for your domain types:
- type NonEmptyString =
- private NonEmptyString of string with
- static member create x =
- Spec.def<string>
- |> Spec.notNull "should not be null"
- |> Spec.notEmpty "should not be empty"
- |> Spec.createModel NonEmptyString x
- /// ...also available as computation expression.
- type NonEmptyList<'a> =
- private NonEmptyList of 'a list with
- static member create xs =
- specModel NonEmptyList xs {
- nonEmpty "list should not be empty"
- lengthBetween 1 10 "list length should be between 1-10" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement