This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
We were not able to find the expected elm-package.json file at this tag.
Tag 1.0.1
Committed At 2018-12-12 10:10:34 UTC



    JSON Patch

    This library implements [RFC 6902]( RFC6902), JSON Patch (and RFC 6901, JSON Pointer) for Elm.


    Let's say you previously have gotten a JSON document as a Value from the server or via a port. Now you get a Value that is a JSON Patch for that document.

    newDocument =
        Json.Decoder.decodeValue Json.Patch.decoder patch
            |> Result.andThen (\p -> Json.Patch.apply p document)

    Patching needs to be done on the Value type, due to the type system (records can't be accessed by field name in Elm).

    However, if you have an encoder/decoder pair for your Elm type, you can patch the Elm type like this:

    newElmData =
        Json.Decoder.decodeValue Json.Patch.decoder patch
            |> Result.andThen
                (\p ->
                    dataEncoder elmData
                        |> Json.Patch.apply p
                        |> Result.andThen (Json.Decoder.decodeValue dataDecoder)