-
Notifications
You must be signed in to change notification settings - Fork 0
Indexed Kan Extension #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
optimization via Cayley representation of indexed monad transformers
| newtype CodensityIx t i j m a = CodensityIx | ||
| { runCodensityIx :: forall b k. (a -> t j k m b) -> t i k m b } | ||
| deriving Functor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indexed codensity monad transformer type which I found in sessiontypes by @Ferdinand-vW.
| instance IxMonadTransReader t => IxMonadTransState (CodensityIx t) where | ||
| putIx s = CodensityIx (localIx (const s) . ($ ())) | ||
| instance (s ~ t, Monad m, IxMonadTransFree freeIx) | ||
| => MonadReader s (freeIx (Ixer AskIx) s t m) where | ||
| ask = liftFreerIx AskIx | ||
| local = localIx | ||
| instance IxMonadTransFree freeIx | ||
| => IxMonadTransReader (freeIx (Ixer AskIx)) where | ||
| localIx f | ||
| = lowerCodensityIx | ||
| . (\m -> Ix.do {i <- get; putIx (f i); m}) | ||
| . liftCodensityIx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is broken. putIx and localIx reference one another and cause an inf-loop
Optimization via Cayley representation of Atkey indexed monad transformers.