En the exercises j'ai mis en œuvre fmapT
:Dans le tutoriel lets-lens, comment refactorisez-vous l'appel à traverser afin de le mettre en œuvre?
-- Let's remind ourselves of Traversable, noting Foldable and Functor.
--
-- class (Foldable t, Functor t) => Traversable t where
-- traverse ::
-- Applicative f =>
-- (a -> f b)
-- -> t a
-- -> f (t b)
-- | Observe that @[email protected] can be recovered from @[email protected] using @[email protected]
--
-- /Reminder:/ fmap :: Functor t => (a -> b) -> t a -> t b
fmapT ::
Traversable t =>
(a -> b)
-> t a
-> t b
fmapT =
error "todo: fmapT"
Maintenant, comment puis-je mettre over
?
-- | Let's refactor out the call to @[email protected] as an argument to @[email protected]
over ::
((a -> Identity b) -> s -> Identity t)
-> (a -> b)
-> s
-> t
over = error "undefined"
Pouvez-vous fournir quelques explications sur la fonction 'over'? –
ajouter un edit sur la question, et en fait je ne sais pas ce qui est 'over' pour ... – rcmerci