Zulip Chat Archive

Stream: general

Topic: constructor does not work for LawfulMonad


Asei Inoue (Nov 16 2024 at 11:15):

instance : LawfulMonad Option := by
  constructor <;> sorry

instance [Monad m] [LawfulMonad m] : LawfulMonad (OptionT m) := by
  /- tactic 'constructor' failed, no applicable constructor found -/
  constructor

why this error occurs?

Asei Inoue (Nov 16 2024 at 11:28):

and why the following code does not raise an error...?

instance [Monad m] [LawfulMonad m] : LawfulMonad (OptionT m) := by
  sorry

instance [Monad m] [LawfulMonad m] : LawfulMonad (OptionT m) := by
  constructor <;> sorry -- why this constructor does not fail???

Last updated: May 02 2025 at 03:31 UTC