pro-source-0.1.0.0: Utilities for tracking source locations
Copyright© 2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Safe HaskellNone
LanguageHaskell2010

ProSource.HasLocation

Description

 
Synopsis

Classy optics; implementable on all types with a location

class HasLocation t where Source #

A classy optic for selecting the Location from a value. Note that location is affine: a Location can't be attached to a value which does not -- already have one, and not all values with an instance of HasLocation have a location.

Instances

Instances details
HasLocation Location Source # 
Instance details

Defined in ProSource.HasLocation

offset :: HasLocation l => AffineTraversal' l Offset Source #

Focus on the Offset from a value parsed from a source file. If the Offset is modified, note that the resulting column and line will also be modified as they are denormalizations of this value.

Read-only optics

column :: HasLocation l => AffineFold l Column Source #

Fetch the Column from a value parsed from a source file. Modifications are not allowed as the offset and line may become inconsistent.

line :: HasLocation l => AffineFold l Line Source #

Fetch the Line from a value parsed from a source file. Modifications are not allowed as the offset and column may become inconsistent.

source :: HasLocation l => AffineFold l Source Source #

Fetch the Source a value was parsed from. Modifications are not allowed as the line, offset, and column may become inconsistent.