Odt reader: replaced collectRights with rights from Data.Either.

This commit is contained in:
John MacFarlane 2017-06-20 22:43:06 +02:00
parent c0a1286025
commit 21c4281b13
2 changed files with 2 additions and 6 deletions

View file

@ -124,8 +124,3 @@ instance ChoiceVector SuccessList where
spreadChoice = Right . SuccessList . (foldr unTagRight []) . collectNonFailing
where unTagRight (Right x) = (x:)
unTagRight _ = id
-- | Like 'catMaybes', but for 'Either'.
collectRights :: [Either _l r] -> [r]
collectRights = collectNonFailing . untag . spreadChoice . SuccessList
where untag = fromLeft (error "Unexpected Left")

View file

@ -71,6 +71,7 @@ import Control.Applicative hiding ( liftA, liftA2 )
import Control.Monad ( MonadPlus )
import Control.Arrow
import Data.Either ( rights )
import qualified Data.Map as M
import Data.Default
import Data.Maybe
@ -604,7 +605,7 @@ tryAll :: (NameSpaceID nsID)
-> XMLConverter nsID extraState b [a]
tryAll nsID name a = prepareIteration nsID name
>>> iterateS (switchingTheStack a)
>>^ collectRights
>>^ rights
--------------------------------------------------------------------------------
-- Matching children