Revamping the numeric classes

Marcin 'Qrczak' Kowalczyk mk167280@students.mimuw.edu.pl
Thu, 8 Feb 2001 11:24:29 +0100 (CET)


On Thu, 8 Feb 2001, Bjorn Lisper wrote:

> >> Int -> [a] -> Int, since this is the type it will get in the original type
> >> system.

> This is a misunderstanding. the transformation of f l y , where l :: [Int]
> for instance, should depend only on the type of f and not its definition.
> It is the call to f, not f itself, that becomes transformed. No inlining
> takes place.

I see. So you can transform arbitrary function of type a->b->c
to a function of type [a]->b->[c], by applying
    \f x y -> map (\z -> f z y) x
and similarly a->b->c to a->[b]->[c]. But then there are two ways of
transforming a->b->c to [a]->[b]->[[c]] and the order of applying the
former transformations does matter. Worse: a third way is to apply zipWith
and then promote the result to a single-element list. Or maybe map the
result to a list of single-element lists... Sorry, IMHO it's ambiguous as
hell except very simple cases.

-- 
Marcin 'Qrczak' Kowalczyk