From d14c2113f2107fb7caab6a8c8bd0e99c584727dd Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 6 Dec 2014 14:03:13 +0100 Subject: [PATCH] removing multiple occurences of the same user in userField --- Helper.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Helper.hs b/Helper.hs index ed15607..0694c3d 100644 --- a/Helper.hs +++ b/Helper.hs @@ -22,6 +22,7 @@ import Control.Applicative import Control.Monad.Trans.Class import Data.Maybe import Data.Either +import Data.List import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Char8 as BC @@ -102,7 +103,7 @@ userField users = Field -- clean = removeItem "" $ T.splitOn " " x let ids = map (\u -> lookup u users) (removeItem "" $ T.splitOn " " x) 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 $ Right $ Just $ [] _ -> return $ Left $ error "unexpected username list"