Use Data.Map on streaming side as well
This commit is contained in:
parent
87f6eb00f6
commit
e189f87dd7
@ -17,7 +17,7 @@ import System.IO
|
|||||||
|
|
||||||
import qualified Data.Foldable as F
|
import qualified Data.Foldable as F
|
||||||
|
|
||||||
import qualified Data.Trie as Trie
|
import qualified Data.Map.Strict as Map
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
(fromMaybe)
|
(fromMaybe)
|
||||||
@ -36,7 +36,7 @@ run = do
|
|||||||
datDir <- fromMaybe "./" <$> lookupEnv "HOME"
|
datDir <- fromMaybe "./" <$> lookupEnv "HOME"
|
||||||
runResourceT $ do
|
runResourceT $ do
|
||||||
x <- runConduit stream
|
x <- runConduit stream
|
||||||
runConduit (CL.sourceList (Trie.keys x) .| C.map (<> "\n") .| CB.sinkFileCautious (datDir </> ".addressbook.dat"))
|
runConduit (CL.sourceList (Map.keys x) .| C.map (<> "\n") .| CB.sinkFileCautious (datDir </> ".addressbook.dat"))
|
||||||
where
|
where
|
||||||
separate = \case
|
separate = \case
|
||||||
From x -> [x]
|
From x -> [x]
|
||||||
@ -49,4 +49,4 @@ run = do
|
|||||||
.| combine
|
.| combine
|
||||||
.| C.concatMap separate
|
.| C.concatMap separate
|
||||||
.| CT.encode CT.utf8
|
.| CT.encode CT.utf8
|
||||||
.| C.foldMap (`Trie.singleton` ())
|
.| C.foldMap (`Map.singleton` ())
|
||||||
|
Loading…
Reference in New Issue
Block a user