google-research / dex-lang

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

Can't put functions in structs or data constructors #1338

Open duvenaud opened 9 months ago

duvenaud commented 9 months ago

I'm trying to make a custom datatype that carries around a function. This used to work, but seems to have been broken by the new syntax. For example:

data SortsBy(a) =
  MkSortsBy(less_than:(a -> Bool))
Syntax error: Argument types should be in parentheses

  MkSortsBy(less_than:(a -> Bool))
                         ^^^

If this change was deliberate, then the error message is confusing.