| Subject: | [Haskell-cafe] Re: Haskell and the Software design process |
|---|---|
| From: | Maciej Piechotka |
| Date: | Thu, 06 May 2010 18:44:40 +0100 |
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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/haskell-cafe |
| Previous by Date: | [Haskell-cafe] Re: Re: Haskell and scripting, Maciej Piechotka |
|---|---|
| Next by Date: | Re: [Haskell-cafe] Database connection pool, Bas van Dijk |
| Previous by Thread: | Re: [Haskell-cafe] Haskell and the Software design process, Adam Vogt |
| Next by Thread: | Re: [Haskell-cafe] Haskell and the Software design process, Rafael Cunha de Almeida |
| Indexes: | [Date] [Thread] [Top] [All Lists] |