This Lesson is for PRO Members.

Subscribe today and get access to all lessons! Plus direct HD download
for offline use, member comment forums, and iTunes "podcast" RSS feed.
Level up your skills now!


Already subscribed? Sign In

Hide playlist

    Use `andThen` to transform data while decoding JSON into Elm

    Some data transformations can be obtained by "tagging on" a function to a decoder with map. But if the transformation may fail, then we need a different approach: express failure in terms of decoding (if the transformation fails, decoding fails), and then tag this Decoder-returning function on to the previous Decoder with andThen. This is functional programming's good old bind, particularized for the Decoder type.

    Please take a moment to tell your friends:

    You must be a PRO Member to view code