Module

Data.Lens.Barlow.Internal

Package
purescript-barlow-lens
Repository
sigma-andex/purescript-barlow-lens

Type-level helpers used by the barlow lens construction.

#Unreachable Source

class Unreachable  where

A class without instances, so it can only ever be satisfied as a given constraint. Instances whose context contains a Fail (and therefore can never be selected) also require Unreachable, which lets them use unreachable as a body.

Members

#FieldOf Source

class FieldOf :: Symbol -> Row Type -> Type -> Row Type -> Constraintclass FieldOf (sym :: Symbol) (r :: Row Type) a (rest :: Row Type) | sym r -> a rest where

Row.Cons sym a rest r, but failing with a readable message if the field doesn't exist. The Row.Cons is only solved once the field is known to exist; otherwise the compiler would report a unification error before ever reaching the custom error.

Members

Instances

#FieldOfRL Source

class FieldOfRL :: Symbol -> RowList Type -> Row Type -> Type -> Row Type -> Constraintclass FieldOfRL (sym :: Symbol) (rl :: RowList Type) (r :: Row Type) a (rest :: Row Type) | sym rl r -> a rest where

Members

Instances

#IndexKey Source

class IndexKey :: Symbol -> Type -> Constraintclass IndexKey (sym :: Symbol) k  where

Turns the symbol inside [...] into a key of the container's key type.

Members

Instances

#ParseInt Source

class ParseInt :: Symbol -> Int -> Constraintclass ParseInt (sym :: Symbol) (n :: Int) | sym -> n

Parses a symbol of decimal digits into a type-level Int.

Instances

#ParseIntAcc Source

class ParseIntAcc :: Symbol -> Symbol -> Int -> Int -> Constraintclass ParseIntAcc (original :: Symbol) (sym :: Symbol) (acc :: Int) (n :: Int) | original sym acc -> n

Instances

#Digit Source

class Digit :: Symbol -> Symbol -> Int -> Constraintclass Digit (original :: Symbol) (sym :: Symbol) (d :: Int) | sym -> d

Instances

#SelectFields Source

class SelectFields :: TList -> Row Type -> Row Type -> Constraintclass SelectFields (fields :: TList) (r :: Row Type) (sub :: Row Type) | fields r -> sub where

Members

Instances

#selectFields Source

selectFields :: forall fields r sub. SelectFields fields r sub => Proxy fields -> Lens' (Record r) (Record sub)

A lens onto the sub-record containing only the given fields.

#traverseRecord Source

traverseRecord :: forall @a rl r. TraverseFields rl r a => Proxy rl -> Traversal' (Record r) a

Traverses all fields of a homogeneous record.

#itraverseRecord Source

itraverseRecord :: forall @a rl r. TraverseFields rl r a => Proxy rl -> IndexedTraversal' String (Record r) a

Traverses all fields of a homogeneous record, indexed by field name.

#RecordElem Source

class RecordElem :: RowList Type -> Type -> Constraintclass RecordElem (rl :: RowList Type) (a :: Type) | rl -> a

The type of the first field, i.e. the element type of a homogeneous record.

Instances

#TraverseFields Source

class TraverseFields :: RowList Type -> Row Type -> Type -> Constraintclass TraverseFields (rl :: RowList Type) (r :: Row Type) a  where

Has no functional dependency on purpose, so a field of the wrong type falls through to the custom error.

Members

Instances