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

Ambiguous predicate in local closure #913

Closed
macrologist opened this issue Apr 28, 2023 · 2 comments · Fixed by #917
Closed

Ambiguous predicate in local closure #913

macrologist opened this issue Apr 28, 2023 · 2 comments · Fixed by #917

Comments

@macrologist
Copy link
Collaborator

The following is a minimal example of a behavior that seems curious to me.

(defpackage #:ambiguous-pred-in-local-closure
  (:import-from
   #:common-lisp
   #:describe
   #:disassemble)
  (:use #:coalton #:coalton-prelude)
  (:local-nicknames
   (#:optional #:coalton-library/optional)
   (#:iter #:coalton-library/iterator)))

(named-readtables:in-readtable coalton:coalton)

(in-package #:ambiguous-pred-in-local-closure)

(coalton-toplevel

  (define-class (Moo :a :b :c (:a -> :b :c))
    (moo-size (:a -> :b))
    (moo-find (:a -> :b -> (Optional :c))))

  (declare filled-moos ((Num :b) (Ord :b) (Moo :a :b :c) => :a -> List :b))
  (define (filled-moos moo)
    (let ((filled?
            (fn (i) (optional:some? (moo-find moo i)))))
      (filter filled? (iter:up-to (moo-size moo))))))

This fails to compile, erroring with an ambiguous predicate condition at the call to moo-find inside of filled?.

Is this surprising?

@eliaslfox
Copy link
Collaborator

This is a bug. I'm working on a fix.

@macrologist
Copy link
Collaborator Author

macrologist commented Apr 29, 2023

Oh: obviously that example is slightly wrong. There should be a collect in there, or the List should be an iter:Iterator. But the issue stands.

eliaslfox added a commit that referenced this issue May 3, 2023
@eliaslfox eliaslfox linked a pull request May 3, 2023 that will close this issue
eliaslfox added a commit that referenced this issue May 4, 2023
eliaslfox added a commit that referenced this issue May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants