From 61517df00b34bb1b985705092de5e81d13fb59c9 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sat, 17 Mar 2012 22:39:10 +0100 Subject: tests && executables --- Network/EBus/Layer2.hs | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'Network/EBus') 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 -- cgit v1.2.1