Zulip Chat Archive

Stream: lean4

Topic: bif and do-notation


Daniil Kisel (Nov 12 2023 at 12:38):

bif branches don't use do-notation when the bif is inside a do block:

def main1 : IO Unit := do
  if true
    then pure ()
    else
      IO.print "a"
      IO.print "b"

def main2 : IO Unit := do
  bif true
    then pure ()
    else
      IO.print "a" -- error
      IO.print "b"

Is it as it should be?

Eric Wieser (Nov 12 2023 at 13:17):

An alternative suggestion: should if be notation for both cond and ite, based on the type of its argument? Then bif wouldn't exist

Scott Morrison (Nov 12 2023 at 21:49):

It's not ideal, but unfortunately it would be a relatively expensive feature for relatively little gain, I think.

Mario Carneiro (Nov 13 2023 at 17:30):

also split should work on bif


Last updated: Dec 20 2023 at 11:08 UTC