-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add operators for fmap and friends #13
Comments
> :t flip fmap
flip fmap :: Functor f => f a -> (a -> b) -> f b
> :t (|>)
(|>) :: a -> (a -> b) -> b so I think |
Thanks for the suggestion! I've stuck with "plain" functions for now because it's not clear to stop. If ($) :: (a -> b) -> a -> b
(<$>) :: Functor f => (a -> b) -> f a -> f b
(=<<) :: Monad m => (a -> m b) -> m a -> m b Furthermore I generally avoid the applicative style and prefer do
x <- Just 3
y <- Just 4
pure <| x + y -- or `pure (x + y)` or `pure $ x + y` |
I don't think I'll implement higher-order operators in Flow. If that's something you want, take a look at |
FunctorMonadic wasn't as nice as I wanted it to be so I've gone ahead and uploaded https://hackage.haskell.org/package/op-0.1.0.0/docs/Control-Op.html |
Late-night haskell hacking has me thinking:
My proposal is to add functions
(<<|)
and(|>>)
which do the equivalent of(<|)
and(|>)
but over functors.So the example here would go from:
to:
which IMHO shows the structure of the operation much better than the original. (Disclaimer: Haskell novice here, may have gotten some terminology wrong.)
The text was updated successfully, but these errors were encountered: