This Lesson is for PRO Members

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

Unlock This Lesson

Already subscribed? Sign In

Autoplay
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.

    You must be a Member to view code