@@ -272,12 +272,12 @@ directOptimization gap overlapλ _renderingFunction matrixFunction lhs rhs =
272
272
273
273
274
274
{-# INLINEABLE measureCharacters #-}
275
- {-# SPECIALISE measureCharacters :: Vector SymbolContext -> Vector SymbolContext -> (Bool , [SymbolContext], [SymbolContext]) #-}
275
+ {-# SPECIALISE measureCharacters :: Vector SymbolContext -> Vector SymbolContext -> (Ordering , [SymbolContext], [SymbolContext]) #-}
276
276
measureCharacters
277
277
:: Foldable f
278
278
=> f SymbolContext
279
279
-> f SymbolContext
280
- -> (Bool , [SymbolContext ], [SymbolContext ])
280
+ -> (Ordering , [SymbolContext ], [SymbolContext ])
281
281
measureCharacters lhs rhs =
282
282
let f = maybe [] toList
283
283
(b, x, y) = measureNullableCharacters (Just lhs) (Just rhs)
@@ -298,15 +298,15 @@ measureCharacters lhs rhs =
298
298
--
299
299
-- Handles equality of inputs by /not/ swapping.
300
300
{-# INLINEABLE measureNullableCharacters #-}
301
- {-# SPECIALISE measureNullableCharacters :: Maybe (Vector SymbolContext) -> Maybe (Vector SymbolContext) -> (Bool , Maybe (Vector SymbolContext), Maybe (Vector SymbolContext)) #-}
301
+ {-# SPECIALISE measureNullableCharacters :: Maybe (Vector SymbolContext) -> Maybe (Vector SymbolContext) -> (Ordering , Maybe (Vector SymbolContext), Maybe (Vector SymbolContext)) #-}
302
302
measureNullableCharacters
303
303
:: Foldable f
304
304
=> Maybe (f SymbolContext )
305
305
-> Maybe (f SymbolContext )
306
- -> (Bool , Maybe (f SymbolContext ), Maybe (f SymbolContext ))
306
+ -> (Ordering , Maybe (f SymbolContext ), Maybe (f SymbolContext ))
307
307
measureNullableCharacters lhs rhs
308
- | lhsOrdering == GT = ( True , rhs, lhs)
309
- | otherwise = (False , lhs, rhs)
308
+ | lhsOrdering == GT = (lhsOrdering , rhs, lhs)
309
+ | otherwise = (lhsOrdering , lhs, rhs)
310
310
where
311
311
lhsOrdering =
312
312
-- First, compare inputs by length.
@@ -367,13 +367,11 @@ measureAndUngapCharacters gap char1 char2
367
367
where
368
368
(gapsChar1, ungappedChar1) = deleteGaps gap char1
369
369
(gapsChar2, ungappedChar2) = deleteGaps gap char2
370
+ needToSwap (v,_,_) = v == GT
370
371
swapInputs =
371
- let needToSwap (x,_,_) = x
372
- ungappedLen1 = maybe 0 length ungappedChar1
373
- ungappedLen2 = maybe 0 length ungappedChar2
374
- in case ungappedLen1 `compare` ungappedLen2 of
375
- EQ | ungappedLen1 == 0 -> needToSwap $ measureNullableCharacters (Just char1) (Just char2)
376
- _ -> needToSwap $ measureNullableCharacters ungappedChar1 ungappedChar2
372
+ case measureNullableCharacters ungappedChar1 ungappedChar2 of
373
+ (EQ ,_,_) -> needToSwap $ measureCharacters char1 char2
374
+ x -> needToSwap x
377
375
378
376
379
377
-- |
0 commit comments