Top "Algebraic-data-types" questions

Algebraic data types are data structures built from sums, products and recursive types, admitting an algebra.

How do you represent a graph in Haskell?

It's easy enough to represent a tree or list in haskell using algebraic data types. But how would you go …

haskell types graph functional-programming algebraic-data-types
What is the DataKinds extension of Haskell?

I am trying to find an explanation of the DataKinds extension that will make sense to me having come from …

haskell types algebraic-data-types data-kinds
Abusing the algebra of algebraic data types - why does this work?

The 'algebraic' expression for algebraic data types looks very suggestive to someone with a background in mathematics. Let me try …

haskell functional-programming algebraic-data-types miranda
Haskell's algebraic data types

I'm trying to fully understand all of Haskell's concepts. In what ways are algebraic data types similar to generic types, …

data-structures haskell types functional-programming algebraic-data-types
Kotlin and discriminated unions (sum types)

Does Kotlin have anything like discriminated unions (sum types)? What would be the idiomatic Kotlin translation of this (F#): type …

kotlin algebraic-data-types discriminated-union
Haskell record pattern matching

I'm looking for a way to simplify function patterns when the actual data is not required: data X = A | B …

haskell pattern-matching record algebraic-data-types
If case class inheritance is prohibited, how to represent this?

I am trying to create the case classes as explained in this article sealed abstract case class Exp() case class …

scala algebraic-data-types
Best way to define algebraic data types in Python?

I know that Python is NOT Haskell or Ocaml, but which is the best way to define algebraic data types …

python algebraic-data-types
Java tagged union / sum types

Is there any way to define a sum type in Java? Java seems to naturally support product types directly, and …

java haskell algebraic-data-types
C++ equivalent of algebraic datatype?

Let's say I have this Haskell code: data RigidBody = RigidBody Vector3 Vector3 Float Shape -- position, velocity, mass and shape …

c++ haskell algebraic-data-types