1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Use zipWithM (because Monad zippers are the best zippers)

This commit is contained in:
Rick Winfrey 2016-11-23 13:31:27 -06:00
parent eb88b46d6f
commit 800f1b4c13

View File

@ -33,6 +33,7 @@ data ParseJSON = ParseJSON
run :: Arguments -> IO ()
run Arguments{..} = do
sources <- sequence $ readAndTranscodeFile <$> filePaths
terms <- zipWithM (\parser sourceBlob -> parser sourceBlob) parsers (sourceBlobs sources)
let sourceBlobs = Source.SourceBlob <$> sources <*> pure mempty <*> filePaths <*> pure (Just Source.defaultPlainBlob)
let parsers = parserWithSource <$> filePaths
@ -45,6 +46,8 @@ run Arguments{..} = do
pure ()
where
sourceBlobs sources = Source.SourceBlob <$> sources <*> pure mempty <*> filePaths <*> pure (Just Source.defaultPlainBlob)
parsers = parserWithSource <$> filePaths
algebra term = case term of
(annotation :< syntax) -> cofree $ (ParseJSON category' range' sourceText') :< syntax
where category' = toS $ Info.category annotation