Commit b71b0ad0 authored by Nicolas Pouillard's avatar Nicolas Pouillard

more refactorings

parent 793df052
...@@ -96,7 +96,7 @@ import Data.List ((:), List(Nil)) ...@@ -96,7 +96,7 @@ import Data.List ((:), List(Nil))
import Data.List as List import Data.List as List
import Data.Map (Map) import Data.Map (Map)
import Data.Map as Map import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe, isJust) import Data.Maybe (Maybe(..), fromMaybe, fromMaybe', isJust)
import Data.Monoid.Additive (Additive(..)) import Data.Monoid.Additive (Additive(..))
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Set (Set) import Data.Set (Set)
...@@ -108,7 +108,7 @@ import Data.String.Regex.Flags (global, multiline) as R ...@@ -108,7 +108,7 @@ import Data.String.Regex.Flags (global, multiline) as R
import Data.String.Utils as SU import Data.String.Utils as SU
import Data.Symbol (SProxy(..)) import Data.Symbol (SProxy(..))
import Data.These (These(..)) import Data.These (These(..))
import Data.Traversable (for, traverse_) import Data.Traversable (for, traverse_, traverse)
import Data.TraversableWithIndex (traverseWithIndex) import Data.TraversableWithIndex (traverseWithIndex)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
...@@ -498,15 +498,10 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 = ...@@ -498,15 +498,10 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 =
-- Skip this pattern which is overlapping with a previous one. -- Skip this pattern which is overlapping with a previous one.
{ i0, s, l } { i0, s, l }
| otherwise = | otherwise =
case List.fromFoldable pis of let pats' = fromMaybe' (\_ -> crashWith "highlightNgrams: out of bounds pattern") (traverse (A.index pats) pis) in
Nil -> case List.fromFoldable pats' of
{ i0, s, l } Nil -> { i0, s, l }
pi : _ -> pat : _ -> goAcc pat i acc
case A.index pats pi of
Nothing ->
crashWith "highlightNgrams: out of bounds pattern"
Just pat ->
goAcc pat i acc
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment