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
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe