Skip to content

Instantly share code, notes, and snippets.

View rohinp's full-sized avatar

Rohin rohinp

  • Amsterdam, The Netherlands
View GitHub Profile
@rohinp
rohinp / DS.scala
Last active July 25, 2020 16:02
FP data structures
/*
1. Algebraic data type (ADT)
2. Recursive types
3. Parametric Polymorphism in ADT
4. Function and Curring
5. All about making things lazy
6. Typeclasses to add features on our data structure
7. Extending with syntax and operators
8. Optimization and analysis of implementation
object OddNumScala2 {
sealed trait Num
object Num {
case object Zero extends Num
case class Succ[N <: Num](num: N) extends Num
}
@implicitNotFound("Odd number type not satisfied.")
trait OddNum[N <: Num]
@rohinp
rohinp / DummyFile.scala
Last active December 17, 2022 15:32
Gist for the blog FunctionDay0
object DummyFile:
case class File( `type`:File.Type, content:String)
object File:
enum Type:
case TEXT, PRESENTATION, AUDIO, VIDEO, UNKNOWN
end File
end DummyFile