Skip to content

Implement type syntax in the expressions (#24159, #24572)

Andrei Borzenkov requested to merge wip/sand-witch/types-in-terms into master

The code should be totally fine and pass tests, but I didn't write documentation and release notes yet.

I had to fix #24572 to proceed with (->). I suppose that this code should live in a separate commit, but they are all-in-one at the time.

Furthermore, I found another limitation related to type patterns: parser consider type operators as variable bindings, not constructors, e.g.:

type (#) = Bool

f :: forall a -> a ~ Bool => ()
f (#) = () -- this is binding, not matching

I didn't fix that in the current patch because nobody cares about matching in visible type patterns, and it seems to be quite complex to fix. Let's create a separate issue for that problem and fix it some time in the future, e.g. when we will have forall-> in GADTs.

Reviews are highly appreciated!

Merge request reports