Skip to content

either doesn't work on pure #17

@LiberalArtist

Description

@LiberalArtist

I expected this program to produce #t, but instead it complains that (pure 42) does not satisfy either?:

#lang racket/base
(require data/either
         data/applicative)
(either (λ (s)
          #f)
        (λ (x)
          #t)
        (pure 42))

(Context: https://discord.com/channels/571040468092321801/1510007698542825622/1510821750710075462)

An easy, but unsattisfying and inefficient, solution would be for either and friends to (chain success 🕳). Then I thought about changing success used as a match expander to also recognize pure. But it looks like either? and either/c also don't recognize pure. At that, it seemed like this would need at least a little design thought, or maybe we should just document the quirk, along the lines of pure? and pure/c.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions