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> res8 | |
res9: Option[Int] = | |
Some(HttpResponse(200 OK)) | |
scala> res9.get | |
java.lang.ClassCastException: spray.http.HttpResponse cannot be cast to Int | |
at .<init>(<console>:33) |
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 spray.httpx.unmarshalling._ | |
import spray.httpx.unmarshalling._ | |
scala> implicitly[FromResponseUnmarshaller[Any]] | |
res2: spray.httpx.unmarshalling.FromResponseUnmarshaller[Any] = <function1> |
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> :t List(Vector(1), List(2)) | |
List[scala.collection.immutable.Seq[Int] with scala.collection.AbstractSeq[Int]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq{def dropRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def takeRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def drop(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def take(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]}]; def dropRight(n: Int): scala.collection.immutable.Seq[Int] with scala.collection.AbstractSeq[Int]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Int] with scal |
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
Rúnar Bjarnason |
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
object Trampolines { | |
def odd[A](as: List[A]): TailRec[Boolean] = | |
as match { | |
case Nil => Return(false) | |
case _ :: xs => Suspend(() => even(xs)) | |
} | |
def even[A](as: List[A]) = as match { | |
case Nil => Return(true) | |
case _ :: xs => Suspend(() => odd(xs)) |
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 \/._ | |
import Free._ | |
import scalaz.syntax.monad._ | |
import java.util.concurrent.atomic.AtomicReference | |
import java.util.concurrent.CountDownLatch | |
object Experiment { | |
sealed trait OI[A] { | |
def map[B](f: A => B): OI[B] |
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
Stefnuyfirlýsing fyrir "Ekki einungis hlutbundna hugbúnaðargerð" | |
Við erum að uppgötva betri leiðir til hugbúnaðargerðar með því að framkvæma hana og hjálpa öðrum að framkvæma. Í gegnum þessa vinnu höfum við lært að meta: | |
Föll og tög umfram klasa | |
Hreinleika umfram hverflyndi | |
Samsetningu umfram erfðir | |
Föll af hærra stigi umfram stefjuhespun | |
Aleindir umfram gildisleysi |
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 a recent "Bad Astronomy" post: | |
"We know the Universe is expanding; everywhere we look, it appears that galaxies are rushing away from us. If we run the clock backwards, this means the Universe was smaller in the past, and at some point must have had (nearly) zero volume. This point in time is commonly referred to as the Big Bang, when the expansion of the Universe started. 13.82 billion years later, here we are." | |
This is pure rationalism from beginning to end. Rationalism is a philosophical approach that clings to deductive proof as the standard of knowledge. So you move from one thing to the next by syllogism, and there is no essential difference between a true premise and a false one. We look at galaxies and see that they are redshifted, redshift is caused by motion away from the observer therefore the galaxies are rushing away from us, therefore the universe is expanding, therefore it _must_ have had (nearly) zero volume at some point, therefore Big Bang. It all depends on several logical leaps of d |
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
ghci> data OneOf :: [*] -> * where Zero :: a -> OneOf (a ': xs); Succ :: OneOf xs -> OneOf (a ': xs) | |
ghci> let foo = Zero 'a' | |
ghci> let bar = Succ (Zero 42) | |
ghci> let baz = Succ (Succ (Zero True)) | |
ghci> :t [foo, bar, baz] | |
[foo, bar, baz] | |
:: [OneOf ((':) * Char ((':) * Integer ((':) * Bool xs)))] | |
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> 0.toByte.toInt | |
res5: Int = 0 | |
scala> 0.toByte.toInt.abs | |
<console>:8: error: implicit numeric widening | |
0.toByte.toInt.abs | |
^ | |
scala> res5.abs | |
res7: Int = 0 |
OlderNewer