haskell / haskell/fgl

`gfiltermap` can result in inconsistent graph.

Open
#93 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Haskell
Stars
200
Forks
58
PR merge metrics
No merged PRs in 30d

Description

Consider this code:

isLeaf :: Context a b -> Bool
isLeaf (_, _, _, [ ]) = True
isLeaf (_, _, _, _ ) = False

tearLeaves = let p x = if isLeaf x then Nothing else Just x in gfiltermap p

Example:

λ dag3
mkGraph [(1,'a'),(2,'b'),(3,'c')] [(1,3,())]
λ tearLeaves dag3
mkGraph [(1,'a')] [(1,3,())]

As you see, we obtain a hanging edge.

I propose `gfiltermap` is improved so that validity of graphs is preserved.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.