Skip to content

[ refactor ] Make Data.Irrelevant.Irrelevant a proper Monad#2977

Open
jamesmckinna wants to merge 1 commit intoagda:masterfrom
jamesmckinna:irrelevant-Monad
Open

[ refactor ] Make Data.Irrelevant.Irrelevant a proper Monad#2977
jamesmckinna wants to merge 1 commit intoagda:masterfrom
jamesmckinna:irrelevant-Monad

Conversation

@jamesmckinna
Copy link
Copy Markdown
Collaborator

@jamesmckinna jamesmckinna commented Apr 11, 2026

This is prompted by this comment and @gallais 's introduction of the λ∙ operator which shifts irrelevant application to ordinary application. In some sense, this PR offers the converse operation, provided the codomain is Irrelevant.

Rationale:

  • type of Data.Irrelevant._>>=_ now has that of a 'proper' monadic bind operator, which increases the range of its applicability wrt its type, but also permits the use of do-notation etc. downstream

Details:

  • irrelevant-recompute moves (as recompute) to Data.Irrelevant
  • is (currently) re-exported with its old name from Relation.Nullary.Recomputable
  • but could be deprecated, although to do so might introduce awkward dependency mangling

Badged as v2.4, because AFAICT this is a backwards-compatible (if fiddly) change.

Potential consequences: downstream, we can reconsider all (?) uses of the . modality in favour of the Irrelevant modality, and otherwise leave it encapsulated in Data.Irrelevant?

@Taneb
Copy link
Copy Markdown
Member

Taneb commented Apr 11, 2026

This looks very useful!

Comment on lines +105 to +106
_$∙⁺_ : (.A → B) → Irrelevant A → B
_$∙⁻_ : (Irrelevant A → B) → .A → B
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions as to better names welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants