You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is another issue, which is that what we really want to say is
"reach in and do something to all the (dual) numbers inside this data
structure" and "fmap something data" is an approximation thereof. But
what about, say, a list of lists of numbers? Why is that rejected as
an appropriate output shape, when a tree of numbers is okay? Why is a
list of maybe numbers not okay, when a list of numbers is okay and a
maybe number is okay?
I'm not sure if this can be done in a general sense, short of defining
e.g. 'diffUFF' using double 'fmap's. You could probably do this with a
type class but I think you'd need to use overlapping instances which
I'm not really familiar with (or lots of boilerplate).
A better option might be one of the generic programming approaches [1]
would be able to do this. I read the Uniplate[2] paper but don't think
it is applicable to this case. Of the others my impression is that SYB
is fairly popular but you'd probably be better off asking on the
haskell-cafe mailing list.
[From email 2008-02-24]
I'm not sure if this can be done in a general sense, short of defining
e.g. 'diffUFF' using double 'fmap's. You could probably do this with a
type class but I think you'd need to use overlapping instances which
I'm not really familiar with (or lots of boilerplate).
A better option might be one of the generic programming approaches [1]
would be able to do this. I read the Uniplate[2] paper but don't think
it is applicable to this case. Of the others my impression is that SYB
is fairly popular but you'd probably be better off asking on the
haskell-cafe mailing list.
[1] http://www.haskell.org/haskellwiki/Libraries_and_tools/Generic_programming
[2] http://www-users.cs.york.ac.uk/~ndm/uniplate/
The text was updated successfully, but these errors were encountered: