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.
I expected this program to produce
#t, but instead it complains that(pure 42)does not satisfyeither?:(Context: https://discord.com/channels/571040468092321801/1510007698542825622/1510821750710075462)
An easy, but unsattisfying and inefficient, solution would be for
eitherand friends to(chain success 🕳). Then I thought about changingsuccessused as a match expander to also recognizepure. But it looks likeeither?andeither/calso don't recognizepure. 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 ofpure?andpure/c.