Skip to content

Change Monad polymorphism #19

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

omelkonian
Copy link
Collaborator

competitor to PR #11 (a more general solution to #2)

This approach stems from a comment originally posted by @omelkonian in #11 (review)

It is not clear why one would prefer this polymorphism over the previous Type↑ approach:

  • results in significantly more boilerplate
  • restricts some use cases as demonstrated in the comments

@omelkonian omelkonian force-pushed the ultra-monad-polymorphism branch from 50b6e5c to dc59724 Compare April 14, 2025 16:31
@omelkonian
Copy link
Collaborator Author

@WhatisRT the plot thickens!

Now there is a crucial drawback to this more liberal polymorphism: due to inner quantification over the levels (in contrast to stdlib's outer quantification), we lose the ability to support non-level-polymorphic types, e.g.

data newtype₀ (A : Type) : Type where
  mk : A  newtype₀ A

instance
  _ : Functor newtype₀
  _ = ?
(Type ℓ) != Type
when checking that the expression newtype₀ has type
Class.Core.Type[ ℓ ↝ _ℓ↑_393 ℓ ]

@WhatisRT
Copy link
Collaborator

Yes, you're right. So it seems we're in a situation where we have two mutually exclusive properties that we want: level-monomorphic instances, and cross-level functions.

I feel like monomorphic instances are mostly a convenience thing though. I don't think I could come up with a construction that is actually practically relevant that cannot be extended to a polymorphic one. Whereas the cross-level functions clearly do have use cases.

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 this pull request may close these issues.

2 participants