Skip to content

Latest commit

 

History

History
102 lines (69 loc) · 6.14 KB

Limits.MD

File metadata and controls

102 lines (69 loc) · 6.14 KB

ADT (Algebra of types)

  • Resources
    • Haskell wiki ADT
    • Simple Algebraic Data Types - Bartosz Milewski blog post
    • Category Theory 5.2: Algebraic data types - Bartosz Milewski video
    • Counting type inhabitants - Alexander Konovalov blog post

Unit

Type that has only one element

Void

Type that has no elements. In Category Theory - Initial Object

Sum (Coproduct)

Type represents either one or another element. In set theory: disjoint union in Category theory: coproduct (sum).

Product

Type represents combination of two types. In Set theory cartesian product, in Category Theory product.

These

Type that represents both sum and product (Non exclusive two values):

Tuple(a,b) => a * b Eiter(a,b) => a + b These(a,b) => (a + b) + a*b

sealed trait These[A,B]
case class This[A, B](a: A) extends These[A,B]
case class That[A,B](b: B) extends These[A,B]
case class Those[A,B](a: A, b: B) extends These[A,B]
  • There is many abstractions that can be implemented for this data type

Implementations Scalaz Haskell

Limits

Cone

Cocone

Diagonal Functor

Limit

Colimit