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
✘╹◡╹✘ < sbt run | |
[info] Set current project to scala-playground (in build file:/Users/aereal/devel/src/github.com/aereal/scala-playground/) | |
[info] Compiling 1 Scala source to /Users/aereal/devel/src/github.com/aereal/scala-playground/target/scala-2.11/classes... | |
[error] /Users/aereal/devel/src/github.com/aereal/scala-playground/App.scala:7: not found: type ? | |
[error] val v = Applicative[ValidationNel[String, ?]] | |
[error] ^ | |
[error] /Users/aereal/devel/src/github.com/aereal/scala-playground/App.scala:7: scalaz.ValidationNel[String,<error>] takes no type parameters, expected: one | |
[error] val v = Applicative[ValidationNel[String, ?]] | |
[error] ^ | |
[error] /Users/aereal/devel/src/github.com/aereal/scala-playground/App.scala:7: ambiguous implicit values: |
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
<b>The source for Scalaz is now hosted on !GitHub - http://github.com/scalaz/scalaz</b> | |
Scalaz is a library written in the [http://scala-lang.org/ Scala Programming Language]. The intention of Scalaz is to include general functions that are not currently available in the core Scala API. The scalaz-core module depends only on [http://www.scala-lang.org/docu/files/api/index.html the core Scala API] and the core Java 2 Standard Edition API. Scalaz is released under a BSD open source licence making it compatible with the licence of the Scala project. | |
[http://code.google.com/p/scalaz/wiki/Scalaz6 Scalaz 6.0.4] was released in January 2012, targeting Scala 2.8.1, 2.9.0.1, 2.9.1 and 2.10.0-M1. [http://scala-tools.org/repo-releases/org/scalaz/scalaz-full_2.9.1/6.0.4/scalaz-full_2.9.1-6.0.4.jar Full download for 2.9.1] | |
[Scalaz7 Scalaz 7] is currently being developed. This is a rewrite to address the challenges posed by type class inheritance. The first release of this series is expected in April 2012. | |
== Community |
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 bash | |
# | |
# File: kafka-move-leadership.sh | |
# | |
# Description | |
# =========== | |
# | |
# Generates a Kafka partition reassignment JSON snippet to STDOUT to move the leadership | |
# of any replicas away from the provided "source" broker to different, randomly selected | |
# "target" brokers. Run this script with `-h` to show detailed usage instructions. |
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 scala.collection.JavaConversions._ | |
case class Foo(s: String) | |
val map: Map[Foo, String] = | |
Map( | |
Foo("a") -> "a", | |
Foo("b") -> "b") | |
val v = map.get("a") // should be a type error, actually returns null |
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
# Note: You MUST have curl 7.47+ with http/2 support compiled in | |
curl -v \ | |
-d '{"aps":{"alert":"<message>","badge":42}}' \ | |
-H "apns-topic: <bundle id>" \ | |
-H "apns-priority: 10" \ | |
--http2 \ | |
--cert <certificate file> \ | |
https://api.development.push.apple.com/3/device/<device token> |
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
class TC[A](val x: String) | |
object TC { | |
def getX[A: TC](a: A): String = implicitly[TC[A]].x | |
implicit def anyTC[A]: TC[A] = new TC[A]("*") | |
implicit val stringTC: TC[String] = new TC[String]("String") | |
} | |
object Example { |
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.std.string._ | |
import scalaz.std.list._ | |
import scalaz.{Semigroup, Monoid, Functor, Applicative} | |
trait Foo[A] { | |
override def toString: String = "Foo" | |
} | |
trait Foo2[A] extends Foo[A] { | |
override def toString: String = "Foo2" |
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 scala.collection.mutable.ListBuffer | |
object ListBufferTest extends App { | |
new X().runTest() | |
} | |
class X extends Runnable { | |
var x: List[String] = List("", "") | |
def run() { |
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
/** | |
* In classic Scala implementation of hierarchies of Category theory laws (scalaz/cats), the dependency between | |
* different laws is encoded using inheritance (https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/Monad.scala#L14) | |
* | |
* This approach creates well-known issues: for example, a Monad is able to _derive_ an Applicative. | |
* So sometimes, you don't have the Applicative you want but the one derived from the Monad or it doesn't | |
* compile because you have 2 Applicatives in your implicit scope. | |
* | |
* Alois Cochard has proposed a new model to represent that in (scato project)[https://github.com/aloiscochard/scato] or | |
* (scalaz/8.0.x)[https://github.com/scalaz/scalaz/blob/series/8.0.x/base/src/main/scala/typeclass/Monad.scala] branch. |
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
# LVDB - LLOOGG Memory DB | |
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com> | |
# All Rights Reserved | |
# TODO | |
# - cron with cleanup of timedout clients, automatic dump | |
# - the dump should use array startsearch to write it line by line | |
# and may just use gets to read element by element and load the whole state. | |
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands. | |
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump! |