{-# LANGUAGE FlexibleInstances #-} -- | A generalisation on functions to interact with standard input and standard output. module Text.JSON.Interact ( Interact(..) ) where import Data.ByteString import qualified Data.ByteString as S class Interact z where getContents' :: IO z putStr' :: z -> IO () interact' :: (z -> z) -> IO () interact' t = putStr' . t =<< getContents' instance Interact [Char] where getContents' = Prelude.getContents putStr' = Prelude.putStr instance Interact ByteString where getContents' = S.getContents putStr' = S.putStr