Interestingly, we can still do these two in the compiler with a caveat:

        tuple_map (f,g) (a,b) --> (f a, g b)
        generic_map f (a,b) --> (f a, f b)

provided we don't get into a type recursion. The trick is to bind the
arguments first. The result type can't be known until after this
is done, so the arguments can't recursively depend on the whole
expression.

Note that a macro won't suffice because whilst (a,b) is a manifest tuple,
the above should work even if it is a variable or return value from
a function: we need the result type to generate the right number
of projections.

Funnily, if it IS a manifest tuple, we can generate it directly and in this
case a recursive dependency is OK :)

Of course none of this will actually work instantly with a tuple cons
form of a tuple: in that case application of the maps has to be delayed
to instantiation time, but that can't work because then we can't know
the type.


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to