Zulip Chat Archive

Stream: general

Topic: Expected Type in match


Nima (Apr 21 2018 at 06:13):

Is there anyway to explicitly tell lean the expected type of match, so I would not receive the following error:

invalid match/convoy expression, user did not provide type for the expression,
lean tried to infer one using expected type information, but result is not type correct

Kenny Lau (Apr 21 2018 at 06:14):

for example?

Mario Carneiro (Apr 21 2018 at 06:20):

match a, b : \forall a b, expected_type_of_match with ... end

Mario Carneiro (Apr 21 2018 at 06:21):

You can also often use type ascription in some cases, i.e. (match a, b with ... end : expected type)

Nima (Apr 21 2018 at 06:31):

OK, I don't have a good example for this.
Will get back if I found one.

Nima (Apr 21 2018 at 06:37):

Thank you, this following worked (the other one did not),

match a, b : \forall a b, expected_type_of_match with ... end


Last updated: Dec 20 2023 at 11:08 UTC