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
Hide 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
...
@@ -79,6 +79,7 @@ module Convert.Traverse
,
traverseScopesM
,
traverseScopesM
,
scopedConversion
,
scopedConversion
,
stately
,
stately
,
traverseFilesM
,
traverseFiles
,
traverseFiles
)
where
)
where
...
@@ -1068,17 +1069,25 @@ stately mapper thing = do
...
@@ -1068,17 +1069,25 @@ stately mapper thing = do
-- packages, or typenames in other files. Global resolution of modules and
-- packages, or typenames in other files. Global resolution of modules and
-- interfaces is more commonly expected than global resolution of typenames and
-- interfaces is more commonly expected than global resolution of typenames and
-- packages.
-- packages.
traverseFiles
traverseFiles
M
::
Monoid
w
::
(
Monoid
w
,
Monad
m
)
=>
CollectorM
(
Writer
w
)
AST
=>
CollectorM
(
Writer
w
)
AST
->
(
w
->
Mapper
AST
)
->
(
w
->
Mapper
M
m
AST
)
->
Mapper
[
AST
]
->
Mapper
M
m
[
AST
]
traverseFiles
fileCollectorM
fileMapper
files
=
traverseFiles
M
fileCollectorM
fileMapperM
files
=
map
traverseFile
files
map
M
traverseFileM
files
where
where
globalNotes
=
execWriter
$
mapM
fileCollectorM
files
globalNotes
=
execWriter
$
mapM
fileCollectorM
files
traverseFile
file
=
traverseFile
M
file
=
fileMapper
notes
file
fileMapper
M
notes
file
where
where
localNotes
=
execWriter
$
fileCollectorM
file
localNotes
=
execWriter
$
fileCollectorM
file
notes
=
localNotes
<>
globalNotes
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