Add part4

This commit is contained in:
Richard Feldman
2018-08-05 08:28:31 -04:00
parent a33c199c11
commit 2e0d00f947
53 changed files with 5522 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
module Article.Slug exposing (Slug, decoder, toString, urlParser)
import Json.Decode as Decode exposing (Decoder)
import Url.Parser exposing (Parser)
-- TYPES
type Slug
= Slug String
-- CREATE
urlParser : Parser (Slug -> a) a
urlParser =
Url.Parser.custom "SLUG" (\str -> Just (Slug str))
decoder : Decoder Slug
decoder =
Decode.map Slug Decode.string
-- TRANSFORM
toString : Slug -> String
toString (Slug str) =
str