-
Notifications
You must be signed in to change notification settings - Fork 65
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
Map natural transformation for FreeT #5
Comments
I'm not actively against adding this. =) Let me check the extensions used, and if it doesn't extend the set then it'll definitely go in. |
Like I said, it's not a blocking issue. If worse comes to worse I'll On 09/07/2012 02:31 PM, Edward A. Kmett wrote:
|
Oh, I just realized that if the mapFreeT
:: (Monad m, Functor f)
=> (m (FreeF f a (FreeT g n b)) -> n (FreeF g b (FreeT g n b)))
-> FreeT f m a -> FreeT g n b This still works correctly for monad morphisms, at the expense of an uglier type signature that hides the purpose of the function. However, you could add a documentation note saying something like: "The typical use is to pass |
I just decided to add the Rank2Types requirement. This will let me move the Church encoded free monad from kan-extensions to here, which reduces the amount of crap people need to install in order to use it considerably. |
Would you be interested in adding the following function to
FreeT
:This greatly resembles an
IFunctor
instance, except for the(Monad m)
(or(Functor m)
) constraint. In the longer run, when working on yourindexed
package you might considerN
versions of all the indexed classes (i.e.NFunctor
,NMonad
) that have functor constraints on the last type variable that are appropriate for the world of natural transformations.This kind of transformation is generally useful for all monad transformers since it allows you to change the base monad for a pre-existing function. For example, if I write a pipe like:
... and let's say I have another pipe that folds its input:
I could make them compatible just by writing:
This isn't a blocking issue for me switching to
free
forpipes
, and I plan on switching soon regardless. This is more of a "nice to have" thing. Also, it doesn't have to be a named function. If you find an appropriate class for it you can use that, too.The text was updated successfully, but these errors were encountered: