diff options
Diffstat (limited to 'Plugins/StdinReader.hs')
-rw-r--r-- | Plugins/StdinReader.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Plugins/StdinReader.hs b/Plugins/StdinReader.hs new file mode 100644 index 0000000..7ad2b41 --- /dev/null +++ b/Plugins/StdinReader.hs @@ -0,0 +1,26 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Plugins.StdinReader +-- Copyright : (c) Andrea Rossato +-- License : BSD-style (see LICENSE) +-- +-- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> +-- Stability : unstable +-- Portability : unportable +-- +-- A plugin for reading from stdin +-- +----------------------------------------------------------------------------- + +module Plugins.StdinReader where + +import System.IO +import Plugins + +data StdinReader = StdinReader + deriving (Read, Show) + +instance Exec StdinReader where + start StdinReader cb = do + forever (hGetLine stdin >>= cb) + where forever a = a >> forever a |