mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
Remove property token adjustment
This commit is contained in:
parent
78ee753c7b
commit
27d72f2bff
@ -96,20 +96,18 @@ class ValuesAlgebra[S[_], Alg[_]: Monad](using
|
||||
}
|
||||
|
||||
case prop @ PropertyToken(value, properties) =>
|
||||
prop.adjust.fold(
|
||||
for {
|
||||
valueRaw <- valueToRaw(value)
|
||||
result <- valueRaw.flatTraverse(raw =>
|
||||
properties
|
||||
.foldLeftM(raw) { case (prev, op) =>
|
||||
OptionT(
|
||||
resolveSingleProperty(prev.`type`, op)
|
||||
).map(prop => ApplyPropertyRaw(prev, prop))
|
||||
}
|
||||
.value
|
||||
)
|
||||
} yield result
|
||||
)(valueToRaw)
|
||||
for {
|
||||
valueRaw <- valueToRaw(value)
|
||||
result <- valueRaw.flatTraverse(raw =>
|
||||
properties
|
||||
.foldLeftM(raw) { case (prev, op) =>
|
||||
OptionT(
|
||||
resolveSingleProperty(prev.`type`, op)
|
||||
).map(prop => ApplyPropertyRaw(prev, prop))
|
||||
}
|
||||
.value
|
||||
)
|
||||
} yield result
|
||||
|
||||
case dvt @ NamedValueToken(typeName, fields) =>
|
||||
(for {
|
||||
@ -311,15 +309,14 @@ class ValuesAlgebra[S[_], Alg[_]: Monad](using
|
||||
}
|
||||
|
||||
def valueToCall(v: ValueToken[S]): Alg[Option[(ValueRaw, ArrowType)]] =
|
||||
valueToRaw(v).flatMap(
|
||||
_.flatTraverse {
|
||||
case ca: CallArrowRaw => (ca, ca.baseType).some.pure[Alg]
|
||||
case apr @ ApplyPropertyRaw(_, IntoArrowRaw(_, arrowType, _)) =>
|
||||
(apr, arrowType).some.pure[Alg]
|
||||
// TODO: better error message (`raw` formatting)
|
||||
case raw => report.error(v, s"Expected arrow call, got $raw").as(none)
|
||||
}
|
||||
)
|
||||
valueToRaw(v).flatMap(_.flatTraverse {
|
||||
case ca: CallArrowRaw =>
|
||||
(ca, ca.baseType).some.pure[Alg]
|
||||
case apr @ ApplyPropertyRaw(_, IntoArrowRaw(_, arrowType, _)) =>
|
||||
(apr, arrowType).some.pure[Alg]
|
||||
// TODO: better error message (`raw` formatting)
|
||||
case raw => report.error(v, s"Expected arrow call, got $raw").as(none)
|
||||
})
|
||||
|
||||
def valueToTypedRaw(v: ValueToken[S], expectedType: Type): Alg[Option[ValueRaw]] =
|
||||
OptionT(valueToRaw(v))
|
||||
|
Loading…
Reference in New Issue
Block a user