[Haskell-beginners] Convert String to List/Array of Numbers

Daniel Fischer daniel.is.fischer at web.de
Wed Sep 8 14:45:14 EDT 2010


On Wednesday 08 September 2010 20:13:17, Chaddaï Fouché wrote:
> Given that the notion of argument number isn't quite right in Haskell

Since, strictly speaking, a function always takes exactly one argument.
Haskell is like mathematics in that respect.

But since saying "a function which takes an argument of type a, returning a 
function which takes an argument of type b, returning a function which 
takes an argument of type c, returning ..." is much more cumbersome than 
saying "a function taking five arguments of types a, b, c, d, e 
respectively and returning a value of type f", we are using the more 
convenient, albeit inexact, language habitually.
Haskell is like mathematics in that respect too.

Be aware however, that the same function may be referred to as a function 
taking three, four or perhaps six arguments in other circumstances.

> and that you should put a type signature on all exported functions

And also on nontrivial internal functions.

> which provides more exact information on the function behaviour
> anyway... I would say that point-free is worth it for the clarity it
> affords to the accustomed Haskeller

It takes a bit to get used to (having a mthematical background helps).
And point-freeing is not always a win in readability.
Judge on a case-by-case basis.

> (all but the most twisted
> functions written in point-free style will only take "one" argument
> anyway).

Possibly two.

foo = (sum .) . enumFromThenTo 0

hasn't yet clearly crossed the border.



More information about the Beginners mailing list