Skip to content

Instantly share code, notes, and snippets.

@hexx
hexx / Macros.scala
Created September 12, 2012 06:38
rpscala86-hygiene.scala
import language.experimental.macros
import scala.reflect.macros.Context
object Macros {
def nonHygienicA(): Int = macro MacrosImpl.nonHygienicAImpl
def hygienicA(): Int = macro MacrosImpl.hygienicAImpl
}
@hexx
hexx / rpscala84-2.scala
Created August 3, 2012 09:37
rpscala84-2.scala
type DP = (T, T => Boolean) forSome { type T }
@hexx
hexx / rpscala84-1.hs
Created August 3, 2012 09:36
rpscala84-1.hs
{-# LANGUAGE ExistentialQuantification #-}
data DP = forall a. DP a (a -> Bool)
@hexx
hexx / rpscala83-7.scala
Created July 21, 2012 03:15
rpscala83-7.scala
def foo[B](f[A]: A => List[A], b: B, c: Int) = (f(b), f(c))
def foo[A, B](f: A => List[A], b: B, c: Int) = (f(b), f(c))
@hexx
hexx / rpscala83-5.hs
Created July 21, 2012 03:05
rpscala83-5.hs
foo2 :: forall a b. (a -> [a]) -> b -> Int -> ([b], [Int])
foo2 f b c = ((f b), (f c))
bar2 :: forall b. (forall a. a -> [a]) -> b -> Int -> ([b], [Int])
bar2 f b c = ((f b), (f c))
@hexx
hexx / rpscala83-4.hs
Created July 21, 2012 03:02
rpscala83-4.hs
{-# LANGUAGE RankNTypes #-}
bar :: (forall a. a -> [a]) -> b -> Int -> ([b], [Int])
bar f b c = ((f b), (f c))
@hexx
hexx / rpscala83-3.hs
Created July 21, 2012 03:00
rpscala83-3.hs
foo :: (a -> [a]) -> b -> Int -> ([b], [Int])
foo f b c = ((f b), (f c))
@hexx
hexx / rpscala83-2.scala
Created July 21, 2012 02:57
rpscala83-2.scala
(List("hoge"), List(1))
@hexx
hexx / rpscala83-1.scala
Created July 21, 2012 02:54
rpscala83-1.scala
foo(toList, "hoge", 1)