On Tue, Feb 24, 2015 at 10:33 AM, Keean Schupke <[email protected]> wrote: > On 24 February 2015 at 15:30, Matt Oliveri <[email protected]> wrote: >> >> upcast1_1to2 f = \x y.(f x) y >> downforce2to1_1 f = \x.\y.f x y > > Why is that necessary? > > If this is true then you cannot go up or down, so there is not point in > arty-abstract functions at all, as you cannot alter the arity without > inserting lambdas.
Oh my gosh. No wonder we haven't been communicating. Temporarily forget Haskell. How do you use a function to coerce one function to another function? You take the orginal as an argument, and return the coerced one. Returning a function (if it isn't always the same) requires a lambda. Of course with currying in functional languages, this issue is consistently elided. The reason why specialization doesn't have the problem that coercions do is simply that you never need to make a coerced function, you just change the way you use/create the original. See for yourself: Source code: f x = \y. x + y // This lambda was put by the programmer ... f 1 2 // Arity mismatch (but admitted by order) Specialize application: f x = \y. x + y ... (f 1) 2 Specialize definition: f x y = x + y ... f 1 2 As an exercise, repeat the specialization going down the order instead, and see that we would need to insert a lambda. _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
