SPC q q
- quitSPC w /
- split window verticallySPC w
- - split window horizontallySPC 1
- switch to window 1SPC 2
- switch to window 2SPC w c
- delete current windowSPC TAB
- switch to previous bufferSPC b b
- switch buffers
This file contains hidden or 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 cps { | |
/** | |
* | |
* The code below translates this blog post | |
* http://blog.infinitenegativeutility.com/2016/8/resources--laziness--and-continuation-passing-style) | |
* into scala, and uses laziness where appropriate to highlight the issue. | |
* | |
* I also include a type for IO. This is mainly illustrative, but also ensures | |
* we "sequence" actions appropriately. Haskell's IO monad works in tandem with the |
This file contains hidden or 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 monocle | |
import scalaz._, Scalaz._ | |
import Indexable._ | |
abstract class IPTraversal[I, S, T, A, B] { | |
def modifyF[ | |
F[_]: Applicative, |
This file contains hidden or 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 scalaz | |
import collection.generic.CanBuildFrom | |
class TraversableW[Coll, A](val value: Coll)(implicit ev: Coll <:< Traversable[A]) { | |
def as[CC[X] <: Traversable[X]](implicit cbf1: CanBuildFrom[Coll, A, CC[A]] = null, cbfDefault: CanBuildFrom[Nothing, A, CC[A]]): CC[A] = { | |
Option(cbf1) match { | |
case Some(cbf) => | |
// A direct builder exists from the source collection to the target | |
cbf(value).result |
This file contains hidden or 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>Fixed Point Combinator is:</b> | |
* Y = λf.(λx.f (x x)) (λx.f (x x)) | |
* | |
* <b>Proof of correctness:</b> | |
* Y g = (λf . (λx . f (x x)) (λx . f (x x))) g (by definition of Y) | |
* = (λx . g (x x)) (λx . g (x x)) (β-reduction of λf: applied main function to g) | |
* = (λy . g (y y)) (λx . g (x x)) (α-conversion: renamed bound variable) | |
* = g ((λx . g (x x)) (λx . g (x x))) (β-reduction of λy: applied left function to right function) | |
* = g (Y g) (by second equality) [1] |
This file contains hidden or 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 Companion[T] { | |
type C | |
def apply() : C | |
} | |
object Companion { | |
implicit def companion[T](implicit comp : Companion[T]) = comp() | |
} | |
object TestCompanion { |
This file contains hidden or 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
-- Adapted from these sources: | |
-- http://peterdowns.com/posts/open-iterm-finder-service.html | |
-- https://gist.github.com/cowboy/905546 | |
-- https://gist.github.com/ttimasdf/7bb02ed419db4b472b534e1a57008a3b | |
-- | |
-- Modified to work with files as well, cd-ing to their container folder | |
on run {input, parameters} | |
tell application "Finder" | |
set my_file to first item of input | |
set is_folder to (do shell script "file -b " & quoted form of (POSIX path of my_file)) |
This file contains hidden or 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 | |
import cats.data.{StateT, WriterT} | |
import cats.implicits._ | |
/** | |
* TypeLevel is working on some alternative encodings of the Monad Transformer | |
* Library (MTL). The existing solution in cats was broken for a few reasons. | |
* One annoying issue made it imposisible to use for-comprehension with more | |
* than one Monad$FOO constraint owing to implicit resolution ambiguities. |
This file contains hidden or 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
/** | |
* Created by ariwaranosai on 16/8/28. | |
* | |
*/ | |
import ST._ | |
case class World[S]() | |
case class ST[S, A](f: World[S] => (World[S], A)) { |