further change to support dlist-1.0
Its tail no longer yields a DList.
This commit is contained in:
parent
7077a7c2e7
commit
9994c5882c
1 changed files with 5 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE BangPatterns #-}
|
{-# LANGUAGE BangPatterns #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module Utility.TList (
|
module Utility.TList (
|
||||||
TList,
|
TList,
|
||||||
|
@ -44,7 +45,11 @@ newTList = newEmptyTMVar
|
||||||
headTList :: TList a -> STM a
|
headTList :: TList a -> STM a
|
||||||
headTList tlist = do
|
headTList tlist = do
|
||||||
dl <- takeTMVar tlist
|
dl <- takeTMVar tlist
|
||||||
|
#if MIN_VERSION_dlist(1,0,0)
|
||||||
|
let !dl' = D.fromList $ D.tail dl
|
||||||
|
#else
|
||||||
let !dl' = D.tail dl
|
let !dl' = D.tail dl
|
||||||
|
#endif
|
||||||
unless (emptyDList dl') $
|
unless (emptyDList dl') $
|
||||||
putTMVar tlist dl'
|
putTMVar tlist dl'
|
||||||
return (D.head dl)
|
return (D.head dl)
|
||||||
|
|
Loading…
Reference in a new issue