Created
December 5, 2011 21:34
-
-
Save splittingfield/1435472 to your computer and use it in GitHub Desktop.
Workaround for specialization issue for known datatypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.azavea.math.Numeric | |
import com.azavea.math.EasyImplicits._ | |
trait F1[@specialized T, @specialized W] extends Function1[T,W] { | |
def apply(a:T):W | |
} | |
abstract class F12D[@specialized T:Numeric:Manifest] extends F1[T,Double]{ | |
def apply(a:T):Double | |
} | |
abstract class F12I[@specialized T:Numeric:Manifest] extends F1[T,Int] { | |
def apply(a:T):Int | |
} | |
class Bar[@specialized T:Numeric:Manifest] { | |
def barToDouble[@specialized S:Numeric:Manifest,W <: F1[T,S]](f:W)=f(numeric[T].zero) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment