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 Elipse(val width: Double, val height: Double) | |
// circle is a special case of elispse where width and height are the same | |
class Circle(r: Double) extends Elipse(r, r) | |
// typeclass to calculate the Area of a T | |
trait Area[-T] { | |
def area(t: T): Double | |
} |
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 cats | |
package effect | |
import java.util.concurrent.CountDownLatch | |
/** | |
* A computation of an A value | |
*/ | |
sealed trait Comp[A] { | |
import Comp._ |
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
convert -quality 100 -density 300x300 strace-zine.pdf'[0,2,4,6]' 'strace-single%d.gif | |
convert -quality 100 -density 300x300 strace-zine.pdf'[1,3,5,7]' -rotate 180 'strace-single%d.gif' | |
convert strace-single<0-8>.gif strace-fixed.pdf #<0-8> is probably a zsh only thing, * would probably work ⏎ |
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
from abc import ABCMeta, abstractmethod | |
import sys | |
# lets get one thing straight right out of the box: | |
def fail(e): | |
import traceback | |
with open("/tmp/tb", "w") as f: | |
traceback.print_exc(e, f) |
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 Maybe._ | |
case class CofreeNEL[A](cf: Cofree[Maybe, A]) { | |
def +:(a: A): CofreeNEL[A] = CofreeNEL(Cofree(a, just(cf))) | |
def head: A = cf.head | |
def tail: Maybe[CofreeNEL[A]] = cf.tail.map(CofreeNEL.apply) | |
def map[B](f: A=>B): CofreeNEL[B] = CofreeNEL(cf map f) | |
def flatMap[B](f: A => CofreeNEL[B]): CofreeNEL[B] = CofreeNEL(Bind[({type l[A]=Cofree[Maybe, A]})#l].bind(cf)(f andThen (_.cf))) |
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._ | |
object IsItAProfunctor extends App { | |
case class Foo(f: Double) | |
val validateDouble: Double ⇒ Validation[String,Double] = {d ⇒ | |
if(d < 0) "less than zero".fail | |
else d.success |
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
trait MyOption[+A] { | |
// single abstract method | |
def cata[X](some: A => X, none: => X): X | |
def map[B](f: A => B): MyOption[B] = error("todo") | |
def flatMap[B](f: A => MyOption[B]): MyOption[B] = error("todo") | |
def getOrElse[AA >: A](e: => AA): AA = error("todo") | |
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 maybe | |
sealed trait Maybe[A] { | |
def isEmpty: Boolean | |
} | |
case class Just[A](a: A) extends Maybe[A] { | |
override final def isEmpty = 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
❯ date -d "9 fortnights ago" | |
Wed Apr 2 21:46:42 EDT 2014 | |
❯ date -d "9.5 fortnights ago" | |
date: invalid date ‘9.5 fortnights ago’ | |
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
Changes from HEAD to working tree | |
2 files changed, 19 insertions(+), 10 deletions(-) | |
core/src/main/scala/scalaz/IList.scala | 16 ++++++++++------ | |
core/src/main/scala/scalaz/Maybe.scala | 13 +++++++++---- | |
Modified core/src/main/scala/scalaz/IList.scala | |
diff --git a/core/src/main/scala/scalaz/IList.scala b/core/src/main/scala/scalaz/IList.scala | |
index 946ad98..7e383c7 100644 | |
--- a/core/src/main/scala/scalaz/IList.scala | |
+++ b/core/src/main/scala/scalaz/IList.scala |