(Apology by name, I can not do better)
My question is to find a generalized structural or "standard" function to perform the following task:
xmap :: (a -> b) -> fa -> gb
then we can display not only elements, but the whole structure.
Some (not real) examples
xmap id myBinaryTree :: [a]
for now, I have to make an explicit structure converter (typical fromList , toList ), then
toList . fmap id -- if source struct has map fmap id . fromList -- if destination struct has map
(to execute toStruct , fromStruct I use fold ).
Is there some way to generalize to / from structures? (should be) xmap there this function ( xmap )?
Thanks!:)
source share