| Symbol | Explanation | Hint |
|---|---|---|
\/ |
Right-leaning Either | Split ways, go one way or the other |
-\/ |
Left value of \/ |
- is on the left side |
\/- |
Right value of \/ |
- is on the right side |
>>= |
flatMap |
shove result into |
>> |
flatMap(_ => ..) |
shove into, but ignore the result |
|@| |
Applicatives into Tuple | Scream operator |
|+| |
Append via Monoid | + was taken |
| `> | ` | fa.map(_ => b) |
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
| module Codec exposing (..) | |
| import Json.Encode as Encode | |
| type alias Listy = { a : List Int, b : Maybe String } | |
| encodeListy : Listy -> Encode.Value | |
| encodeListy obj = Encode.object | |
| [ ("a", Encode.list Encode.int obj.a) | |
| , ("b", Maybe.withDefault Encode.null Encode.string obj.b) | |
| ] |
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
| import org.http4s._ | |
| import org.http4s.client._ | |
| import scalaz.concurrent.Task | |
| object TestClient { | |
| def apply(service: Service[Request, Response]) = | |
| Client( | |
| service.map(resp => DisposableResponse(resp, Task(()))), | |
| Task(()) | |
| ) |
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
| // Mostly borrowed from https://github.com/playframework/playframework/blob/a5decc4ec81d311a769208ce007771a1e45b570b/framework/src/play/src/main/scala/play/api/libs/crypto/Crypto.scala | |
| // but with less Inject | |
| import org.atnos.eff._, org.atnos.eff.syntax.eff._, org.atnos.eff.syntax.all._, org.atnos.eff.all._ | |
| import scalaz._, Scalaz._ | |
| import java.time._ | |
| import javax.crypto.{ Cipher, Mac } | |
| import javax.crypto.spec.{ IvParameterSpec, SecretKeySpec } | |
| import org.apache.commons.codec.binary.Hex |
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
| [error] BestFirstSearch.scala:279 Failed to format | |
| UNABLE TO FORMAT, | |
| tok=case∙p1 | |
| state.length=0 | |
| toks.length=3279 | |
| deepestYet.length=921 | |
| policies=Vector(P:128(D=false), P:410(D=false), P:128(D=false), P:128(D=false)) | |
| nextSplits=List(Space:885(cost=0, indents=[], P:887(D=true)), Space:888(cost=1, indents=[2, 2], P:889(D=false))) | |
| splitsAfterPolicy=Decision(case∙p1,List(Space:885(cost=0, indents=[], P:887(D=true)), Space:888(cost=1, indents=[2, 2], P:889(D=false)))) | |
| [error] BestFirstSearch.scala:279 Failed to format |
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
| {-# OPTIONS_GHC -fglasgow-exts #-} | |
| import XMonad | |
| import XMonad.Operations | |
| import XMonad.Actions.Commands | |
| import XMonad.Actions.CycleWS | |
| import XMonad.Actions.DeManage | |
| import qualified XMonad.Actions.DynamicWorkspaces as DW | |
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
| name := "scala-playground" | |
| version := "0.1-SNAPSHOT" | |
| organization := "org.reactormonk" | |
| scalaVersion := "2.11.1" | |
| resolvers ++= Seq( | |
| "ScalaNLP Maven2" at "http://repo.scalanlp.org/repo", |
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
| /* Generated by the Nimrod Compiler v0.9.1 */ | |
| /* (c) 2013 Andreas Rumpf */ | |
| var Globals = this; | |
| var framePtr = null; | |
| var excHandler = null; | |
| var NTI842 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; | |
| var NTI808 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; | |
| var NTI140 = {size: 0,kind: 28,base: null,node: null,finalizer: null}; |
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
| class Array | |
| def avp | |
| each_with_index.with_object(correct: 0.0).map {|(element, index), keep| | |
| relevant = block_given? ? yield(element) : element | |
| if relevant | |
| # if the element is relevant (truy or by block) | |
| keep[:correct] += 1 | |
| keep[:correct] / (index + 1) | |
| end | |
| }.compact |
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
| ;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
| ;; If you want to create a file, visit that file with C-x C-f, | |
| ;; then enter the text in that file's own buffer. | |