Skip to content

Allow cycles in class declarations

In particular, I would like to have a class hierarchy that looks like:

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}

type family Scalar x

class Field (Scalar x) => Vector x

class Vector x => Field x

It is the case that every field is a vector, and the scalar associated with every vector is a field. But we can't currently enforce that.

Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information