Skip to content

Commit

Permalink
WIP: fails tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Aug 13, 2024
1 parent bd1acdf commit 365a0e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,18 @@ trimRow :: SymbolSequence a -> TrimmedRowContent a
trimRow xs =
TrimmedRowContent
{ fullRow = xs
, trimmed = xs
, leftDrops = 0
, rightDrops = 0
, trimmed = reverse remainingMiddleReversed
, leftDrops = nullPrefixLength
, rightDrops = nullSuffixLength
}
where
(nullPrefixLength, remainingTail) = countDrops xs
(nullSuffixLength, remainingMiddleReversed) = countDrops $ reverse remainingTail

countDrops s =
(length nulls, remainder)
where
(nulls, remainder) = span null s

-- * Util

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ data TrimmedRowContent a = TrimmedRowContent
, leftDrops :: Int
, rightDrops :: Int
}
deriving (Show, Generic, ToJSON)

-- | This wrapper facilitates naming the original structure
-- (i.e. the "payload" for recognition)
Expand Down

0 comments on commit 365a0e4

Please sign in to comment.