purescript-exists
purescript-exists copied to clipboard
Is there a reason to prefer the foreign/coerced representation to Church encoding?
I guess it save the allocation of one lambda? Just wondered if there were any other reasons to prefer the current version.
For reference, I'm talking about this as the alternative:
newtype Fxists f = Fxists (∀ r. (∀ a. f a → r) → r)
mkFxists ∷ ∀ f a. f a → Fxists f
mkFxists fa = Fxists (\f → f fa)
runFxists ∷ ∀ f r. (∀ a. f a → r) → Fxists f → r
runFxists elim (Fxists f) = f elim