Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
677d1109
Commit
677d1109
authored
Sep 09, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added monadic file traversal helper
parent
66989b04
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
src/Convert/Traverse.hs
+17
-8
No files found.
src/Convert/Traverse.hs
View file @
677d1109
...
...
@@ -79,6 +79,7 @@ module Convert.Traverse
,
traverseScopesM
,
scopedConversion
,
stately
,
traverseFilesM
,
traverseFiles
)
where
...
...
@@ -1068,17 +1069,25 @@ stately mapper thing = do
-- packages, or typenames in other files. Global resolution of modules and
-- interfaces is more commonly expected than global resolution of typenames and
-- packages.
traverseFiles
::
Monoid
w
traverseFiles
M
::
(
Monoid
w
,
Monad
m
)
=>
CollectorM
(
Writer
w
)
AST
->
(
w
->
Mapper
AST
)
->
Mapper
[
AST
]
traverseFiles
fileCollectorM
fileMapper
files
=
map
traverseFile
files
->
(
w
->
Mapper
M
m
AST
)
->
Mapper
M
m
[
AST
]
traverseFiles
M
fileCollectorM
fileMapperM
files
=
map
M
traverseFileM
files
where
globalNotes
=
execWriter
$
mapM
fileCollectorM
files
traverseFile
file
=
fileMapper
notes
file
traverseFile
M
file
=
fileMapper
M
notes
file
where
localNotes
=
execWriter
$
fileCollectorM
file
notes
=
localNotes
<>
globalNotes
traverseFiles
::
Monoid
w
=>
CollectorM
(
Writer
w
)
AST
->
(
w
->
Mapper
AST
)
->
Mapper
[
AST
]
traverseFiles
fileCollectorM
fileMapper
files
=
evalState
(
traverseFilesM
fileCollectorM
fileMapperM
files
)
()
where
fileMapperM
=
(
\
w
->
return
.
fileMapper
w
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment