Bryan O'Sullivan avatar Bryan O'Sullivan committed e1fb9fa

Simplify interact.

Comments (0)

Files changed (1)

 {-# LANGUAGE BangPatterns, CPP #-}
 -- |
 -- Module      : Data.Text.IO
--- Copyright   : (c) Bryan O'Sullivan 2009
+-- Copyright   : (c) Bryan O'Sullivan 2009,
+--               (c) Simon Marlow 2009
 -- License     : BSD-style
 -- Maintainer  : bos@serpentine.com
 -- Stability   : experimental
 -- Portability : GHC
 --
 -- Support for text I\/O.
---
 
 module Data.Text.IO
     (
 -- passed to this function as its argument, and the resulting string
 -- is output on the standard output device.
 interact :: (Text -> Text) -> IO ()
-#if __GLASGOW_HASKELL__ <= 610
-interact f = B.interact (encodeUtf8 . f . decodeUtf8)
-#else
-interact f = undefined
-#endif
+interact f = putStr . f =<< getContents
 
 -- | Read all user input on 'stdin' as a single string.
 getContents :: IO Text
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.