
6 May
2010
6 May
'10
1:44 p.m.
On Sun, 2010-05-02 at 21:35 -0700, Alexander Dunlap wrote:
f ys = let xs = (1:ys) in last xs
uses the partial function "last". Rewriting it in the "non-partial style" gives
f ys = case (1:ys) of [] -> Nothing xs -> Just (last xs)
I guess it is more like f :: Num a => [a] -> a f = fromMaybe 1 . safeLast Regards