contrib: rpc_examples: haskell: fix ftbs with current libraries
And get rid of some warnings along the way. Change-Id: I8fdbe1fa304276be6b0f25249b902b3576aa3793 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5987 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
b5098754cf
commit
f67d7a3c48
|
@ -16,13 +16,11 @@
|
|||
module Main where
|
||||
|
||||
import Prelude
|
||||
import Control.Applicative
|
||||
import Network.Socket
|
||||
import System.IO.Streams.Core hiding (connect)
|
||||
import System.IO.Streams.Network
|
||||
import System.IO.Streams.Attoparsec
|
||||
import Data.Attoparsec.ByteString.Char8
|
||||
import Data.Attoparsec.Combinator
|
||||
import Data.ByteString.Char8 hiding (putStrLn, concat, map)
|
||||
import Text.Printf
|
||||
|
||||
|
@ -38,15 +36,14 @@ mdwParser = (manyTill anyChar (string ": ") *>
|
|||
`sepBy` string " \n"
|
||||
|
||||
ocdMdw :: (InputStream ByteString, OutputStream ByteString) -> Integer -> Integer -> IO [Integer]
|
||||
ocdMdw s start count = do
|
||||
s <- ocdExec s $ "mdw " ++ show start ++ " " ++ show count
|
||||
case parseOnly mdwParser (pack s) of
|
||||
ocdMdw s start qnt = do
|
||||
res <- ocdExec s $ "mdw " ++ show start ++ " " ++ show qnt
|
||||
case parseOnly mdwParser (pack res) of
|
||||
Right r -> return $ concat r
|
||||
|
||||
main = do
|
||||
osock <- socket AF_INET Stream defaultProtocol
|
||||
haddr <- inet_addr "127.0.0.1"
|
||||
connect osock (SockAddrInet 6666 haddr)
|
||||
connect osock (SockAddrInet 6666 $ tupleToHostAddress (127,0,0,1))
|
||||
ostreams <- socketToStreams osock
|
||||
putStrLn "Halting the target, full log output captured:"
|
||||
ocdExec ostreams "capture \"halt\"" >>= putStrLn
|
||||
|
|
Loading…
Reference in New Issue