diff --git a/advanced/part2/src/Article.elm b/advanced/part2/src/Article.elm index fcb5cb3..429c34f 100644 --- a/advanced/part2/src/Article.elm +++ b/advanced/part2/src/Article.elm @@ -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