Version 1.0 released of Nim Programming Language

I still don’t understand. Are these “typeclass” the same as those in Haskell? When I see SomeFloat in Nim’s document:

SomeFloat = float|float32|float64

That’s why I think they are sum type. And also when I see:

# Vector copy
proc cublas_copy*[T: SomeFloat](
  n: int; x: ptr T; incx: int;
  y: ptr T; incy: int) {.inline.}=

  check cublasSetStream(cublasHandle0, cudaStream0)

  when T is float32:
    check cublasScopy(cublasHandle0, n.cint, x, incx.cint, y, incy.cint)
  elif T is float64:
    check cublasDcopy(cublasHandle0, n.cint, x, incx.cint, y, incy.cint)

You declare T to be the “typeclass” SomeFloat, and do some conditional branchings (and I think they can get removed during compilation, because you say they only exist in compilation).accoding to the type of T. But isn’t typeclass can apply to any type which implements all the methods under the typeclass?(For example, in order to become an instance of the typeclass Functor in Haskell, we just need to implement map function). In the codes above, it seems that T can only be float,float 32 and float 64,which is not open.