Skip to content
Snippets Groups Projects
Commit cc63cc9c authored by John van Groningen's avatar John van Groningen
Browse files

Use strict maybe types in TCPIP library examples

parent b7959bd8
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ loop listener channels console world ...@@ -34,7 +34,7 @@ loop listener channels console world
= unzip3 channels = unzip3 channels
glue = (TCP_Listeners [listener]) :^: (TCP_RChannels rChans) glue = (TCP_Listeners [listener]) :^: (TCP_RChannels rChans)
([(who,what):_],glue, _, world) ([(who,what):_],glue, _, world)
= selectChannel_MT Nothing glue Void world = selectChannel_MT ?None glue Void world
((TCP_Listeners [listener:_]) :^: (TCP_RChannels rChans)) ((TCP_Listeners [listener:_]) :^: (TCP_RChannels rChans))
= glue = glue
channels = zip3 sChans rChans nicknames channels = zip3 sChans rChans nicknames
...@@ -43,7 +43,7 @@ loop listener channels console world ...@@ -43,7 +43,7 @@ loop listener channels console world
| who==0 | who==0
# (tReport, mbNewMember, listener, world) # (tReport, mbNewMember, listener, world)
= receive_MT (Just 0) listener world = receive_MT (?Just 0) listener world
| tReport<>TR_Success // the potential new member changed it's mind | tReport<>TR_Success // the potential new member changed it's mind
= loop listener channels console world = loop listener channels console world
# (_,{sChannel,rChannel}) = fromJust mbNewMember # (_,{sChannel,rChannel}) = fromJust mbNewMember
......
...@@ -30,7 +30,7 @@ Start world ...@@ -30,7 +30,7 @@ Start world
// connect // connect
# (tReport, mbDuplexChan, world) # (tReport, mbDuplexChan, world)
= connectTCP_MT (Just (15*ticksPerSecond)) = connectTCP_MT (?Just (15*ticksPerSecond))
(fromJust mbIPAddr, port) world (fromJust mbIPAddr, port) world
| tReport<>TR_Success | tReport<>TR_Success
#! console = fwrites ( server+++" does not respond on port " #! console = fwrites ( server+++" does not respond on port "
...@@ -46,7 +46,7 @@ Start world ...@@ -46,7 +46,7 @@ Start world
// receive answer // receive answer
(tReport, mbBs, rc, world) = receive_MT (Just (20*ticksPerSecond)) rc world (tReport, mbBs, rc, world) = receive_MT (?Just (20*ticksPerSecond)) rc world
console = case tReport of console = case tReport of
TR_Success -> fwrites (toString (fromJust mbBs)) console TR_Success -> fwrites (toString (fromJust mbBs)) console
_ -> fwrites (server+++" does not send anything (timeout expired)") _ -> fwrites (server+++" does not send anything (timeout expired)")
......
...@@ -29,7 +29,7 @@ Start world ...@@ -29,7 +29,7 @@ Start world
// connect // connect
# (tReport, mbDuplexChan, world) # (tReport, mbDuplexChan, world)
= connectTCP_MT (Just (15*ticksPerSecond)) = connectTCP_MT (?Just (15*ticksPerSecond))
(fromJust mbIPAddr, echoPort) world (fromJust mbIPAddr, echoPort) world
| tReport<>TR_Success | tReport<>TR_Success
#! console = fwrites ( server+++" does not respond on port " #! console = fwrites ( server+++" does not respond on port "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment