Skip to content

Instantly share code, notes, and snippets.

@aripiprazole
Created August 21, 2022 01:00
Show Gist options
  • Save aripiprazole/f5e6f89592dc991fa8b361fa9c0f56d7 to your computer and use it in GitHub Desktop.
Save aripiprazole/f5e6f89592dc991fa8b361fa9c0f56d7 to your computer and use it in GitHub Desktop.
package ekko.tree
/**
* Types can be quantified by adding a list of predicates [predicates], to restrict
* the ways in which type variables is instantiated.
*
* Example of `Num a => a`(in haskell):
* ```kt
* val predicates = listOf(IsIn(TVar(Ident("a", KStar), Ident("Num"))))
*
* Qual(predicates, TVar(Ident("a", KStar)))
* ```
*/
data class Qual<A>(val predicates: Set<Pred>, val value: A)
sealed interface Pred
data class IsIn(val typ: Typ, val id: Ident) : Pred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment