Zulip Chat Archive

Stream: new members

Topic: What's the equivalent of typeholes?


nrs (Aug 29 2024 at 04:18):

In Haskell, you can use typeholes _ to get type inference from the compiler to help you write-in proper values in, e.g., function definitions. Is there an equivalent in Lean?

Mario Carneiro (Aug 29 2024 at 04:25):

the equivalent of _ is _

nrs (Aug 29 2024 at 04:27):

Mario Carneiro said:

the equivalent of _ is _

huh, am getting "don't know how to synthesize placeholder in context" in

def myfunc : Nat -> Nat
  | n => n + _

is this expected behaviour?

Mario Carneiro (Aug 29 2024 at 04:29):

yes, that is because you aren't done, but the error message says what type it is expecting

nrs (Aug 29 2024 at 04:30):

Mario Carneiro said:

yes, that is because you aren't done, but the error message says what type it is expecting

ah you're right! thanks a lot for the help!


Last updated: May 02 2025 at 03:31 UTC