Skip to content

Commit dc34df6

Browse files
committed
fix import
1 parent bd79156 commit dc34df6

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

ghcide/session-loader/Development/IDE/Session/Ghc.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import Development.IDE.Types.Diagnostics
3030
import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq)
3131
import Development.IDE.Types.Location
3232
import GHC.ResponseFile
33+
import qualified HIE.Bios.Cradle.Utils as HieBios
3334
import HIE.Bios.Environment hiding (getCacheDir)
3435
import HIE.Bios.Types hiding (Log)
3536
import Ide.Logger (Pretty (pretty),

ghcide/session-loader/Development/IDE/Session/OrderedSet.hs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,12 @@ type OrderedSet a = (TQueue a, Set a)
1616

1717
-- | Insert an element into the ordered set.
1818
-- If the element is not already present, it is added to both the queue and set.
19-
-- If the element already exists, it is moved to the end of the queue to maintain
20-
-- most-recently-inserted ordering semantics.
21-
-- It take O(n), not very good.
22-
23-
-- Alternative: preserve original position and ignore new one.
24-
-- I am not sure which one is better.
19+
-- If the element already exists, ignore it
2520
insert :: Hashable a => a -> OrderedSet a -> STM ()
2621
insert a (que, s) = do
2722
(_, inserted) <- S.focus (Focus.testingIfInserts $ Focus.insert ()) a s
2823
-- if already in the set
29-
-- update the position of the element in the queue
30-
when (not inserted) $ do
31-
items <- filter (==a) <$> flushTQueue que
32-
mapM_ (writeTQueue que) items
33-
return ()
34-
writeTQueue que a
24+
when inserted $ writeTQueue que a
3525

3626
newIO :: Hashable a => IO (OrderedSet a)
3727
newIO = do
@@ -58,5 +48,5 @@ lookup a (_, s) = S.lookup a s
5848
delete :: Hashable a => a -> OrderedSet a -> STM ()
5949
delete a (_, s) = S.delete a s
6050

61-
toHashSet :: Hashable a => OrderedSet a -> Data.HashSet a
62-
toHashSet (_, s) = TreeSet.fromList $ LT.toList $ S.listT s
51+
toHashSet :: Hashable a => OrderedSet a -> STM (Data.HashSet.HashSet a)
52+
toHashSet (_, s) = Data.HashSet.fromList <$> LT.toList (S.listT s)

0 commit comments

Comments
 (0)