Swap part6 and part7
This commit is contained in:
@@ -206,17 +206,14 @@ toggleFollowButton txt extraClasses msgWhenClicked uname =
|
||||
|
||||
decoder : Maybe Cred -> Decoder Author
|
||||
decoder maybeCred =
|
||||
{- 👉 TODO: Use this `Profile` and `Username` to decode an `Author`!
|
||||
|
||||
💡 HINT: `decoderHelp` will help here, but slightly altering its type may make things easier...
|
||||
-}
|
||||
Decode.succeed "..."
|
||||
Decode.succeed Tuple.pair
|
||||
|> custom Profile.decoder
|
||||
|> required "username" Username.decoder
|
||||
|> Decode.andThen (decodeFromPair maybeCred)
|
||||
|
||||
|
||||
decoderHelp : Maybe Cred -> Profile -> Username -> Decoder Author
|
||||
decoderHelp maybeCred prof uname =
|
||||
decodeFromPair : Maybe Cred -> ( Profile, Username ) -> Decoder Author
|
||||
decodeFromPair maybeCred ( prof, uname ) =
|
||||
case maybeCred of
|
||||
Nothing ->
|
||||
-- If you're logged out, you can't be following anyone!
|
||||
|
||||
@@ -24,17 +24,18 @@ view timeZone timestamp =
|
||||
-}
|
||||
iso8601Decoder : Decoder Time.Posix
|
||||
iso8601Decoder =
|
||||
{- 👉 TODO: Use the following function to decode this Time.Posix value:
|
||||
Decode.string
|
||||
|> Decode.andThen fromString
|
||||
|
||||
|
||||
Iso8601.toTime : String -> Result (List DeadEnd) Time.Posix
|
||||
fromString : String -> Decoder Time.Posix
|
||||
fromString str =
|
||||
case Iso8601.toTime str of
|
||||
Ok successValue ->
|
||||
succeed successValue
|
||||
|
||||
|
||||
❕ NOTE: You can disregard the (List DeadEnd) here. No need to use it to complete this exercise!
|
||||
|
||||
💡 HINT: Decode.andThen will be useful here.
|
||||
-}
|
||||
"..."
|
||||
Err _ ->
|
||||
fail ("Invalid date: " ++ str)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -206,14 +206,17 @@ toggleFollowButton txt extraClasses msgWhenClicked uname =
|
||||
|
||||
decoder : Maybe Cred -> Decoder Author
|
||||
decoder maybeCred =
|
||||
Decode.succeed Tuple.pair
|
||||
{- 👉 TODO: Use this `Profile` and `Username` to decode an `Author`!
|
||||
|
||||
💡 HINT: `decoderHelp` will help here, but slightly altering its type may make things easier...
|
||||
-}
|
||||
Decode.succeed "..."
|
||||
|> custom Profile.decoder
|
||||
|> required "username" Username.decoder
|
||||
|> Decode.andThen (decodeFromPair maybeCred)
|
||||
|
||||
|
||||
decodeFromPair : Maybe Cred -> ( Profile, Username ) -> Decoder Author
|
||||
decodeFromPair maybeCred ( prof, uname ) =
|
||||
decoderHelp : Maybe Cred -> Profile -> Username -> Decoder Author
|
||||
decoderHelp maybeCred prof uname =
|
||||
case maybeCred of
|
||||
Nothing ->
|
||||
-- If you're logged out, you can't be following anyone!
|
||||
|
||||
@@ -24,18 +24,17 @@ view timeZone timestamp =
|
||||
-}
|
||||
iso8601Decoder : Decoder Time.Posix
|
||||
iso8601Decoder =
|
||||
Decode.string
|
||||
|> Decode.andThen fromString
|
||||
{- 👉 TODO: Use the following function to decode this Time.Posix value:
|
||||
|
||||
|
||||
fromString : String -> Decoder Time.Posix
|
||||
fromString str =
|
||||
case Iso8601.toTime str of
|
||||
Ok successValue ->
|
||||
succeed successValue
|
||||
Iso8601.toTime : String -> Result (List DeadEnd) Time.Posix
|
||||
|
||||
Err _ ->
|
||||
fail ("Invalid date: " ++ str)
|
||||
|
||||
❕ NOTE: You can disregard the (List DeadEnd) here. No need to use it to complete this exercise!
|
||||
|
||||
💡 HINT: Decode.andThen will be useful here.
|
||||
-}
|
||||
"..."
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user