Skip to content
Open
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
2 changes: 1 addition & 1 deletion src-extra/transformation/JbeamEdit/Transformation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Data.Bool (bool)
import Data.Foldable.Extra (notNull)
import Data.Function (on)
import Data.List (foldl', partition)

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on windows-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on ubuntu-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.10.3 (experimental)

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on ubuntu-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on windows-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.10.3 (experimental)

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on windows-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on ubuntu-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.10.3 (experimental)

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on ubuntu-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on windows-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.10.3 (experimental)

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on windows-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on ubuntu-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.10.3 (experimental)

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on ubuntu-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build and test with Cabal (GHC latest) on windows-latest

The import of ‘foldl'’ from module ‘Data.List’ is redundant

Check warning on line 7 in src-extra/transformation/JbeamEdit/Transformation.hs

View workflow job for this annotation

GitHub Actions / Build for release for 9.10.3 (experimental)

The import of ‘foldl'’ from module ‘Data.List’ is redundant
import Data.List.NonEmpty (NonEmpty)
import Data.List.NonEmpty qualified as NE
import Data.Map (Map)
Expand Down Expand Up @@ -317,7 +317,7 @@
oMap

(_, listsOfNodes) = mapAccumL stepType initialMeta treesOrder
in V.fromList (concat listsOfNodes)
in foldMap V.fromList listsOfNodes

treesOrder :: [VertexTreeType]
treesOrder = [LeftTree, MiddleTree, RightTree, SupportTree]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import Data.Map (Map)
import Data.Map qualified as M
import Data.Maybe (catMaybes)
import Data.Ord (Down (Down))
import Data.Set (Set)
import Data.Set qualified as S
import Data.Text (Text)
import Data.Vector (Vector)
import Data.Vector qualified as V
Expand All @@ -20,15 +22,14 @@ beamQuery :: NP.NodePath
beamQuery = fromList [NP.ObjectIndex 0, NP.ObjectKey "beams"]

rejectUnknownName
:: Foldable t
=> t Text
:: Set Text
-> Maybe (Vector Text)
-> Maybe (Vector Text)
rejectUnknownName knownNodeNames maybeBeam =
bool
maybeBeam
Nothing
(any (any (`notElem` knownNodeNames)) maybeBeam)
(any (any (`S.notMember` knownNodeNames)) maybeBeam)

possiblyBeam :: Node -> Either Node (Maybe (Vector Text))
possiblyBeam node
Expand All @@ -53,7 +54,7 @@ vertexConns
vertexConns maxSupport topNode vsPerType =
go <$> extractBeams topNode
where
knownNodeNames = concatMap (map anVertexName) vsPerType
knownNodeNames = foldMap (foldr (S.insert . anVertexName) mempty) vsPerType
go beams =
let possiblyInnerBeam = (:) . fmap (rejectUnknownName knownNodeNames) . possiblyBeam
(badNodes, beamPairs) =
Expand Down
2 changes: 1 addition & 1 deletion src/JbeamEdit/Core/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ possiblyChildren n = expectArray n <|> expectObject n

moreNodesThanOne :: Vector Node -> Bool
moreNodesThanOne v
| len == 1 = any moreNodesThanOne . possiblyChildren $ V.head v
| len == 1 = any moreNodesThanOne . possiblyChildren $ V.unsafeHead v
| len > 1 = True
| otherwise = False
where
Expand Down
9 changes: 4 additions & 5 deletions src/JbeamEdit/Formatting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ applyIndentation n s
| otherwise = T.replicate n " " <> s

skipHeaderRow :: Vector (Vector Node) -> Vector (Vector Node)
skipHeaderRow nodes =
case V.uncons nodes of
Just (headerRow, rest) ->
bool nodes rest (all isStringNode headerRow)
Nothing -> nodes
skipHeaderRow nodes
| V.length nodes > 1 =
bool nodes (V.unsafeTail nodes) (all isStringNode $ V.unsafeHead nodes)
| otherwise = nodes

maxColumnLengths
:: RuleSet -> NC.NodeCursor -> Vector (Vector Node) -> Vector Int
Expand Down