diff options
Diffstat (limited to 'Network/EBus')
-rw-r--r-- | Network/EBus/Layer2.hs | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/Network/EBus/Layer2.hs b/Network/EBus/Layer2.hs index 496e9b1..c4f1d47 100644 --- a/Network/EBus/Layer2.hs +++ b/Network/EBus/Layer2.hs @@ -1,3 +1,5 @@ +module Network.EBus.Layer2 where + import Control.Applicative import Data.Attoparsec import Data.Attoparsec.Enumerator (iterParser) @@ -134,29 +136,3 @@ parser = do{ <|> fail "Failed to parse packet" } -main = do - -- * Select binary mode (True) or text mode (False) on a open handle. (See also openBinaryFile.) - hSetBinaryMode stdin True - -- * run - -- Run an iteratee until it finishes, and return either the final value (if it succeeded) or the error (if it failed). - -- * run_ - -- Like run, except errors are converted to exceptions and thrown. Primarily useful for small scripts or other simple cases. - - maybePacket <- run( enumSource $$ runParser ) - case maybePacket of - Right result -> print result - Left error -> print error - - maybePacket <- run( enumSource $$ runParser ) - case maybePacket of - Right result -> print result - Left error -> print error - - -enumSource :: Enumerator ByteString IO a -enumSource = enumHandle 1 stdin - -runParser :: Iteratee ByteString IO EbusPacket -runParser = do - p <- iterParser parser - return p |