sort records so that s field is first (use Macros.sortRec)

This commit is contained in:
aarne
2008-05-24 07:44:16 +00:00
parent a57a74608c
commit f4bafe3d5a
3 changed files with 22 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ import GF.Grammar.PrGrammar
import Control.Monad (liftM, liftM2)
import Data.Char (isDigit)
import Data.List (sortBy)
firstTypeForm :: Type -> Err (Context, Type)
firstTypeForm t = case t of
@@ -719,3 +720,14 @@ isInOneType t = case t of
Prod _ a b -> a == b
_ -> False
-- normalize records and record types; put s first
sortRec :: [(Label,a)] -> [(Label,a)]
sortRec = sortBy ordLabel where
ordLabel (r1,_) (r2,_) = case (prt r1, prt r2) of
("s",_) -> LT
(_,"s") -> GT
(s1,s2) -> compare s1 s2