Skip to content

Instantly share code, notes, and snippets.

object main {
implicit val sharding: ClusterSharding = ClusterSharding(system)
val cluster: Cluster = Cluster(system)
val selfMember = cluster.selfMember
if (selfMember.hasRole("intake")) {
val messageExtractor = new HashCodeNoEnvelopeMessageExtractor[PollingCommand](numberOfShards = 1) {
override def entityId(message: PollingCommand): String = message.getClass.getSimpleName
}
> $ ./tonos-cli account -1:4f6094673d0e94d3d73c269ff7dbccc9839c8c81469f30b72fb46b7e2948d86e
Input arguments:
address: -1:4f6094673d0e94d3d73c269ff7dbccc9839c8c81469f30b72fb46b7e2948d86e
Processing...
Succeeded.
Account not found.
> $ ./tonos-cli account -1:d83cbc84afe80981103dbca2d31e6a30a8127c9947d9cc3f71116ff3cc49b402
Input arguments:
address: -1:d83cbc84afe80981103dbca2d31e6a30a8127c9947d9cc3f71116ff3cc49b402
Processing...
@slavaschmidt
slavaschmidt / recursion schemes.scala
Created February 13, 2019 19:32 — forked from monaddle/recursion schemes.scala
Recursion schemes implemented in Scala using Matroyshka. They don't all make sense or anything, but they compile and run. lo
package prestwood
// Examples of recursion scheme implementations using matroysha. Mostly they're not that useful,
// and I really only got three tricks down, but they're good tricks:
// 1. Collect information across an AST using a Writer monad
// 2. Modify AST nodes in place
// 3. Annotate AST nodes with arbitrary types
@slavaschmidt
slavaschmidt / abstractClassTest.scala
Created January 15, 2018 14:37
An example of an abstract class definition breaking compilation of spray-shapeless dependent code
import fommil.sjs.FamilyFormats
import shapeless.cachedImplicit
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
sealed trait SomeTrait {
def key: String
def value: String
}

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
---
swagger: '2.0'
info:
version: 0.0.0
title: API
paths:
/api:
post:
parameters:
- in: body
module Lab2 where
------------------------------------------------------------------------------------------------------------------------------
-- Lab 2: Validating Credit Card Numbers
------------------------------------------------------------------------------------------------------------------------------
-- ===================================
-- Ex. 0
-- ===================================