[Haskell-cafe] Basic problem in Haskell language design?

Daniel Schüssler anotheraddress at gmx.de
Mon Mar 2 03:19:45 EST 2009


Hi,

On Sunday 01 March 2009 14:26:42 Nicu Ionita wrote:
> [...]
> movesFromWord8s (f:t:ws) = (f, t) : movesFromWord8s ws
> moverFromWord8s _ = []
> [...]
> Are there possible solutions or workarounds?

for the particular problem of having to repeat the function name, you could 
use "case":

movesFromWord8s x = case x of
	f:t:ws -> (f, t) : movesFromWord8s ws
	_      -> []

(at the cost of one extra variable name :))

Greetings,
Daniel


More information about the Haskell-Cafe mailing list