4 ms·
> foo :: (a, b) -> a > There's only one possible thing this function can do! Ah, so it scales a vector by a scalar returning a new vector, right?
by kenferry 13y ago
> foo :: (a, b) -> a
> There's only one possible thing this function can do!
Ah, so it scales a vector by a scalar returning a new vector, right?
- judk 13y agoNo, it is impossible to write the function you described on that type. There is no function "scale" that works polymorphically on any type 'a'. The parent you are responding to is quoting a proven result of computer science.
- jlarocco 13y agoBut what percentage of "real world" functions work on completely generic types? In reality most useful functions take more specific types, and those types allow many more operations to be performed on them. In general, it's not really possible to tell what a function does just by looking at the type signature.