Skip to content

Remove or update typelevel.md ? #5955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smarter opened this issue Feb 20, 2019 · 1 comment · Fixed by #6896
Closed

Remove or update typelevel.md ? #5955

smarter opened this issue Feb 20, 2019 · 1 comment · Fixed by #6896
Assignees

Comments

@smarter
Copy link
Member

smarter commented Feb 20, 2019

https://github.com/lampepfl/dotty/blob/master/docs/docs/typelevel.md is outdated and is therefore misleading, can we delete it because it's subsumed by other doc pages or should it be updated ?

@nicolasstucki nicolasstucki removed their assignment Jul 2, 2019
liufengyun added a commit to dotty-staging/dotty that referenced this issue Jul 19, 2019
liufengyun added a commit that referenced this issue Jul 19, 2019
valencik added a commit to valencik/dotty that referenced this issue Feb 8, 2020
nicolasstucki added a commit that referenced this issue Feb 9, 2020
Fix #5955: Remove typelevel relationship doc
gabro pushed a commit to gabro/dotty that referenced this issue Feb 11, 2020
@rjolly
Copy link
Contributor

rjolly commented Apr 8, 2020

In this file there was a description of code specialization. Do you know where I can find it now, as AFAICT it still works.

Code Specialization

Inline methods are a convenient means to achieve code specialization. As an example, consider implementing a math library that implements (among others) a dotProduct method. Here is a possible implementation of MathLib with some user code.

abstract class MathLib[N : Numeric] {
  def dotProduct(xs: Array[N], ys: Array[N]): N
}
object MathLib {
  inline def apply[N : Numeric] = new MathLib[N] {
    def n = Numeric[N]
    def dotProduct(xs: Array[N], ys: Array[N]): N = {
      require(xs.length == ys.length)
      var i = 0
      var s = n.zero
      while (i < xs.length) {
        s = s + xs(i) * ys(i)
        i += 1
      }
      s
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants