-
Notifications
You must be signed in to change notification settings - Fork 49
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
Why MonadWriter instance for ChronicleT uses underlying monad #68
Comments
This seems to be a valid instance of MonadWriter: instance (Monoid c, Semigroup c, Monad m) => MonadWriter c (ChronicleT c m) where
tell = dictate
listen (ChronicleT m) = ChronicleT $ do
a <- m
case a of
This x -> return $ This x
That y -> return $ These mempty (y, mempty)
These x y -> return $ These x (y, x)
pass (ChronicleT m) = ChronicleT $ do
a <- m
case a of
This x -> return $ This x
That (a,f) -> return $ These (f mempty) a
These x (a,f) -> return $ These (f x) a
writer (a,w) = ChronicleT $ return $ These w a |
|
MonadWriter, sorry |
mutantmell
changed the title
Why MonadReader instance for ChronicleT uses underlying monad
Why MonadWriter instance for ChronicleT uses underlying monad
Oct 26, 2016
Let's see what will be answered in http://stackoverflow.com/questions/41096328/why-monadreader-r-statet-s-m-uses-an-instance-of-the-underlying-monad Related to #67 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ChronicleT seems like it can be made a valid MonadWriter, without relying on the underlying monad.
If it is not, it should be documented.
The text was updated successfully, but these errors were encountered: