summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-10-11 20:44:18 +0000
committeraarne <aarne@cs.chalmers.se>2006-10-11 20:44:18 +0000
commitc3cefb4d48e8e2680a2e167c65f1143bdb101823 (patch)
tree19412f8d3f4b1a0dd998d17add455f15ecad2a1d /src
parent72699f446f21e014989af8f31e7a554ffa0359a8 (diff)
record order bug fix
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile/GrammarToCanon.hs3
-rw-r--r--src/GF/Grammar/Lookup.hs6
2 files changed, 4 insertions, 5 deletions
diff --git a/src/GF/Compile/GrammarToCanon.hs b/src/GF/Compile/GrammarToCanon.hs
index e7da9281d..9cf8a519f 100644
--- a/src/GF/Compile/GrammarToCanon.hs
+++ b/src/GF/Compile/GrammarToCanon.hs
@@ -156,9 +156,6 @@ redTerm :: Type -> Err G.Exp
redTerm t = return $ rtExp t
-- to normalize records and record types
-sortByLabel :: (a -> Label) -> [a] -> [a]
-sortByLabel f = sortBy (\ x y -> compare (f x) (f y))
-
sortByFst :: Ord a => [(a,b)] -> [(a,b)]
sortByFst = sortBy (\ x y -> compare (fst x) (fst y))
diff --git a/src/GF/Grammar/Lookup.hs b/src/GF/Grammar/Lookup.hs
index f0032f09f..62e093769 100644
--- a/src/GF/Grammar/Lookup.hs
+++ b/src/GF/Grammar/Lookup.hs
@@ -30,7 +30,7 @@ import GF.Grammar.Abstract
import GF.Infra.Modules
import GF.Grammar.Lockfield
-import Data.List (nub)
+import Data.List (nub,sortBy)
import Control.Monad
-- whether lock fields are added in reuse
@@ -137,12 +137,14 @@ allParamValues cnc ptyp = case ptyp of
return [EInt i | i <- [0..n]]
QC p c -> lookupParamValues cnc p c
RecType r -> do
- let (ls,tys) = unzip r
+ let (ls,tys) = unzip $ sortByFst r
tss <- mapM allPV tys
return [R (zipAssign ls ts) | ts <- combinations tss]
_ -> prtBad "cannot find parameter values for" ptyp
where
allPV = allParamValues cnc
+ -- to normalize records and record types
+ sortByFst = sortBy (\ x y -> compare (fst x) (fst y))
qualifAnnot :: Ident -> Term -> Term
qualifAnnot _ = id