
Hi! Just a thought... Would it be a sensible thing to not desugar [x, y, z] into (:) x ((:) y ((:) z [])), but into build (\ c n -> c x (c y (c z n)))? Alternatively, how about the following rules? {-# RULES "singleton" [~1] forall x . (:) x [] = build (\c n -> c x n) #-} {-# RULES "cons/build" [~1] forall (x::a) (f:: forall b . (a->b->b) -> b -> b) . (:) x (build f) = build (\c n -> c x (f c n)) #-} This should be useful for example in conjuction with sequence_ or // applied to short lists. Has this been discussed before? Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page.
participants (1)
-
Carsten Schultz