google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.58k stars 107 forks source link

Can't interleave class constraints in custom datatype declarations #1123

Closed duvenaud closed 2 years ago

duvenaud commented 2 years ago

Right now I can't find a way to include tables in custom datatypes, because I can't express the Ix constraint before the end of the type declaration.

Here is the closest I got:

data Permuted n:Type [Ix n] (perm:n=>n) =
  MkPermuted n

which gives

MonadFail error (internal error)Invalid class constraint list; expecting one or more bracketed groups

data Permuted n:Type [Ix n] (perm:n=>n) =
                            ^^^^^^^^^^^^