On 23-nov-2006, at 23:22, Ralf Lammel wrote:
Arthur,
constrFields eventually returns some mangled strings from the
abstract syntax tree; see ghc-fptools/ghc/compiler/basicTypes/
DataCon.lhs; and that abstract syntax promises to be order-preserving.
It says (not surprisingly):
dcFields :: [FieldLabel],
-- Field labels for this constructor, in the
-- same order as the argument types;
-- length = 0 (if not a record) or dataConSourceArity.
gmapQ maps the children to results. Since it is a map, it is order-
preserving. There is not even any associatively business in the
case of gmapQ (as opposed to gmapQl and gmapQr).
So zipping together results from gmapQ and constrFields plus
handling the special case of non-record types, should be just fine,
no? What could possibly go wrong? Perhaps you are saying that the
documentation of constrFields should promise explicitly that it
does not mangle order?
Such a promise would have been nice. I assumed that The Right Thing
(as in
no magic reorderings) would happen, but it was unclear from the
papers and
the haddock documentation.
I should've looked into the source, of course, as that is the definitive
documentation. :)
Let me know if I don't get what you are after ... perhaps in the café.
You have fully understood and explained. Glad to see that The Right
Thing
is done. Now I can safely go and let my code into the hands of
unsuspecting
non-Haskellers. :)
With regards, Arthur van Leeuwen.
--
/\ / | [EMAIL PROTECTED] | Work like you don't need
the money
/__\ / | A friend is someone with whom | Love like you have never
been hurt
/ \/__ | you can dare to be yourself | Dance like there's nobody
watching
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell