diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2012-03-17 22:39:10 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2012-03-17 22:39:10 +0100 |
commit | 61517df00b34bb1b985705092de5e81d13fb59c9 (patch) | |
tree | ddf25ab97efa40525746eed8639c6d03a57496f7 /Network/EBus | |
parent | 63d34635cc895019a3c4e510e5d10a6a715e2e85 (diff) | |
download | haskell-ebus-61517df00b34bb1b985705092de5e81d13fb59c9.tar.gz haskell-ebus-61517df00b34bb1b985705092de5e81d13fb59c9.zip |
tests && executables
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 |