|
|
|
|
|
by crvdgc
1204 days ago
|
|
At least in Haskell this can be expressed as type classes. For each condition, you can create a (possibly empty) type class to guarantee that the condition is met. Then the call site type class constraints will be checked at compile time. |
|
Or you get the ability to forge evidence (e.g. you use the evidence provided by a parser for one integer as evidence for another).
This works better for dependency injection scenarios (the Has* pattern).