Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions cli/src/Graph/MaterializePath.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
traverseRooted nid RootedDeterministicPath {..} = do
rootBranches' ::
[ [ ( DeterministicPath NID,
OSet (DPBranch FullyAnchored)
NonNull (OSet (DPBranch FullyAnchored))
)
]
] <-
Expand All @@ -106,15 +106,16 @@
<&> map (\(rs, bs) -> (,bs) <$> rs)
<&> choices
rootBranches'' ::
[(OMap (DeterministicPath NID) (OSet (DPBranch NID)), NID)] <-
[(OMap (DeterministicPath NID) (NonNull (OSet (DPBranch NID))), NID)] <-
rootBranches'
& (traverse . traverse)
(\(dp, bs) -> (dp,) <$> traverseBranches dp.target.anchor bs)
(\(dp, bs) -> (dp,) <$> traverseBranches dp.target.anchor (toNullable bs))
<&> map (map \(r, bas) -> (\(b, a) -> ((r, b), a)) <$> bas)
<&> concatMap choices
<&> mapMaybe (ensureSameAnchors . impureNonNull)
<&> ordNub
<&> over (mapped . _1) (mapFromList . toNullable)
<&> over (mapped . _1) (impureNonNull . mapFromList . toNullable)
<&> over (mapped . _1 . mapped . _2) impureNonNull
rootBranches''
& (traverse . _2) (\x -> traversePointlike False x target)
<&> concatMap (\(rbs, ts) -> (rbs,) <$> ts)
Expand Down Expand Up @@ -178,11 +179,11 @@
DPOutgoing transition -> traverseTransition nid (.outgoing) DPOutgoing transition
DPIncoming transition -> traverseTransition nid (.incoming) DPIncoming transition
DPSequence bs1 midpoint bs2 -> do
bs1's <- traverseBranches nid bs1
bs1's <- traverseBranches nid (toNullable bs1)
uptoMidpoints :: [(OSet (DPBranch NID), PointlikeDeterministicPath NID)] <-
bs1's
& (traverse . _2) (\x -> traversePointlike False x midpoint)
<&> concatMap (\(bs1', ms) -> (bs1',) <$> ms)
uptoMidpoints
& (traverse . _2) (\p -> (p,) <$> traverseBranches p.anchor bs2)
<&> concatMap (\(bs1', (p, bs2'ts)) -> first (DPSequence bs1' p) <$> bs2'ts)
& (traverse . _2) (\p -> (p,) <$> traverseBranches p.anchor (toNullable bs2))
<&> concatMap (\(bs1', (p, bs2'ts)) -> first (\bs2' -> DPSequence (impureNonNull bs1') p (impureNonNull bs2')) <$> bs2'ts)

Check warning on line 189 in cli/src/Graph/MaterializePath.hs

View workflow job for this annotation

GitHub Actions / HLint

Suggestion in materializeNPath in module Graph.MaterializePath: Avoid lambda ▫︎ Found: "\\ bs2' -> DPSequence (impureNonNull bs1') p (impureNonNull bs2')" ▫︎ Perhaps: "DPSequence (impureNonNull bs1') p . impureNonNull"
Loading
Loading