# HG changeset patch # User HackBot # Date 1349898163 0 # Node ID 88ac0a2c9959d4b2ea9d2a30433b84cdd2ed7178 # Parent 83f328d426435c4ce71558c2e1587c0351850421 pastelogs zzo38.*codensityask diff -r 83f328d42643 -r 88ac0a2c9959 paste/paste.29654 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paste/paste.29654 Wed Oct 10 19:42:43 2012 +0000 @@ -0,0 +1,38 @@ +2012-07-06.txt:22:39:36: I think this can make a MonadPlus whenever w is a comonad: newtype CodensityAsk w x = CodensityAsk { runCodensityAsk :: forall z. w z -> (x -> z) -> z }; (and that it seems to always make a monad) +2012-07-08.txt:04:36:14: Do you figure out about CodensityAsk, CodensityAskT, DensityAsk, DensityAskT? +2012-07-08.txt:04:37:08: (The way I have it, (CodensityAsk w) make MonadPlus if w is Comonad; hopefully it is correct although I am not completely sure) +2012-07-08.txt:05:04:03: I did not post the CodensityAskT on here so now I will: newtype CodensityAskT w m x = CodensityAskT { runCodensityAskT :: forall z. w (m z) -> (x -> m z) -> m z }; +2012-07-08.txt:05:07:42: You have said before that (Yoneda Endo) makes a Maybe monad, although you cannot get the instances for free. (CodensityAsk Identity) would be the same kind of things, isn't it? You will get Monad and MonadPlus instance for free. +2012-07-08.txt:06:18:42: (There is also CodensityAsk which is the same except without the "m"; the reason it is separate is because w could be anything not necessarily even a endofunctor or contrafunctor) +2012-07-08.txt:11:20:30: Now I made up this: catchCodensityAskT :: (Functor w, Monad m) => w (CodensityAskT w m x) -> CodensityAskT w m x -> CodensityAskT w m x; +2012-07-08.txt:11:35:31: I made up the catch for CodensityAsk; can it be made finally as well? +2012-07-08.txt:11:55:26: (CodensityAsk Predicate) seems to be the exhaustively searchable set monad as in "infinite-search" package. The type can be proven the same by Yoneda and the monad seem to work same way too +2012-07-08.txt:17:29:58: (CodensityAsk $ \(X q) k -> k 'a' ++ k 'b' ++ maybe [] return q) :: CodensityAsk (X [] Maybe) Char +2012-07-09.txt:04:47:23: I figured out how you can make a free monad using a F-algebra: toFree (CodensityAsk f) = f (Algebra Free) Pure; mkFree x = CodensityAsk (\(Algebra q) k -> q (fmap k x)); +2012-07-09.txt:06:04:15: I figured out how you can make a free monad using a F-algebra: toFree (CodensityAsk f) = f (Algebra Free) Pure; mkFree x = CodensityAsk (\(Algebra q) k -> q (fmap k x)); +2012-07-13.txt:23:31:34: You get CodensityAsk ((->) x) to be like Either x including a MonadPlus instance if x is a monoid +2012-07-15.txt:01:15:17: Do you like CodensityAsk (and CodensityAskT)? I have figured out many things about it. +2012-07-15.txt:01:20:21: (CodensityAsk (Store s)) is also MonadPlus. +2012-07-15.txt:09:55:17: type Sto s = CodensityAsk (Store s); getSto = CodensityAsk (\(StoreT _ s) r -> r s); setSto x = CodensityAsk (\(StoreT (Identity f) _) _ -> f x); modSto x = CodensityAsk (\(StoreT (Identity f) s) _ -> f (x s)); runSto s (CodensityAsk f) = f (store Left s) Right; +2012-07-16.txt:04:52:48: In my program it is called (CodensityAsk (Store x)) +2012-07-16.txt:20:52:19: Is it correct? Codensity Endo = [] CodensityAsk Endo = Writer (Sum Natural) Density Endo = Traced (Product Natural) +2012-07-16.txt:21:34:46: edwardk: Is it this? CodensityAsk Endo = Writer (Sum Natural) Density Endo = Traced (Product Natural) +2012-07-16.txt:21:45:32: By F-algebras I would suppose (CodensityAsk Endo) would be same like (Free Identity) +2012-08-14.txt:06:44:36: Perhaps you can even make up a kind of multi-continuation by CodensityAsk with some GADT. +2012-08-24.txt:02:48:53: That newtype Search f a = Search { optimum :: f a -> a } I have also called Algebra (as a F-algebra is). I also think that if f is Predicate you get the "infinite search" monad that someone else described, and I think also (CodensityAsk Predicate) is also the same, too! +2012-08-24.txt:02:54:33: newtype CodensityAsk f x = CodensityAsk { runCodensityAsk :: forall z. f z -> (x -> z) -> z }; +2012-08-24.txt:02:54:57: It is always a Monad. If f is Comonad then (CodensityAsk) is also a MonadPlus. +2012-08-24.txt:02:55:09: It is always a Monad. If f is Comonad then (CodensityAsk f) is also a MonadPlus. +2012-08-24.txt:02:55:54: There is also CodensityAskT which every "z" in that definition would be "m z" instead +2012-08-24.txt:05:18:51: I said I proved that (CodensityAsk Predicate) is actually the same as the infinite search monad; actually, I have only proven that the type is equivalent, not that the monad is equivalent. However, it seems to be equivalent monad from testing it. +2012-10-08.txt:17:09:40: I think you can make a writer monad with Codensity and it can also be done with CodensityAsk. +2012-10-08.txt:17:18:50: For example: newtype X y z = X { runX :: y -> z -> z }; type Writer x = CodensityAsk (X x); write x = CodensityAsk (\(X a) f -> a x $ f ()); runWriter (CodensityAsk f) = f (X $  (b, c) -> (a : b, c)) ((,) []); +2012-10-10.txt:05:08:51: zzo38: Where did your CodensityAsk type come from? +2012-10-10.txt:05:17:06: zzo38: Can you express CodensityAsk as a CodensityAsk type? +2012-10-10.txt:05:19:05: shachaf: I suppose you can use (CodensityAsk (IdentityT f)) but I don't know if that is what you meant +2012-10-10.txt:05:22:44: zzo38: What's CodensityAsk (Cont r)? +2012-10-10.txt:05:24:29: However, notice that you don't need to use a functor there, it can be anything, such as (CodensityAsk Predicate) to make up the infinite search monad. +2012-10-10.txt:05:25:01: zzo38: CodensityAsk is "pretty damn awesome", confirms another channel. +2012-10-10.txt:06:10:56: @ask zzo38 Is this the CodensityAsk Monad (>>=)? m >>= f = CA $ \q k -> runCA m q (\x -> runCA (f x) q k) +2012-10-10.txt:19:42:26: `pastelogs zzo38 codensityask +2012-10-10.txt:19:42:34: `pastelogs zzo38.*codensityask