From f78505d88eabe2c83641293c5995ae2e30bdebba Mon Sep 17 00:00:00 2001 From: "peter.ljunglof" Date: Wed, 29 Aug 2012 21:48:34 +0000 Subject: [PATCH] Use nub' instead of nub in some places, remove some unused nub imports --- src/compiler/GF/Compile/GetGrammar.hs | 1 - src/compiler/GF/Grammar/CF.hs | 3 ++- src/compiler/GF/Grammar/Lookup.hs | 2 +- src/compiler/GF/Infra/UseIO.hs | 1 - src/runtime/haskell/PGF/Forest.hs | 4 ++-- src/runtime/haskell/PGF/Optimize.hs | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs index 65f98d29a..2da99d448 100644 --- a/src/compiler/GF/Compile/GetGrammar.hs +++ b/src/compiler/GF/Compile/GetGrammar.hs @@ -25,7 +25,6 @@ import GF.Grammar.Grammar import GF.Compile.ReadFiles import Data.Char (toUpper) -import Data.List (nub) import qualified Data.ByteString.Char8 as BS import Control.Monad (foldM) import System.Cmd (system) diff --git a/src/compiler/GF/Grammar/CF.hs b/src/compiler/GF/Grammar/CF.hs index 2ef625131..8b66bd72d 100644 --- a/src/compiler/GF/Grammar/CF.hs +++ b/src/compiler/GF/Grammar/CF.hs @@ -21,6 +21,7 @@ import GF.Infra.Option import GF.Infra.UseIO import GF.Data.Operations +import GF.Data.Utilities (nub') import Data.Char import Data.List @@ -101,7 +102,7 @@ cf2grammar rules = (buildTree abs, buildTree conc, cat) where (L _ (_,(c,_))):_ -> c -- the value category of the first rule _ -> error "empty CF" cats = [(cat, AbsCat (Just (L NoLoc []))) | - cat <- nub (concat (map cf2cat rules))] ----notPredef cat + cat <- nub' (concat (map cf2cat rules))] ----notPredef cat lincats = [(cat, CncCat (Just (L loc defLinType)) Nothing Nothing Nothing) | (cat,AbsCat (Just (L loc _))) <- cats] (funs,lins) = unzip (map cf2rule rules) diff --git a/src/compiler/GF/Grammar/Lookup.hs b/src/compiler/GF/Grammar/Lookup.hs index 0a06347d6..9e8b877a5 100644 --- a/src/compiler/GF/Grammar/Lookup.hs +++ b/src/compiler/GF/Grammar/Lookup.hs @@ -39,7 +39,7 @@ import GF.Grammar.Printer import GF.Grammar.Predef import GF.Grammar.Lockfield -import Data.List (nub,sortBy) +import Data.List (sortBy) import Control.Monad import Text.PrettyPrint import qualified Data.Map as Map diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs index cd9fe8a95..a9b3cada2 100644 --- a/src/compiler/GF/Infra/UseIO.hs +++ b/src/compiler/GF/Infra/UseIO.hs @@ -31,7 +31,6 @@ import Text.Printf import Control.Monad import Control.Exception(evaluate) import qualified Data.ByteString.Char8 as BS -import Data.List(nub) putShow' :: Show a => (c -> a) -> c -> IO () putShow' f = putStrLn . show . length . show . f diff --git a/src/runtime/haskell/PGF/Forest.hs b/src/runtime/haskell/PGF/Forest.hs index 3c4272317..5cb4ccf51 100644 --- a/src/runtime/haskell/PGF/Forest.hs +++ b/src/runtime/haskell/PGF/Forest.hs @@ -32,7 +32,7 @@ import qualified Data.IntSet as IntSet import qualified Data.IntMap as IntMap import Control.Monad import Control.Monad.State -import GF.Data.SortedList +import GF.Data.Utilities (nub') data Forest = Forest @@ -121,7 +121,7 @@ getAbsTrees (Forest abs cnc forest root) arg@(PArg _ fid) ty dp = generateForForest (prove dp) e) emptyMetaStore fid in if null res then Left (nub err) - else Right (nub [e | (_,_,e) <- res]) + else Right (nub' [e | (_,_,e) <- res]) where go rec_ scope_ mb_tty_ (PArg hypos fid) | fid < totalCats cnc = case mb_tty of diff --git a/src/runtime/haskell/PGF/Optimize.hs b/src/runtime/haskell/PGF/Optimize.hs index 833684fe0..a339c9add 100644 --- a/src/runtime/haskell/PGF/Optimize.hs +++ b/src/runtime/haskell/PGF/Optimize.hs @@ -8,7 +8,7 @@ import PGF.CId import PGF.Data import PGF.Macros import Data.Maybe -import Data.List (mapAccumL, nub) +import Data.List (mapAccumL) import Data.Array.IArray import Data.Array.MArray import Data.Array.ST