Module
Data.Lens.Barlow.Construction
- Package
- purescript-barlow-lens
- Repository
- sigma-andex/purescript-barlow-lens
#ConstructBarlowGeneric Source
class ConstructBarlowGeneric :: TList -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Constraintclass ConstructBarlowGeneric (lenses :: TList) p s t a b | lenses s -> t a b where
Members
constructBarlowGeneric :: Proxy lenses -> Optic p s t a b
Instances
(Strong p) => ConstructBarlowGeneric (TCons (Percentage sym) TNil) p (Constructor sym NoArguments) (Constructor sym NoArguments) Unit Unit(Profunctor p) => ConstructBarlowGeneric (TCons (Percentage sym) TNil) p (Constructor sym (Argument a)) (Constructor sym (Argument a)) a a(ConstructBarlow rest p restA restA a a, Profunctor p) => ConstructBarlowGeneric (TCons (Percentage sym) rest) p (Constructor sym (Argument restA)) (Constructor sym (Argument restA)) a a(ConstructBarlowGeneric rest p restA restA a a, Profunctor p) => ConstructBarlowGeneric (TCons (Percentage sym) rest) p (Constructor sym restA) (Constructor sym restA) a a(Choice p, Strong p) => ConstructBarlowGeneric (TCons (Percentage sym) TNil) p (Sum (Constructor sym NoArguments) r) (Sum (Constructor sym NoArguments) r) Unit Unit(Choice p) => ConstructBarlowGeneric (TCons (Percentage sym) TNil) p (Sum (Constructor sym (Argument a)) r) (Sum (Constructor sym (Argument a)) r) a a(ConstructBarlow rest p restA restA a a, Choice p) => ConstructBarlowGeneric (TCons (Percentage sym) rest) p (Sum (Constructor sym (Argument restA)) r) (Sum (Constructor sym (Argument restA)) r) a a(ConstructBarlowGeneric rest p restA restA a a, Choice p) => ConstructBarlowGeneric (TCons (Percentage sym) rest) p (Sum (Constructor sym restA) r) (Sum (Constructor sym restA) r) a a(Choice p, Strong p) => ConstructBarlowGeneric (TCons (Percentage sym) TNil) p (Sum l (Constructor sym NoArguments)) (Sum l (Constructor sym NoArguments)) Unit Unit(Choice p) => ConstructBarlowGeneric (TCons (Percentage sym) TNil) p (Sum l (Constructor sym (Argument a))) (Sum l (Constructor sym (Argument a))) a a(ConstructBarlow rest p restA restA a a, Choice p) => ConstructBarlowGeneric (TCons (Percentage sym) rest) p (Sum l (Constructor sym (Argument restA))) (Sum l (Constructor sym (Argument restA))) a a(ConstructBarlowGeneric (TCons (Percentage sym) rest) p restA restA a a, Choice p) => ConstructBarlowGeneric (TCons (Percentage sym) rest) p (Sum l restA) (Sum l restA) a a(ConstructProduct n n rest p restA a) => ConstructBarlowGeneric (TCons (ProductIndex n) rest) p restA restA a a
#ConstructProduct Source
class ConstructProduct :: Int -> Int -> TList -> (Type -> Type -> Type) -> Type -> Type -> Constraintclass ConstructProduct (original :: Int) (n :: Int) (lenses :: TList) p s a | n lenses s -> a where
Selects the n-th argument of a product with %n. original is the index the user wrote, for error messages.
Members
constructProduct :: Proxy original -> Proxy n -> Proxy lenses -> Optic p s s a a
Instances
(Fail (Text "barlow: `%0` is not valid – product indices start at `%1`"), Unreachable) => ConstructProduct o 0 rest p s a(ConstructBarlow rest p x x a a, Strong p) => ConstructProduct o 1 rest p (Product (Argument x) r) a(Add k 1 n, ConstructProduct o k rest p r a, Strong p) => ConstructProduct o n rest p (Product l r) a(ConstructBarlow rest p x x a a, Profunctor p) => ConstructProduct o 1 rest p (Argument x) a(Add k 1 n, Add arity k o, Fail (Beside (Text "barlow: `%") (Beside (Quote o) (Beside (Text "` is out of range – this constructor only has ") (Beside (Quote arity) (Text " arguments"))))), Unreachable) => ConstructProduct o n rest p (Argument x) a(Fail (Beside (Text "barlow: `%") (Beside (Quote o) (Text "` cannot be used here – this constructor has no arguments"))), Unreachable) => ConstructProduct o n rest p NoArguments a(Fail (Beside (Text "barlow: `%") (Beside (Quote o) (Beside (Text "` needs a constructor first – use `%") (Beside (Text name) (Beside (Text ".%") (Beside (Quote o) (Text "`"))))))), Unreachable) => ConstructProduct o n rest p (Constructor name x) a(Fail (Beside (Text "barlow: `%") (Beside (Quote o) (Text "` needs a constructor first – select one with `%Name`"))), Unreachable) => ConstructProduct o n rest p s a
#ConstructBarlow Source
class ConstructBarlow :: TList -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Constraintclass ConstructBarlow (lenses :: TList) p s t a b | lenses s -> t a b where
Members
constructBarlow :: Proxy lenses -> Optic p s t a b
Instances
ConstructBarlow TNil p s t s t(Choice p) => ConstructBarlow (TCons QuestionMark TNil) p (Maybe a) (Maybe b) a b(Choice p) => ConstructBarlow (TCons RightArrow TNil) p (Either l a) (Either l b) a b(Choice p) => ConstructBarlow (TCons LeftArrow TNil) p (Either a r) (Either b r) a b(RowToList r rl, RecordElem rl restA, TraverseFields rl r restA, ConstructBarlow rest p restA restA a a, Wander p) => ConstructBarlow (TCons Plus rest) p (Record r) (Record r) a a(Wander p, Traversable t) => ConstructBarlow (TCons Plus TNil) p (t a) (t b) a b(Profunctor p, Newtype nt a) => ConstructBarlow (TCons ExclamationMark TNil) p nt nt a a(IsSymbol sym, FieldOf sym x a rc, Cons sym b rc y, Strong p) => ConstructBarlow (TCons (RecordField sym) TNil) p (Record x) (Record y) a b(ConstructBarlow rest p restA restB a b, Choice p) => ConstructBarlow (TCons QuestionMark rest) p (Maybe restA) (Maybe restB) a b(ConstructBarlow rest p restA restB a b, Choice p) => ConstructBarlow (TCons RightArrow rest) p (Either l restA) (Either l restB) a b(ConstructBarlow rest p restA restB a b, Choice p) => ConstructBarlow (TCons LeftArrow rest) p (Either restA r) (Either restB r) a b(ConstructBarlow rest p restA restB a b, Wander p, Traversable t) => ConstructBarlow (TCons Plus rest) p (t restA) (t restB) a b(ConstructBarlow rest p restA restA a a, Newtype nt restA, Profunctor p) => ConstructBarlow (TCons ExclamationMark rest) p nt nt a a(IsSymbol sym, FieldOf sym rx restA thru, ConstructBarlow rest p restA restB a b, Cons sym restB thru ry, Strong p) => ConstructBarlow (TCons (RecordField sym) rest) p (Record rx) (Record ry) a b(IsSymbol sym, FieldOf sym rx restA thru, ConstructBarlow rest p restA restB a b, Cons sym restB thru ry, Strong p) => ConstructBarlow (TCons (Bracket sym) rest) p (Record rx) (Record ry) a b(Index s k v, IndexKey sym k, ConstructBarlow rest p v v a a, Wander p) => ConstructBarlow (TCons (Bracket sym) rest) p s s a a(At s k v, IndexKey sym k, ConstructBarlow rest p (Maybe v) (Maybe v) a a, Strong p) => ConstructBarlow (TCons (BracketAt sym) rest) p s s a a(SelectFields fields r sub, ConstructBarlow rest p (Record sub) (Record sub) a a, Strong p) => ConstructBarlow (TCons (Fields fields) rest) p (Record r) (Record r) a a(ConstructBarlow rest p restA restB a b, Strong p) => ConstructBarlow (TCons (ProductIndex 1) rest) p (Tuple restA c) (Tuple restB c) a b(ConstructBarlow rest p restA restB a b, Strong p) => ConstructBarlow (TCons (ProductIndex 2) rest) p (Tuple c restA) (Tuple c restB) a b(Fail (Beside (Text "barlow: `%") (Beside (Quote n) (Text "` is out of range – a Tuple only has `%1` and `%2`"))), Unreachable) => ConstructBarlow (TCons (ProductIndex n) rest) p (Tuple x y) t a b(Fail (Above (Text "barlow: `?` expects a Maybe, but got") (Quote s)), Unreachable) => ConstructBarlow (TCons QuestionMark rest) p s t a b(Fail (Above (Text "barlow: `>` expects an Either, but got") (Quote s)), Unreachable) => ConstructBarlow (TCons RightArrow rest) p s t a b(Fail (Above (Text "barlow: `<` expects an Either, but got") (Quote s)), Unreachable) => ConstructBarlow (TCons LeftArrow rest) p s t a b(Fail (Above (Text "barlow: `+` expects a Traversable or a record, but got") (Quote s)), Unreachable) => ConstructBarlow (TCons Plus rest) p s t a b(IsBuiltin s builtin, ConstructNonRecord builtin (TCons (RecordField sym) rest) p s t a b) => ConstructBarlow (TCons (RecordField sym) rest) p s t a b(IsBuiltin s builtin, ConstructNonRecord builtin (TCons (Fields fields) rest) p s t a b) => ConstructBarlow (TCons (Fields fields) rest) p s t a b(Generic s repS, CheckConstructor tlist s repS, ConstructBarlowGeneric tlist p repS repS a a, Profunctor p) => ConstructBarlow tlist p s s a a
#CheckConstructor Source
class CheckConstructor :: TList -> Type -> Type -> Constraintclass CheckConstructor (lenses :: TList) (s :: Type) (rep :: Type)
Fails with a readable message (listing the available constructors) if %Name names a constructor that doesn't exist.
Instances
(HasConstructor sym rep found, CheckConstructorFound found sym s rep) => CheckConstructor (TCons (Percentage sym) rest) s repCheckConstructor lenses s rep
#HasConstructor Source
class HasConstructor :: Symbol -> Type -> Boolean -> Constraintclass HasConstructor (sym :: Symbol) (rep :: Type) (found :: Boolean) | sym rep -> found
Instances
HasConstructor sym (Constructor sym x) TrueHasConstructor sym (Constructor other x) False(HasConstructor sym l foundL, HasConstructor sym r foundR, Or foundL foundR found) => HasConstructor sym (Sum l r) foundHasConstructor sym rep False
#CheckConstructorFound Source
class CheckConstructorFound :: Boolean -> Symbol -> Type -> Type -> Constraintclass CheckConstructorFound (found :: Boolean) (sym :: Symbol) (s :: Type) (rep :: Type)
Instances
#ConstructorNames Source
class ConstructorNames :: Type -> Doc -> Constraintclass ConstructorNames (rep :: Type) (names :: Doc) | rep -> names
Instances
ConstructorNames (Constructor name x) (Text name)(ConstructorNames l namesL, ConstructorNames r namesR) => ConstructorNames (Sum l r) (Beside namesL (Beside (Text ", ") namesR))ConstructorNames rep (Text "")
#IsBuiltin Source
#ConstructNonRecord Source
class ConstructNonRecord :: Boolean -> TList -> (Type -> Type -> Type) -> Type -> Type -> Type -> Type -> Constraintclass ConstructNonRecord (builtin :: Boolean) (lenses :: TList) p s t a b | builtin lenses s -> t a b where
A field step (name or {...}) on something that isn't a record.
Members
constructNonRecord :: Proxy builtin -> Proxy lenses -> Optic p s t a b
Instances
(Fail (Above (Beside (Text "barlow: cannot select the field ") (Beside (QuoteLabel sym) (Text " because this is not a record:"))) (Quote s)), Unreachable) => ConstructNonRecord True (TCons (RecordField sym) rest) p s t a b(Fail (Above (Text "barlow: `{...}` expects a record, but got") (Quote s)), Unreachable) => ConstructNonRecord True lenses p s t a b(Newtype s inner, ConstructBarlow lenses p inner inner a a, Profunctor p) => ConstructNonRecord False lenses p s s a a