juan_gandhi: (Default)

List a = Codensity Endo a = forall r. (a -> r -> r) -> r -> r

nil :: List a
nil = \f z -> z

cons :: a -> List a -> List a
cons x xs = \f z -> f x (xs f z)

append :: List a -> List a -> List a
append xs ys = \f z -> xs f (ys f z)

foldr :: (a -> r -> r) -> r -> List a -> r
foldr f z xs = xs f z

Basically, it's like lambda.

Src: https://golem.ph.utexas.edu/category/2012/09/where_do_monads_come_from.html#c042100

funny math

Dec. 25th, 2012 05:56 pm
juan_gandhi: (Default)
"No explicit example of a nonprincipal ultrafilter can be given, since their existence implies a weak form of the axiom of choice."

Since actually it is known that codensity monad is actually the ultrafilter monad, and codensity monad is somehow related to continuation monad (or is it the same? probably not), we are supposed to use the weak AC in our Haskell code to prove properties of object which by their nature cannot be demonstrated.

OMFG.

funny math

Dec. 25th, 2012 05:56 pm
juan_gandhi: (Default)
"No explicit example of a nonprincipal ultrafilter can be given, since their existence implies a weak form of the axiom of choice."

Since actually it is known that codensity monad is actually the ultrafilter monad, and codensity monad is somehow related to continuation monad (or is it the same? probably not), we are supposed to use the weak AC in our Haskell code to prove properties of object which by their nature cannot be demonstrated.

OMFG.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

November 2025

S M T W T F S
       1
23456 7 8
9 1011 12131415
16171819202122
23242526272829
30      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Nov. 12th, 2025 08:26 pm
Powered by Dreamwidth Studios