21 lines
579 B
Plaintext
21 lines
579 B
Plaintext
|
-- | TODO: Email module should include at least some sort of smart
|
||
|
-- | constructors, rejecting invalid email addresses.
|
||
|
module App.Email where
|
||
|
|
||
|
import Prelude
|
||
|
|
||
|
import Data.Codec.Argonaut (JsonCodec)
|
||
|
import Data.Codec.Argonaut as CA
|
||
|
import Data.Newtype (class Newtype)
|
||
|
import Data.Profunctor (wrapIso)
|
||
|
|
||
|
newtype Email = Email String
|
||
|
|
||
|
derive instance newtypeEmail :: Newtype Email _
|
||
|
derive instance eqEmail :: Eq Email
|
||
|
derive instance ordEmail :: Ord Email
|
||
|
|
||
|
-- | Email.codec can be used to parse and encode email addresses.
|
||
|
codec :: JsonCodec Email
|
||
|
codec = wrapIso Email CA.string
|