summaryrefslogtreecommitdiffhomepage
path: root/Plugins/StdinReader.hs
blob: 7ad2b4182698b1e2f2db081d9dc08917dcc78951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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