map :: F[A] => (A => B) => F[B]
flatMap :: F[A] => (A => F[B]) => F[B]
traverse :: G[A] => (A => F[B]) => F[G[B]]
flatTraverse :: G[A] => (A => F[G[B]]) => F[G[B]]
traverse_ :: F[A] => (A => F[B]) => F[Unit]
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 zio | |
object PathDependentTypes { | |
val zio1: ZIO[Any, Nothing, Int] = ZIO.succeed(1) | |
val zio2: ZIO[Any, Nothing, Int] = ZIO.succeed(2) | |
val zio3: ZIO[Any, Nothing, Int] = ZIO.succeed(3) | |
val zio4 = zio1 <*> zio2 <*> zio3 <*> zio1 <*> zio2 |
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
/** | |
* Code Snippets from the Blog Post "Basic Recursion Schemes in Scala", | |
* https://www.47deg.com/blog/basic-recursion-schemes-in-scala/ | |
* | |
* Written here to accompany the article. This file should compile directly if inserted into ammonte. | |
*/ | |
object IListBase { | |
sealed trait IList | |
case object INil extends IList | |
case class ICons(head: Int, tail: IList) extends IList |
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 java.util.Properties | |
import scala.collection.JavaConverters._ | |
import org.apache.kafka.clients.consumer.{ConsumerConfig, ConsumerRecords, KafkaConsumer} | |
import org.apache.kafka.common.serialization.StringDeserializer | |
class Consumer(brokers: String, topic: String, groupId: String) { | |
val consumer = new KafkaConsumer[String, String](configuration) | |
consumer.subscribe(List(topic).asJava) |
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
lazy val Profile = config("profile") extend(Runtime) | |
lazy val commonSettings = Seq( | |
organization := "organization", | |
version := "0.0.1", | |
scalaVersion := "2.12.0", | |
scalacOptions ++= Seq( | |
"-encoding", "utf8", | |
"-deprecation", | |
"-feature", |
Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'
Example: To get json record having _id equal 611
cat my.json | jq -c '.[] | select( ._id | contains(611))'
Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
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
Upon completion you will have a sane, productive Haskell environment adhering to best practices.
- Haskell is a programming language.
- Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
- Intellij IDEA IDE is a popular IDE.
sudo apt-get install libtinfo-dev libghc-zlib-dev libghc-zlib-bindings-dev
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
# coding: utf8 | |
from __future__ import unicode_literals | |
maketrans = lambda A, B: dict((ord(a), b) for a, b in zip(A, B)) | |
buckwalter_transliteration = maketrans('\'>&<}AbptvjHxd*rzs$SDTZEg_fqklmnhwYyFNKaui~o^#`{:@"[;,.!-+%]', 'ءأؤإئابةتثجحخدذرزسشصضطظعغـفقكلمنهوىيًٌٍَُِّْٓٔٱۣۜ۟۠ۢۥۦ۪ۭۨ۫۬') | |
# usage | |
print 'r~aHoma`ni'.translate(buckwalter_transliteration) |
NewerOlder