zwilias/json-decode-exploration/5.0.0

NOTE: this package is not compatible with Elm 0.19.1

Json.Decode.Exploration.Located

A type that gives one or more pieces of information, tagged with a path through a datastructure with fields and indices.

Most importantly, it is used for both Warnings and Errors in Json.Decode.Exploration.

type Located a
= InField String (Nonempty (Located a))
| AtIndex Int (Nonempty (Located a))
| Here a
toString : (a -> List String) -> Nonempty (Located a) -> List String

Allows turning a non-empty list of Located a into a flat list of human readable strings, provided we have a way to turn an a into some lines of text.

Each string represents a line. This allows arbitrary indentation by mapping over the lines and prepending some whitespace.

map : (a -> b) -> Located a -> Located b