Copyright | ©2020 James Alexander Feldman-Crough |
---|---|
License | MPL-2.0 |
Maintainer | alex@fldcr.com |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- class HasLocation t where
- offset :: HasLocation l => Affine' l Offset
- column :: (HasLocation l, Contravariant f, Applicative f) => Optic' (->) f l Column
- line :: (HasLocation l, Contravariant f, Applicative f) => Optic' (->) f l Line
- source :: (HasLocation l, Contravariant f, Applicative f) => Optic' (->) f l Source
- sparse :: Iso' Location SparseLocation
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
offset :: HasLocation l => Affine' l Offset Source #
Read-only optics.
column :: (HasLocation l, Contravariant f, Applicative f) => Optic' (->) f l Column Source #
line :: (HasLocation l, Contravariant f, Applicative f) => Optic' (->) f l Line Source #
source :: (HasLocation l, Contravariant f, Applicative f) => Optic' (->) f l Source Source #
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
.