Skip to content

Instantly share code, notes, and snippets.

View adilakhter's full-sized avatar

Adil Akhter adilakhter

View GitHub Profile

Standardized Ladder of Functional Programming

The LambdaConf Ladder of Functional Programming (LOFP) is a standardized progression of different concepts and skills that developers must master on their journey to becoming expert-level functional programmers. LOFP can be used to rank workshops, talks, presentations, books, and courseware, so that aspiring functional programmers have a better understanding of what material is appropriate for them given their current experience.

Novice

Concepts

  • Immutable Data
  • Second-order Functions
import scala.annotation.implicitNotFound
import scala.util._
import cats.implicits._
object domain {
case class SimpleRecord(name: String, cl: Double)
final case class ColumnDef[T](name: String, startIndex: Int, endIndexExclusive: Int, transformer: String ⇒ T)
@implicitNotFound("Do not support transformation to type ${T}")
@adilakhter
adilakhter / InvertTree.sc
Created October 13, 2020 10:00
InvertTree.sc
sealed trait Tree[+A]
case object EmptyTree extends Tree[Nothing] {
override def toString = "nil"
}
case class Node[A] (l: Tree[A], v: A, r: Tree[A]) extends Tree[A]
object Tree {
def empty[A]: Tree[A] = EmptyTree
def node[A](value: A, left: Tree[A] = empty, right: Tree[A] = empty): Tree[A]
= Node(left, value, right)
object Ex11 extends IOApp {
def naiveParMapN[A, B] (io1: IO[A], io2: IO[B]): IO[(A, B)] = {
io1.start.bracket { f1 =>
io2.start.bracket { f2 =>
for {
a <- f1.join
b <- f2.join
} yield (a, b)
}(_.cancel)
}(_.cancel)
@adilakhter
adilakhter / KafkaReadAndWriteExample.scala
Last active September 21, 2018 10:08
Flink Kafka read and write example
package org.xiaon
import grizzled.slf4j.Logging
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.apache.flink.api.java.utils.ParameterTool
import org.apache.flink.streaming.api.TimeCharacteristic
import org.apache.flink.streaming.api.functions.sink.SinkFunction
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import org.apache.flink.streaming.connectors.kafka.{FlinkKafkaConsumer011, FlinkKafkaProducer011}
@adilakhter
adilakhter / typeclass.scala
Last active September 3, 2018 11:08
refactoring to typeclass
object typeclass extends App {
// Note: This domain model was given
// Simplified version is as follows:
sealed trait Attribute
case class PageLoad (e: String) extends Attribute
case class AdobeSinkableItem(e: String) extends Attribute
case class WebtrekkSinkableItem(e: Int) extends Attribute
@adilakhter
adilakhter / Json.scala
Created December 28, 2017 19:00 — forked from pchiusano/Json.scala
Simple JSON parser combinator library that does not use zippers
// WARNING! totally untested, I have only compiled the code! :)
package json
import collection.immutable.Map
import scalaz.{\/, MonadPlus}
import scalaz.\/._
import scalaz.std.vector._
import scalaz.std.map._
import scalaz.std.list._

Keybase proof

I hereby claim:

  • I am adilakhter on github.
  • I am adilakhter (https://keybase.io/adilakhter) on keybase.
  • I have a public key ASD6P7AcPLIIXV4C08q7BvryfkizCfnJejXOlBYaDWDhCAo

To claim this, I am signing this object: