# High Order Function with Type Parameter

**URL:** <https://users.rust-lang.org/t/high-order-function-with-type-parameter/3112>\
**Category:** help\
**Created:** [October 3, 2015, 3:59am UTC](https://users.rust-lang.org/t/high-order-function-with-type-parameter/3112 "2015-10-03T03:59:59Z")\
**Posts on this page:** 1\
**Showing post:** 50

<div class="post-metadata">

**Author:** ![shelby3](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/shelby3/32/2381_2.png) [@shelby3](https://users.rust-lang.org/u/shelby3)\
**Post date:** [April 24, 2016, 4:22pm UTC](https://users.rust-lang.org/t/high-order-function-with-type-parameter/3112/50 "2016-04-24T16:22:57Z")

</div>

> [@mbrubeck](#):
>
> If the type's data is public, on the other hand, it would need to enforce the Pos invariant in Pos::get:

Afaics, that is not _compile-time_ safety. That is compile-time unsafety and a runtime bug. You can't fix all cases even after N occurrences of the bug, because you don't know where the bugs are in the code _at compile-time_. And thus this wouldn't help us for C++, Java, Scala, etc.. Afaics, the cited research paper doesn't allow/admit that runtime check as a solution to the problem to the compile-time unsafety.

Now we know the issue doesn't arise in Rust, because Rust's typing system does not allow any subtyping and thus no subsumption. But we need to sort out what are the (positive and) negative implications of the lack of first-class subtyping, if any. @keean [appears to be suggesting](https://users.rust-lang.org/t/does-rust-really-need-higher-kinded-types/5531/13) we can model subtyping with OOHaskell paradigms.

---

_[View the full topic](https://users.rust-lang.org/t/high-order-function-with-type-parameter/3112)._
