Zulip Chat Archive

Stream: lean4 dev

Topic: Should try/catch be whitespace-sensitive?


𝚠𝚘𝚓𝚌𝚒𝚎𝚌𝚑 𝚗𝚊𝚠𝚛𝚘𝚌𝚔𝚒 (May 10 2025 at 04:18):

It caught me off-guard that the following example doesn't parse:

example : Option Nat := do
  try
    try
      return 0
    catch _ =>
      return 0
  catch _ =>
    return 0

It does work with some parenthesization:

example : Option Nat := do
  try
    (try
      return 0
    catch _ =>
      return 0)
  catch _ =>
    return 0

Mario Carneiro (May 11 2025 at 12:41):

lean#8220


Last updated: Dec 20 2025 at 21:32 UTC