Zulip Chat Archive

Stream: lean4

Topic: Reading options with default values


Eric Wieser (Apr 03 2024 at 18:25):

What's the right way to read a boolean option? I was able to get

import Std

open Lean

register_option myOption : Bool :=
  { defValue := true }

#eval show MetaM _ from do
  getBoolOption myOption.name ( getOptionDefaultValue myOption.name).getBoolEx

to work, but surely there is some API somewhere that respects the option default value?

Alex J. Best (Apr 03 2024 at 20:53):

myOption.get

Eric Wieser (Apr 03 2024 at 21:19):

Thanks!


Last updated: May 02 2025 at 03:31 UTC