-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.fs
More file actions
47 lines (35 loc) · 1.1 KB
/
Copy pathProgram.fs
File metadata and controls
47 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
open System.Text.RegularExpressions
// Learn more about F# at http://fsharp.org
// https://www.youtube.com/watch?v=Up7LcbGZFuo
type String50 = String50 of string
type String1 = String1 of string
type PersonName = {
FirstName: String50
MiddleInitial: String1 option
LastName: String50
}
type EmailAddress = EmailAddress of string
let createEmailAddress s =
if Regex.IsMatch(s, @"^\S+@\S+\.\S+$")
then Some(EmailAddress s)
else None
type VerifiedEmail = VerifiedEmail of EmailAddress
type VerifiedEmailHash = VerifiedEmailHash of string
type VerificationService =
(EmailAddress * VerifiedEmailHash) -> VerifiedEmail option
type EmailContactInfo =
| Unverified of EmailAddress
| Verified of VerifiedEmail
type PostalContactInfo = PostalContactInfo of string
type ContactInfo =
| Email of EmailContactInfo
| Address of PostalContactInfo
type Contact = {
Name: PersonName
PrimaryContactInfo: ContactInfo
SecondaryContactInfo: ContactInfo option
}
[<EntryPoint>]
let main _ =
printfn "Hello World from F#!"
0 // return an integer exit code