prosidy-1.6.0.0: A simple language for writing documents.
Copyright©2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Maintaineralex@fldcr.com
Safe HaskellNone
LanguageHaskell2010

Prosidy.Optics.Source

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.

Methods

location :: Affine' t Location Source #

Instances

Instances details
HasLocation Location Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' Location Location Source #

HasLocation Paragraph Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' Paragraph Location Source #

HasLocation Inline Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' Inline Location Source #

HasLocation Fragment Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' Fragment Location Source #

HasLocation Block Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' Block Location Source #

HasLocation (Tag a) Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' (Tag a) Location Source #

HasLocation (Region a) Source # 
Instance details

Defined in Prosidy.Optics.Source

Methods

location :: Affine' (Region a) Location Source #

offset :: HasLocation l => Affine' 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, Contravariant f, Applicative f) => Optic' (->) f 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, Contravariant f, Applicative f) => Optic' (->) f 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, Contravariant f, Applicative f) => Optic' (->) f l Source Source #

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

Conversion utilities

sparse :: Iso' Location SparseLocation Source #

An isomorphism between Location and SparseLocation. This is allowed because although a Location has strictly more data than a SparseLocation, those values are denormalizations of values within SparseLocation.