This file contains hidden or 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
/* | |
О Свободной Алгебре. | |
-------------------- | |
Возможно, кому-то это будет интересно, или даже проложит путь в Scala, которая умеет в котов. | |
Проблема: существует callback из внешнего мира, который передает нам DirectBuffer | |
DirectBuffer это, грубо говоря, кусок памяти. Он предоставляет удобные операции для доступа к этому куску. | |
Но сам кусок не будет валиден после возврата из коллбэка. |
This file contains hidden or 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
/* | |
О Свободной Алгебре. | |
-------------------- | |
Возможно, кому-то это будет интересно, или даже проложит путь в Scala, которая умеет в котов. | |
Проблема: существует callback из внешнего мира, который передает нам DirectBuffer | |
DirectBuffer это, грубо говоря, кусок памяти. Он предоставляет удобные операции для доступа к этому куску. | |
Но сам кусок не будет валиден после возврата из коллбэка. |
This file contains hidden or 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
/** Для решения проблемы с тем, что pattern matching в Scala теряет path dependent types | |
* | |
* @see [[https://gist.github.com/p-pavel/24e63bb9f40ea95fd988787a35ad4d80 this gist]] | |
* можно воспользоваться классикой -- introduce/eliminate | |
*/ | |
object Elimination { | |
import language.higherKinds |
This file contains hidden or 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
trait A { | |
type T | |
val t : T | |
} | |
object A { | |
def unapply(arg: A): Option[arg.T] = Some(arg.t) | |
} | |
def use(a : A) = a match { |
NewerOlder