[Haskell-cafe] Haskell and C++ program

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Jan 14 18:03:22 EST 2009


Hello Jonathan,

Thursday, January 15, 2009, 1:41:23 AM, you wrote:

>   reverseDouble =
>         unlines
>       . intro
>       . map show
>       . reverse
>       . map (read :: String -> Double)
>       . takeWhile (/= "end")
>       . words

using arrows, this may be reversed:

  reverseDouble =
          words
      >>> takeWhile (/= "end")
      ...

> I observe also in passing that the cast on read is somewhat inelegant;
> in a real application, the consumer of map read's output would specify
> its type sufficiently that the cast would be un-necessary.

in small scripts explicit read casts are rather common


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list