use a newtype for better type safety
This commit is contained in:
parent
892d691ffd
commit
6b6ce30b42
1 changed files with 5 additions and 4 deletions
|
@ -8,14 +8,15 @@
|
|||
module Assistant.BranchChange where
|
||||
|
||||
import Control.Concurrent.MSampleVar
|
||||
import Assistant.Common
|
||||
|
||||
type BranchChangeHandle = MSampleVar ()
|
||||
newtype BranchChangeHandle = BranchChangeHandle (MSampleVar ())
|
||||
|
||||
newBranchChangeHandle :: IO BranchChangeHandle
|
||||
newBranchChangeHandle = newEmptySV
|
||||
newBranchChangeHandle = BranchChangeHandle <$> newEmptySV
|
||||
|
||||
branchChanged :: BranchChangeHandle -> IO ()
|
||||
branchChanged = flip writeSV ()
|
||||
branchChanged (BranchChangeHandle h) = writeSV h ()
|
||||
|
||||
waitBranchChange :: BranchChangeHandle -> IO ()
|
||||
waitBranchChange = readSV
|
||||
waitBranchChange (BranchChangeHandle h) = readSV h
|
||||
|
|
Loading…
Reference in a new issue