On Fri, Jun 5, 2015 at 2:46 AM, Keean Schupke <[email protected]> wrote: > I don't understand, you just use type-classes: > > area :: (RightTriangle a b, Numeric b) => a -> b > > RightTrianlge is a constraint on the polygon "a" with points of type "b" > (Int or Float etc). > > Only the algorithm used in areaOfRightTriangle knows the type of triangle > required for the area operation, not the triangle itself. > > I can have other triangle area definitions too: > > area :: (Square a b, Numeric b) => a -> b > > WIth suitable overloads I can call 'area' on any polygon, and I will get the > most efficient algorithm for that type of polygon automatically. >
I guess I don't understand how this in any way affects what I was replying to, which was coalescing assertions on types that were not abstract... but in reality probably just more comfortable/familiar with the keykos model of lambda calculus which doesn't assume you'd ever want to give out a constructor... _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
