All Questions
6 questions
0
votes
2
answers
56
views
Failing composition of functorial and monadic operations
Another newbie question in my struggle to learn idiomatic Haskell: I'm trying to compose a smart constructor out of some validation functions, but I can't get the types to line up.
This is the type I ...
3
votes
2
answers
174
views
Haskell - applying a function that returns a functor onto a functor
Say I have function two functions f and g that both take in regular values and return an Either value like so:
g :: a -> Either x b
f :: b -> Either x c
How do I chain the two together to get ...
14
votes
2
answers
920
views
Is the Yoneda Lemma only useful from a theoretical point of view?
For instance, loop fusion can be obtained with Yoneda:
newtype Yoneda f a =
Yoneda (forall b. (a -> b) -> f b)
liftYo :: (Functor f) => f a -> Yoneda f a
liftYo x = Yoneda $ \f -> ...
-6
votes
1
answer
144
views
Composing applicative functions [closed]
Please implement the function:
composeApplicative :: (Applicative f) => f (b -> c) -> f (a -> b) -> f (a -> c)
Such that:
(composeApplicative f g) <*> x == f <*> (g <...
4
votes
1
answer
788
views
How does fmap fmap apply to functions (as arguments)?
I am trying to understand how fmap fmap applies to a function like say (*3).
The type of fmap fmap:
(fmap fmap):: (Functor f1, Functor f) => f (a -> b) -> f (f1 a -> f1 b)
Type of (*3):
...
8
votes
2
answers
1k
views
Difference between function composition operator (.) and fmap (<$>)
Currently reading through this article (which is pretty brilliant btw) and have a pretty simple question:
If I combine two functions like (+3) and (+2) with <$>, it seems to give me a new ...