Kevin Clees <k.cl...@web.de> writes:

> Now my function looks like this: 
>
> tmp:: [(Int, Int)] -> Int -> (Int, Int)
> tmp [] y = (0,0)
             ^^^^^
> tmp xs y = xs !! (y-1)

> If the function returns (0,0) it will blocked by another  function. 

Personally, I think using "special" values like this is a code smell,
and indicates poor design.  There are many implicit assumptions, for
instance that (0,0) isn't already a member of the input list, and that
this is correctly handled by surrounding functions.  Generally, it's
much more desirable to encode this in the types, so I would vastly
prefer the Maybe solution in almost all cases, which makes these
assumptions explicit.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to