Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error from monad with class parameter #2120

Closed
1 task done
JamesGallicchio opened this issue Feb 23, 2023 · 1 comment
Closed
1 task done

Compiler error from monad with class parameter #2120

JamesGallicchio opened this issue Feb 23, 2023 · 1 comment
Labels
bug Something isn't working depends on new code generator We are currently working on a new compiler (code generator) for Lean. This issue/PR is blocked by it

Comments

@JamesGallicchio
Copy link
Contributor

JamesGallicchio commented Feb 23, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

Code fails to compile.

Steps to Reproduce

def MM (τ) := ∀ (_ : Type) [Inhabited Unit], Id τ

instance : Monad MM where
  pure a    := λ _ => pure a
  bind r f  := λ t => bind (r t) (fun x => f x t)

def foo : MM Unit := do
  while False do
    while False do
      pure ()

-- or without do notation
def foo' : MM Unit :=
  forIn Lean.Loop.mk PUnit.unit fun x r =>
    forIn Lean.Loop.mk (ForInStep.done PUnit.unit) fun x r =>
      pure (ForInStep.done <| ForInStep.done <| PUnit.unit)

The type and typeclass arguments to MM are both necessary to reproduce, as are the two nested forIns

Expected behavior: should compile

Actual behavior: error: unknown constant 'Lean.Loop.forIn.loop._at_.board.attempt._elam_4.spec_0'

Versions

Lean (version 4.0.0-nightly-2023-02-22, commit 7992ce6b4dd4, Release)
@JamesGallicchio JamesGallicchio changed the title Compiler error from where clause + monad with class parameter Compiler error from monad with class parameter Feb 23, 2023
@gebner gebner added bug Something isn't working depends on new code generator We are currently working on a new compiler (code generator) for Lean. This issue/PR is blocked by it labels Feb 23, 2023
@Kha
Copy link
Member

Kha commented Feb 18, 2025

Works in 4.16.0

@Kha Kha closed this as completed Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working depends on new code generator We are currently working on a new compiler (code generator) for Lean. This issue/PR is blocked by it
Projects
None yet
Development

No branches or pull requests

3 participants