Skip to content

Change Monad polymorphism#19

Merged
omelkonian merged 2 commits into
masterfrom
ultra-monad-polymorphism
Jun 3, 2026
Merged

Change Monad polymorphism#19
omelkonian merged 2 commits into
masterfrom
ultra-monad-polymorphism

Conversation

@omelkonian

Copy link
Copy Markdown
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

Copy link
Copy Markdown
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
Copy Markdown
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.

@omelkonian omelkonian force-pushed the ultra-monad-polymorphism branch from dc59724 to 9464f57 Compare June 3, 2026 07:53
@omelkonian omelkonian force-pushed the ultra-monad-polymorphism branch from c258b06 to 9ce3fea Compare June 3, 2026 07:58
@omelkonian omelkonian merged commit b0f156c into master Jun 3, 2026
1 check passed
@omelkonian omelkonian deleted the ultra-monad-polymorphism branch June 3, 2026 08:10
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