mirror of
https://github.com/alexwl/haskell-code-explorer.git
synced 2024-11-23 00:37:44 +03:00
Replace Vector.fromList with Vector.fromListN
Vector.fromListN allocates less memory and allows to remove the call to Vector.force before compaction ('compact $ Vector.fromList [1,2,3]' crashes, 'compact $ Vector.fromListN 3 [1,2,3]' doesn't crash)
This commit is contained in:
parent
7488749af2
commit
27024fa574
@ -374,15 +374,9 @@ loadPackageInfo config path =
|
||||
( updateEachModuleInfo
|
||||
packageInfo
|
||||
(\modInfo ->
|
||||
let source =
|
||||
HCE.source :: HCE.CompactModuleInfo -> V.Vector T.Text
|
||||
in if not enableExpressionInfo
|
||||
then modInfo
|
||||
{ HCE.exprInfoMap = IVM.empty
|
||||
, HCE.source = V.force $ source modInfo
|
||||
-- 'force' fixes this error: Data.Vector.Mutable: uninitialised element CallStack (from HasCallStack): error, called at ./Data/Vector/Mutable.hs:188:17 in vector-0.12.0.1-GGZqQZyzchy8YFPCF67wxL:Data.Vector.Mutable
|
||||
}
|
||||
else modInfo {HCE.source = V.force $ source modInfo})
|
||||
if not enableExpressionInfo
|
||||
then modInfo {HCE.exprInfoMap = IVM.empty}
|
||||
else modInfo)
|
||||
, path)
|
||||
Left e -> return . Left $ (e, path)
|
||||
|
||||
|
@ -549,7 +549,7 @@ instance Serialize IdentifierOccurrenceSort
|
||||
instance Serialize TypeComponent
|
||||
instance (Serialize a) => Serialize (V.Vector a) where
|
||||
put = put . V.toList
|
||||
get = V.fromList <$> get
|
||||
get = (\l -> V.fromListN (L.length l) l) <$> get
|
||||
instance Serialize Type
|
||||
instance Serialize ExpressionInfo
|
||||
instance Serialize LocatableEntity
|
||||
|
Loading…
Reference in New Issue
Block a user