From b7d7252649ac9747f4630a0434212fd4a7c94a1e Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Wed, 10 Mar 2021 17:49:54 +0100 Subject: [PATCH] refactor: hlint --- src/Handler/Utils/Exam.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Handler/Utils/Exam.hs b/src/Handler/Utils/Exam.hs index c6da1aef6..16be8b762 100644 --- a/src/Handler/Utils/Exam.hs +++ b/src/Handler/Utils/Exam.hs @@ -328,7 +328,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences fillUnrestricted :: [ExamOccurrenceId] -> ([(UserId, Maybe ExamOccurrenceId)], [UserId]) -> [(UserId, Maybe ExamOccurrenceId)] fillUnrestricted _unrestrictedRooms (acc, []) = acc fillUnrestricted [] _ = error "fillUnrestricted should only be called with an infinite list" - fillUnrestricted (nextRoom:followingRooms) (acc, (nextUser:remainingUsers)) + fillUnrestricted (nextRoom:followingRooms) (acc, nextUser:remainingUsers) = fillUnrestricted followingRooms ((nextUser, Just nextRoom) : acc, remainingUsers) _ -> bimap (ExamOccurrenceMapping rule) (Map.unionWith (<|>) (view _2 <$> users)) . postprocess <$> bestOption where @@ -421,7 +421,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences where longestLine :: Natural -- ^ For scaling costs - longestLine = maximum $ impureNonNull $ catMaybes $ (view $ _2 . _examOccurrenceCapacityIso) <$> lineLengths + longestLine = maximum $ impureNonNull $ catMaybes $ view (_2 . _examOccurrenceCapacityIso) <$> lineLengths -- only evaluated for restricted lines, so impureNonNull is fine here wordMap :: Map wordId Natural @@ -527,7 +527,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences | otherwise = Finite (max 1 . abs $ ((fromIntegral w % fromIntegral lineWidth) - optimumRatio') * fromIntegral longestLine) ^ 2 where optimumRatio = ((%) `on` fromIntegral . max 1 . sum) (map (view _2) wordLengths) restrictedLengths - restrictedLengths = catMaybes $ (view $ _2 . _examOccurrenceCapacityIso) <$> lineLengths + restrictedLengths = catMaybes $ view (_2 . _examOccurrenceCapacityIso) <$> lineLengths -- ^ might be empty, so we need max 1 after sum! optimumRatio' = maybe 0 (fromIntegral . lineNudge) l * eaocNudgeSize + optimumRatio @@ -536,7 +536,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences where longestLine :: Natural longestLine = maybe 1 maximum $ fromNullable $ catMaybes - $ (view $ _2 . _examOccurrenceCapacityIso) <$> occurrences'' + $ view (_2 . _examOccurrenceCapacityIso) <$> occurrences'' lcp :: Eq a => [a] -> [a] -> [a]