bellroy/elm-parse-dont-validate/1.0.0

Formerly tricycle/elm-parse-dont-validate. Search finds this package by either name.

Parsing (Validation) done right for Elm

... in my mind, the difference between validation and parsing
lies almost entirely in how information is preserved.

Lexi Lambda ©

Basic types

Lets look at the Parser type and dissect it:

type alias Parser inp err out =
    inp -> Result (Cons err) out
Type parameterMeaningExample
inpInput type
(what is parsed/validated)
User input typically its a String
errError typeCould be your custom error type
`type Error = Empty
outOutput typeCould be your domain type
type Email = Email String

Graphically:

 inp ────────┬──────── ▶ Ok out
             │
             ▼
      Err (Cons err)

(Cons is a non-empty list from this library)

Usage

Take a look at this examples: