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

[Reference documentation] Incorrect type arguments of FromIterator collect! #1388

Open
gabrielshanahan opened this issue Feb 13, 2025 · 1 comment

Comments

@gabrielshanahan
Copy link

Hey everyone, I noticed a small typo in https://coalton-lang.github.io/reference/#fromiterator-class - if the class is defined as FromIterator :A :B, then collect! should have signature collect! :: (Iterator :B) → :A), not collect! :: (Iterator :A) → :B).

However, since I suspect that this page is autogenerated, this might be a symptom of a deeper problem of the generation mechanism.

@YarinHeffes
Copy link
Collaborator

When a type is printed in Coalton, a fresh type-variable context is created and the variables are labelled alphabetically in the order they appear, i.e., the original labels are forgotten. A change to this would be nice, especially for debugging error messages.

COALTON-USER> (coalton-toplevel
                (declare f (List :element -> Optional :element))
                (define f head))
; No value
COALTON-USER> (type-of 'head)
∀ :A. ((LIST :A) → (OPTIONAL :A))

(defmacro with-pprint-variable-context (() &body body)
"Create a variable context which can be used with PPRINT-TVAR"
`(let ((*pprint-tyvar-dict* (make-hash-table :test #'equalp))
(*coalton-pretty-print-tyvars* t))
(with-pprint-variable-scope ()
,@body)))

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

No branches or pull requests

2 participants