PS

2014-06-01から1ヶ月間の記事一覧

Monad transformer

Inhabited set 空でない集合のこと。 Pointed set 集合とその要素のペア: からなる代数的構造。このとき、 はinhabited。 Pointed object category: terminal -object: について、 -object: -morphism: のペア(からなる代数的構造) をpointed objectという。…

Category of monads

Monoidal category Monoidal category: とは、 category: bifunctor: (monoidal product) -object: (unit object) natural isomorphism: (associator) natural isomorphism: (left unitor) natural isomorphism: (right unitor) で、pentagon equalityとtria…

String interpolationによるextractor

Processed string literalの展開 foo"t0${x1}t1 ... ${xn}tn" は、 new StringContext("t0", "t1", ... , "tn").foo(x1, ..., xn) のように展開される・・・のだが、これが有効な式でさえあればよいらしく、 extractorも返せてしまうようだ。*1 例 implicit cla…

Free monad

Initial algebraの族からのadjunction category: endofunctor: forgetful functor: について、initial algebraの族: が存在するならば、Initial algebras with parameters - PSより、これをnaturalにするfunctor: を作ることが出来る。いま、 とすると は、i…

Constant expressions

Constant expressions SLS 6.24より、constant expressionとは(基本的に)以下のいずれかである: A literal of a value class, such as an integer A string literal A class constructed with Predef.classOf An element of an enumeration from the underly…

showCode

showCode Scala 2.11からshowCodeというすごいmethodが追加されており、 これは「コンパイル可能な文字列を返す」ということで、 c.TreeとStringが相互に変換可能になっている。 object Parse { def apply(x: String): Any = macro Impl.apply final class I…