removing multiple occurences of the same user in userField
This commit is contained in:
parent
49e55e7bc7
commit
d14c2113f2
1 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@ import Control.Applicative
|
||||||
import Control.Monad.Trans.Class
|
import Control.Monad.Trans.Class
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Either
|
import Data.Either
|
||||||
|
import Data.List
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.ByteString.Lazy as BL
|
import qualified Data.ByteString.Lazy as BL
|
||||||
import qualified Data.ByteString.Char8 as BC
|
import qualified Data.ByteString.Char8 as BC
|
||||||
|
@ -102,7 +103,7 @@ userField users = Field
|
||||||
-- clean = removeItem "" $ T.splitOn " " x
|
-- clean = removeItem "" $ T.splitOn " " x
|
||||||
let ids = map (\u -> lookup u users) (removeItem "" $ T.splitOn " " x)
|
let ids = map (\u -> lookup u users) (removeItem "" $ T.splitOn " " x)
|
||||||
in case Nothing `elem` ids of
|
in case Nothing `elem` ids of
|
||||||
False -> return $ Right $ Just $ map fromJust ids
|
False -> return $ Right $ Just $ nub $ map fromJust ids
|
||||||
True -> return $ Left $ error "Invalid username list"
|
True -> return $ Left $ error "Invalid username list"
|
||||||
True -> return $ Right $ Just $ []
|
True -> return $ Right $ Just $ []
|
||||||
_ -> return $ Left $ error "unexpected username list"
|
_ -> return $ Left $ error "unexpected username list"
|
||||||
|
|
Loading…
Reference in a new issue