Skip to content
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

Generalize diffMU to arbitrary (deep) structures? #2

Open
bjornbm opened this issue May 16, 2010 · 0 comments
Open

Generalize diffMU to arbitrary (deep) structures? #2

bjornbm opened this issue May 16, 2010 · 0 comments

Comments

@bjornbm
Copy link
Owner

bjornbm commented May 16, 2010

[From email 2008-02-24]

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.

[1] http://www.haskell.org/haskellwiki/Libraries_and_tools/Generic_programming
[2] http://www-users.cs.york.ac.uk/~ndm/uniplate/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant