@@ -81,7 +81,7 @@ import Idris.TypeSearch (searchByType)
81import Idris.WhoCalls
81import Idris.WhoCalls
82import IRTS.CodegenCommon
82import IRTS.CodegenCommon
83import IRTS.Compiler
83import IRTS.Compiler
84−import Network
84+import Network.Socket hiding (defaultPort)
85#if (MIN_VERSION_base(4,11,0))
85#if (MIN_VERSION_base(4,11,0))
86import Prelude hiding (id, (.), (<$>), (<>))
86import Prelude hiding (id, (.), (<$>), (<>))
@@ -166,7 +166,8 @@ startServer port orig fn_in = do tid <- runIO $ forkIO (serverLoop port)
166 fn = fromMaybe "" (listToMaybe fn_in)
166 fn = fromMaybe "" (listToMaybe fn_in)
168 loop fn ist sock
168 loop fn ist sock
169− = do (h,_,_) <- accept sock
169+ = do (s, _) <- accept sock
170+ h <- socketToHandle s ReadWriteMode
170 hSetEncoding h utf8
171 hSetEncoding h utf8
171 cmd <- hGetLine h
172 cmd <- hGetLine h
172 let isth = case idris_outputmode ist of
173 let isth = case idris_outputmode ist of
@@ -218,9 +219,11 @@ processNetCmd orig i h fn cmd
218runClient :: Maybe PortNumber -> String -> IO ()
219runClient :: Maybe PortNumber -> String -> IO ()
219runClient port str = withSocketsDo $ do
220runClient port str = withSocketsDo $ do
220 let port' = fromMaybe defaultPort port
221 let port' = fromMaybe defaultPort port
221− res <- X.try (connectTo "localhost" $ PortNumber port')
222+ s <- socket AF_INET Stream defaultProtocol
223+ res <- X.try (connect s (SockAddrInet port' $ tupleToHostAddress (127,0,0,1)))
222 case res of
224 case res of
223− Right h -> do
225+ Right () -> do
226+ h <- socketToHandle s ReadWriteMode
224 hSetEncoding h utf8
227 hSetEncoding h utf8
225 hPutStrLn h str
228 hPutStrLn h str
226 resp <- hGetResp "" h
229 resp <- hGetResp "" h
@@ -245,7 +248,8 @@ initIdemodeSocket :: IO Handle
245initIdemodeSocket = do
248initIdemodeSocket = do
246 (sock, port) <- listenOnLocalhostAnyPort
249 (sock, port) <- listenOnLocalhostAnyPort
247 putStrLn $ show port
250 putStrLn $ show port
248− (h, _, _) <- accept sock
251+ (s, _) <- accept sock
252+ h <- socketToHandle s ReadWriteMode
249 hSetEncoding h utf8
253 hSetEncoding h utf8
@@ -1229,8 +1233,8 @@ process fn (Prove mode n')
1229 let metavars = mapMaybe (\n -> do c <- lookup n (idris_metavars ist); return (n, c)) ns
1233 let metavars = mapMaybe (\n -> do c <- lookup n (idris_metavars ist); return (n, c)) ns
1230 n <- case metavars of
1234 n <- case metavars of
1231 [] -> ierror (Msg $ "Cannot find metavariable " ++ show n')
1235 [] -> ierror (Msg $ "Cannot find metavariable " ++ show n')
1232− [(n, (_,_,_,False,_))] -> return n
1236+ [(n, (_,_,_,False,_))] -> return n
1233− [(_, (_,_,_,_,False))] -> ierror (Msg "Can't prove this hole as it depends on other holes")
1237+ [(_, (_,_,_,_,False))] -> ierror (Msg "Can't prove this hole as it depends on other holes")
1234 [(_, (_,_,_,True,_))] -> ierror (Msg "Declarations not solvable using prover")
1238 [(_, (_,_,_,True,_))] -> ierror (Msg "Declarations not solvable using prover")
1235 ns -> ierror (CantResolveAlts (map fst ns))
1239 ns -> ierror (CantResolveAlts (map fst ns))
1236 prover (toplevelWith fn) mode (lit fn) n
1240 prover (toplevelWith fn) mode (lit fn) n