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 annotation.unchecked.uncheckedVariance | |
import reflect.runtime.universe.TypeTag | |
package object stuff { | |
// required for the better ??? operator | |
type MyTypeTag[+A] = TypeTag[A @uncheckedVariance] | |
def ???[A](implicit tag: MyTypeTag[A]): A = | |
throw new NotImplementedError(s"unimplemented value of type ${tag.tpe}") | |
} |
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
package com.codecommit.misc | |
import scalaz._ | |
import scalaz.concurrent.Task | |
import scalaz.iteratee._ | |
import scalaz.stream._ | |
object conversion { | |
// TODO generalize to EmitterT |
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
#!/usr/bin/env zsh | |
# in fino veritas | |
# Borrowing shamelessly from these oh-my-zsh themes: | |
# fino-time | |
# pure | |
# https://gist.github.com/smileart/3750104 | |
# Set required options |
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
/** | |
* "Select" off the first future to be satisfied. Return this as a | |
* result, with the remainder of the Futures as a sequence. | |
* | |
* @param fs a scala.collection.Seq | |
*/ | |
def select[A](fs: Seq[Future[A]])(implicit ec: ExecutionContext): Future[(Try[A], Seq[Future[A]])] = { | |
@tailrec | |
def stripe(p: Promise[(Try[A], Seq[Future[A]])], | |
heads: Seq[Future[A]], |
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
Please help compile a list of all Scala-related IRC rooms. | |
All of these channels are on Freenode. | |
#akka | concurrency & distribution framework | |
#argonaut | json library | |
#fp-in-scala | the book Functional Programming in Scala | |
#geotrellis | geoprocessing library | |
#indyscala | regional scala group | |
#json4s | json library |
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
/** | |
* this is an experiment to create unboxed union types with a phantom type and a context bound. | |
* All the good ideas come from @milessabin post, comments and links: http://www.chuusai.com/2011/06/09/scala-union-types-curry-howard/#comment-22 | |
*/ | |
/** trait for anything that can be A or B */ | |
trait Or[A, B] { | |
// a phantom type, there will be no instance of this type that we'll use | |
type l[T] | |
// an alias for l[t] |
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
-dontwarn org.jboss.netty.logging.** | |
-dontwarn org.osgi.** | |
-dontwarn javax.servlet.** | |
-dontwarn org.jboss.netty.channel.socket.http.** | |
## Unsafe is there at runtime | |
-dontwarn sun.misc.Unsafe | |
-keep class sun.misc.Unsafe{ | |
*; | |
} |
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
scala> import scala.language.experimental.macros | |
import scala.language.experimental.macros | |
scala> def unimplicitlyImpl[A: c.TypeTag](c: reflect.makro.Context) = { | |
| val A = implicitly[c.TypeTag[A]].tpe | |
| val i = c.inferImplicitValue(A, silent = true) | |
| if (i == c.mirror.EmptyTree) c.reify(()) | |
| else sys.error("unexpected implicit of type %s: %s".format(A, i)) | |
| } | |
unimplicitlyImpl: [A](c: scala.reflect.makro.Context)(implicit evidence$1: c.TypeTag[A])c.mirror.Expr[Unit] |
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
[user] | |
name = Paul Phillips | |
email = [email protected] | |
[github] | |
user = $GITHUB_USER | |
token = $GITHUB_TOKEN | |
[clean] | |
requireForce = false | |
[grep] | |
lineNumber = true |
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 scalaz._ | |
import Scalaz._ | |
type List[A] = Forall[({type f[B] = ((A, B) => B, B) => B})#f] | |
val nil: Forall[List] = new Forall[List] { | |
def apply[A] = new List[A] { | |
def apply[B] = (c, n) => n | |
} | |
} |
NewerOlder