split Commits and lifted
This commit is contained in:
parent
d2294f0dfa
commit
42babf5012
7 changed files with 33 additions and 19 deletions
|
@ -7,25 +7,21 @@
|
|||
|
||||
module Assistant.Commits where
|
||||
|
||||
import Assistant.Common
|
||||
import Assistant.Types.Commits
|
||||
|
||||
import Utility.TSet
|
||||
|
||||
type CommitChan = TSet Commit
|
||||
|
||||
data Commit = Commit
|
||||
|
||||
newCommitChan :: IO CommitChan
|
||||
newCommitChan = newTSet
|
||||
|
||||
{- Gets all unhandled commits.
|
||||
- Blocks until at least one commit is made. -}
|
||||
getCommits :: CommitChan -> IO [Commit]
|
||||
getCommits = getTSet
|
||||
getCommits :: Assistant [Commit]
|
||||
getCommits = getTSet <<~ commitChan
|
||||
|
||||
{- Puts unhandled commits back into the channel.
|
||||
- Note: Original order is not preserved. -}
|
||||
refillCommits :: CommitChan -> [Commit] -> IO ()
|
||||
refillCommits = putTSet
|
||||
refillCommits :: [Commit] -> Assistant ()
|
||||
refillCommits cs = flip putTSet cs <<~ commitChan
|
||||
|
||||
{- Records a commit in the channel. -}
|
||||
recordCommit :: CommitChan -> IO ()
|
||||
recordCommit = flip putTSet1 Commit
|
||||
recordCommit :: Assistant ()
|
||||
recordCommit = flip putTSet1 Commit <<~ commitChan
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue