class Refine[A, B]
refine(guard): apply with .pipe.
Functions#
__init__#
__init__(filter) -> None| Parameter | Type | Description |
|---|---|---|
filter | Filter[A] |
def __init__(self, filter: Filter[A]) -> None:
self._filter = filter__call__#
__call__[I, RD, RE](schema) -> Bottom[B, I, RD, RE]| Parameter | Type | Description |
|---|---|---|
schema | Codec[A, I, RD, RE] |
Returns Bottom[B, I, RD, RE]
def __call__[I, RD, RE](self, schema: Codec[A, I, RD, RE], /) -> Bottom[B, I, RD, RE]:
checked = schema.__codec__().check(self._filter)
# The guard holds for every value the checked schema gives.
return cast("Bottom[B, I, RD, RE]", Bottom(checked.ast))