diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-24 13:15:31 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-24 13:15:31 -0400 |
commit | e7005a07d9d6577e837a61e4bc9c80133321ae03 (patch) | |
tree | 28c78a7b00c9425264892df91d3cafcd990d8d24 /Assistant/BranchChange.hs | |
parent | 96c83b2a830ffb93384652779456b6895b080192 (diff) |
use a newtype for better type safety
Diffstat (limited to 'Assistant/BranchChange.hs')
-rw-r--r-- | Assistant/BranchChange.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Assistant/BranchChange.hs b/Assistant/BranchChange.hs index b166c8777..d1d1c20df 100644 --- a/Assistant/BranchChange.hs +++ b/Assistant/BranchChange.hs @@ -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 |