F # Haskell equivalent to "interact"

I just read a little about Haskell and saw its interact method, which implements a general scheme for reading input from stdin, applying a function to strings, and writing the result back to stdout. So for example:

 interact (map toUpper) 

prints everything that comes to stdin converted to uppercase.

Is there an equivalent to this already in F # /. Net?

+8
haskell f #
source share
1 answer

This functionality does not exist initially, but it is easy to implement it:

 let inline interact f = printfn "%s" (f (System.Console.Readline())) 
+6
source share

All Articles