You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with type aliases like type Minute = Int Refined Interval[W.0.T, W.59.T] it would be nice to have a refine function for refining runtime values that takes the refined type as parameter:
refine[Minute](x):Either[String, Minute]
For literals a type ascription is enough right now, e.g.: 12: Minute
If we have this, type_aliases.md should be updated with usages of that function.
The text was updated successfully, but these errors were encountered:
I think I'm going to put it in the RefType companion. refine and refineM are in the RefType trait where the type parameter F[_, _] is already known. For the above function F[_, _] is given by the type parameter FTP so it makes sense to have it on the companion which is not related to any F[_, _]. Similar to RefType.apply it also summons an instance based on the given type parameter.
WRT naming: I'm leaning to applyRef which is short for "apply this refinement to the given value". With the type parameter FTP one specifies the base type T, the predicate P, and the refinement carrier F[_, _], so the complete refinement is given by this parameter.
When working with type aliases like
type Minute = Int Refined Interval[W.
0.T, W.
59.T]
it would be nice to have a refine function for refining runtime values that takes the refined type as parameter:For literals a type ascription is enough right now, e.g.:
12: Minute
If we have this, type_aliases.md should be updated with usages of that function.
The text was updated successfully, but these errors were encountered: