aisamanra / s-cargot

Elaborate and expressive S-Expression library for Haskell
Other
61 stars 6 forks source link

[WIP] Include location error reporting with `HasLocation` typeclass #23

Open aisamanra opened 2 months ago

aisamanra commented 2 months ago

This adds a typeclass HasLocation that can pull out source locations using the same machinery as the Data.SCargot.Common(Location) types, and uses it to provide source locations for the asWellFormed carrier type: this means that a failure in asWellFormed will now report the location of an error. That also enables variants of the decode/decodeOne functions which report readable spans on error rather than simply getting a string.

This is a backwards incompatible change! If this merges, I'll pair it with a major version bump so people are aware of the potential for breakage.