21 lines
575 B
Plaintext
21 lines
575 B
Plaintext
|
-- | TODO: Phone module should include at least some sort of smart
|
||
|
-- | constructors, rejecting invalid phone numbers.
|
||
|
module App.Phone where
|
||
|
|
||
|
import Prelude
|
||
|
|
||
|
import Data.Codec.Argonaut (JsonCodec)
|
||
|
import Data.Codec.Argonaut as CA
|
||
|
import Data.Newtype (class Newtype)
|
||
|
import Data.Profunctor (wrapIso)
|
||
|
|
||
|
newtype Phone = Phone String
|
||
|
|
||
|
derive instance newtypePhone :: Newtype Phone _
|
||
|
derive instance eqPhone :: Eq Phone
|
||
|
derive instance ordPhone :: Ord Phone
|
||
|
|
||
|
-- | Phone.codec can be used to parse and encode phone numbers.
|
||
|
codec :: JsonCodec Phone
|
||
|
codec = wrapIso Phone CA.string
|