further change to support dlist-1.0

Its tail no longer yields a DList.
This commit is contained in:
Joey Hess 2020-08-05 10:37:14 -04:00
parent 7077a7c2e7
commit 9994c5882c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -12,6 +12,7 @@
-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
module Utility.TList (
TList,
@ -44,7 +45,11 @@ newTList = newEmptyTMVar
headTList :: TList a -> STM a
headTList tlist = do
dl <- takeTMVar tlist
#if MIN_VERSION_dlist(1,0,0)
let !dl' = D.fromList $ D.tail dl
#else
let !dl' = D.tail dl
#endif
unless (emptyDList dl') $
putTMVar tlist dl'
return (D.head dl)