purescript-exists icon indicating copy to clipboard operation
purescript-exists copied to clipboard

Is there a reason to prefer the foreign/coerced representation to Church encoding?

Open garyb opened this issue 6 years ago • 0 comments

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

garyb avatar Mar 14 '18 15:03 garyb