for more information visit the package's GitHub page
Package contains the following modules:
... in my mind, the difference between validation and parsing
lies almost entirely in how information is preserved.
Lets look at the Parser
type and dissect it:
type alias Parser inp err out =
inp -> Result (Cons err) out
Type parameter|Meaning|Example
:------------:|-----------|-------
inp
|Input type
(what is parsed/validated)| User input typically its a String
err
|Error type| Could be your custom error type
type Error = Empty | Blank
out
|Output type| Could be your domain type
type Email = Email String
Graphically:
inp ────────┬──────── ▶ Ok out
│
▼
Err (Cons err)
(Cons
is a non-empty list from this library)
Take a look at this examples: Voucher.elm module. VoucherTest.elm test spec.