Solution for advanced/part2

This commit is contained in:
Richard Feldman
2018-08-14 02:52:56 -04:00
parent 9edc567a13
commit 90db6e81b0

View File

@@ -159,8 +159,8 @@ slug (Article internals _) =
body : Article Full -> Body
body _ =
"👉 TODO make this return the article's body"
body (Article _ (Full bod)) =
bod
@@ -181,8 +181,8 @@ mapAuthor transform (Article info extras) =
fromPreview : Body -> Article Preview -> Article Full
fromPreview _ _ =
"👉 TODO convert from an Article Preview to an Article Full"
fromPreview bod (Article info _) =
Article info (Full bod)
@@ -200,7 +200,7 @@ fullDecoder : Maybe Cred -> Decoder (Article Full)
fullDecoder maybeCred =
Decode.succeed Article
|> custom (internalsDecoder maybeCred)
|> required "body" "👉 TODO use `Body.decoder` (which is a `Decoder Body`) to decode the body into this Article Full"
|> required "body" (Decode.map Full Body.decoder)
internalsDecoder : Maybe Cred -> Decoder Internals