Skip to content

Commit 58b9bff

Browse files
committed
tttool lint: Slightly improve code
1 parent 7c062ef commit 58b9bff

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Lint.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import PrettyPrint
1111
lintTipToi :: TipToiFile -> Segments -> IO ()
1212
lintTipToi tt segments = do
1313
let hyps = [ (hyp1, "play indicies are correct")
14-
, (hyp2 (fromIntegral (length (ttAudioFiles tt))),
15-
"media indicies are correct")
14+
, (hyp2, "media indicies are correct")
1615
]
1716
forM_ hyps $ \(hyp, desc) -> do
1817
let wrong = filter (not . hyp) (concat (mapMaybe snd (ttScripts tt)))
@@ -41,8 +40,11 @@ lintTipToi tt segments = do
4140
0 <= b && b < fromIntegral (length mi)
4241
ok _ = True
4342

44-
hyp2 :: Word16 -> Line ResReg -> Bool
45-
hyp2 n (Line _ _ _ mi) = all (<= n) mi
43+
media_count :: Word16
44+
media_count = fromIntegral (length (ttAudioFiles tt))
45+
46+
hyp2 :: Line ResReg -> Bool
47+
hyp2 (Line _ _ _ mi) = all (< media_count) mi
4648

4749
report :: Segment -> Segment -> IO ()
4850
report (o1,l1,d1) (o2,l2,d2)

0 commit comments

Comments
 (0)