-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing other tests impacted by the refactoring
- Loading branch information
Showing
6 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import Control.Linear.LIO | ||
import Data.Linear.Notation | ||
|
||
foo : LinearIO io => L io () | ||
foo = do putStrLn "Hello" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import Control.Linear.LIO | ||
import Data.Linear.Notation | ||
|
||
import Network.Socket | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Control.Linear.LIO | ||
import System.Concurrency.Session | ||
import Data.Linear.Notation | ||
|
||
main : IO () | ||
main = LIO.run $ do | ||
let nm1 : String := "natrando" | ||
let nm2 : String := "computer" | ||
putStrLn "main: Forking two threads \{nm1} and \{nm2}" | ||
res <- fork (Send Nat $ Send Nat $ Recv Nat End) | ||
(\ ch => do let m : Nat := 100 | ||
putStrLn "\{nm1}: picked the natural \{show m}" | ||
ch <- send ch m | ||
let n : Nat := 50 | ||
putStrLn "\{nm1}: picked the natural \{show n}" | ||
ch <- send ch n | ||
(s # ch) <- recv ch | ||
end ch | ||
pure (m, n)) | ||
(\ ch => do (m # ch) <- recv ch | ||
(n # ch) <- recv ch | ||
putStrLn "\{nm2}: summing \{show m} and \{show n}" | ||
let s = m + n | ||
ch <- send ch s | ||
end ch | ||
pure s) | ||
let mn = fst res | ||
let mplusn = snd res | ||
putStrLn {io = L IO} "main: Threads have finished and returned \{show mn} and \{show mplusn}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
main: Forking two threads natrando and computer | ||
natrando: picked the natural 100 | ||
natrando: picked the natural 50 | ||
computer: summing 100 and 50 | ||
main: Threads have finished and returned (100, 50) and 150 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
. ../../testutils.sh | ||
|
||
run -p linear Main.idr |