Commit 835a9f79 authored by Michael Hanus's avatar Michael Hanus
Browse files

Tools adapted to renamings of library Sort

parent 4be06e60
......@@ -6,7 +6,7 @@
--- the analysis server (which is implicitly started if necessary).
---
--- @author Michael Hanus
--- @version May 2013
--- @version April 2016
--------------------------------------------------------------------------
module Configuration
......@@ -80,7 +80,7 @@ updateRCFile = do
distprops
rcKeys :: [(String, String)] -> [String]
rcKeys = mergeSort (<=) . map fst
rcKeys = mergeSort . map fst
--- Reads the user property file (which must be installed!)
--- and store the properties in a global variable for next access.
......
......@@ -9,7 +9,7 @@
--- the argument `True` to compute the result `False`.
---
--- @author Michael Hanus
--- @version May 2015
--- @version April 2016
-----------------------------------------------------------------------------
module RequiredValue(AType(..),showAType,AFType(..),showAFType,lubAType,
......@@ -21,7 +21,7 @@ import FlatCurry.Types
import FlatCurry.Goodies
import GenericProgInfo
import List
import Sort(mergeSort)
import Sort(mergeSortBy)
import TotallyDefined(siblingCons)
import Unsafe(trace)
......@@ -118,7 +118,7 @@ dropEnv n (env,rtype) = (drop n env, rtype)
-- Sorts a list of environment/type pairs by the type.
sortEnvTypes :: [(AEnv,AType)] -> [(AEnv,AType)]
sortEnvTypes = mergeSort (\ (e1,t1) (e2,t2) -> (t1,e1) <= (t2,e2))
sortEnvTypes = mergeSortBy (\ (e1,t1) (e2,t2) -> (t1,e1) <= (t2,e2))
------------------------------------------------------------------------------
--- The maximum number of different constructors considered for the
......
......@@ -9,7 +9,7 @@
--- the argument `True` to compute the result `False`.
---
--- @author Michael Hanus
--- @version June 2015
--- @version April 2016
-----------------------------------------------------------------------------
module RequiredValues(AType(..),showAType,AFType(..),showAFType,lubAType,
......@@ -21,7 +21,7 @@ import FlatCurry.Types
import FlatCurry.Goodies
import GenericProgInfo
import List hiding (union,intersect)
import Sort(mergeSort)
import Sort(mergeSortBy)
import TotallyDefined(siblingCons)
import Unsafe(trace)
......@@ -118,7 +118,7 @@ dropEnv n (env,rtype) = (drop n env, rtype)
-- Sorts a list of environment/type pairs by the type.
sortEnvTypes :: [(AEnv,AType)] -> [(AEnv,AType)]
sortEnvTypes = mergeSort (\ (e1,t1) (e2,t2) -> (t1,e1) <= (t2,e2))
sortEnvTypes = mergeSortBy (\ (e1,t1) (e2,t2) -> (t1,e1) <= (t2,e2))
------------------------------------------------------------------------------
--- The maximum number of different constructors considered for the
......
......@@ -3,7 +3,7 @@
--- programs.
---
--- @author Michael Hanus
--- @version January 2015
--- @version April 2016
---------------------------------------------------------------------
module BrowserGUI where
......@@ -203,7 +203,7 @@ getFuns gs = readIORef gs >>= \ (GS _ _ _ funs _ _ _) -> return funs
storeSelectedFunctions :: IORef GuiState -> [FuncDecl] -> IO ()
storeSelectedFunctions gs funs = do
(GS t mm ms _ ct flag fana) <- readIORef gs
writeIORef gs (GS t mm ms (mergeSort leqFunc funs) ct flag fana)
writeIORef gs (GS t mm ms (mergeSortBy leqFunc funs) ct flag fana)
setMainContentsModule :: IORef GuiState -> String -> ContentsKind -> String
-> IO ()
......@@ -580,7 +580,8 @@ browserGUI gstate rmod rtxt names =
if mod==Nothing || null self then done else
getFuns gstate >>= \funs ->
let mainfun = funs!!(readNat self)
qfnames = mergeSort leqQName (union [funcName mainfun] (callsDirectly mainfun))
qfnames = mergeSortBy leqQName
(union [funcName mainfun] (callsDirectly mainfun))
in getAllFunctions gstate (showDoing gp) (fromJust mod) >>= \allfuns ->
storeSelectedFunctions gstate (map (findDecl4name allfuns) qfnames) >>
setFunctionListKind gstate False >>
......@@ -594,7 +595,7 @@ browserGUI gstate rmod rtxt names =
getFuns gstate >>= \funs ->
let mainfun = funcName (funs!!(readNat self)) in
getAllFunctions gstate (showDoing gp) (fromJust mod) >>= \allfuns ->
let qfnames = mergeSort leqQName
let qfnames = mergeSortBy leqQName
(union [mainfun]
(fromJust (lookup mainfun (indirectlyDependent allfuns))))
in storeSelectedFunctions gstate (map (findDecl4name allfuns) qfnames) >>
......
......@@ -9,7 +9,7 @@
--- generated from a FlatCurry program.
---
--- @author Michael Hanus, Bjoern Peemoeller
--- @version June 2015
--- @version April 2016
------------------------------------------------------------------------------
module ShowFlatCurry
......@@ -22,7 +22,7 @@ module ShowFlatCurry
import Char (isAlpha)
import List (intercalate)
import Pretty (pPrint)
import Sort (mergeSort,leqString)
import Sort (mergeSortBy,leqString)
import FlatCurry.Types
import FlatCurry.Files
......@@ -41,12 +41,12 @@ showFlatCurry = pPrint . ppProg defaultOptions
showInterface :: Bool -> Prog -> String
showInterface genstub (Prog mod imports types funcs ops) =
concatMap showInterfaceImport imports ++ "\n" ++
concatMap showInterfaceOpDecl (mergeSort leqOp ops) ++
concatMap showInterfaceOpDecl (mergeSortBy leqOp ops) ++
(if null ops then "" else "\n") ++
concatMap (showInterfaceType (showQNameInModule mod))
(mergeSort leqType types) ++ "\n" ++
(mergeSortBy leqType types) ++ "\n" ++
concatMap (showInterfaceFunc (showQNameInModule mod) genstub)
(mergeSort leqFunc funcs) ++ "\n"
(mergeSortBy leqFunc funcs) ++ "\n"
-- show import declaration
showInterfaceImport :: String -> String
......
......@@ -2,7 +2,7 @@
--- Operations to generate documentation in HTML format.
---
--- @author Michael Hanus, Jan Tikovsky
--- @version January 2016
--- @version April 2016
----------------------------------------------------------------------
module CurryDocHtml where
......@@ -622,7 +622,8 @@ indexPage modnames =
(if length modnames == 1
then []
else [ulist (map (\m->[href (m++".html") [htxt (m++".curry ")]])
(mergeSort leqStringIgnoreCase modnames))]) ++ [explainIcons]
(mergeSortBy leqStringIgnoreCase modnames))])
++ [explainIcons]
-- Paragraph to explain the meaning of the icons:
explainIcons :: HtmlExp
......@@ -667,7 +668,7 @@ showModNameRef (modname,name) =
)
sortNames :: [(a,String)] -> [(a,String)]
sortNames names = mergeSort (\(_,n1) (_,n2)->leqStringIgnoreCase n1 n2) names
sortNames names = mergeSortBy (\(_,n1) (_,n2)->leqStringIgnoreCase n1 n2) names
--------------------------------------------------------------------------
......@@ -888,7 +889,7 @@ opnameDoc = style "opname"
-- Sorts a list of strings.
sortStrings :: [String] -> [String]
sortStrings strings = mergeSort leqStringIgnoreCase strings
sortStrings strings = mergeSortBy leqStringIgnoreCase strings
-- Returns the first sentence in a string:
firstSentence :: String -> String
......
......@@ -9,7 +9,7 @@
--- generated from a FlatCurry program.
---
--- @author Michael Hanus
--- @version November 2014
--- @version April 2016
------------------------------------------------------------------------------
{-# OPTIONS_CYMAKE -Wno-incomplete-patterns -Wno-missing-signatures #-}
......@@ -23,7 +23,7 @@ import Char(isAlpha)
import System(getArgs,getEnviron,system)
import Directory
import FileGoodies
import Sort(mergeSort,leqString)
import Sort(mergeSortBy,leqString)
import Distribution(stripCurrySuffix,modNameToPath
,lookupModuleSourceInLoadPath)
......@@ -82,12 +82,12 @@ genInt genstub progname = do
(Prog mod imports types funcs ops) <- getFlatInt progname
return $ "module " ++ mod ++ " where\n" ++
concatMap showInterfaceImport imports ++ "\n" ++
concatMap showInterfaceOpDecl (mergeSort leqOp ops) ++
concatMap showInterfaceOpDecl (mergeSortBy leqOp ops) ++
(if null ops then "" else "\n") ++
concatMap (showInterfaceType (showQNameInModule mod))
(mergeSort leqType types) ++ "\n" ++
(mergeSortBy leqType types) ++ "\n" ++
concatMap (showInterfaceFunc (showQNameInModule mod) genstub)
(mergeSort leqFunc funcs) ++ "\n"
(mergeSortBy leqFunc funcs) ++ "\n"
-- Get a FlatCurry program (parse only if necessary):
getFlatInt :: String -> IO Prog
......
......@@ -2,7 +2,7 @@
--- Show all calls to imported functions in a module
---
--- @author Michael Hanus
--- @version September 2015
--- @version April 2016
-----------------------------------------------------------------------------
module ImportCalls(main,showImportCalls) where
......@@ -49,8 +49,8 @@ formatImpCalls impcalls =
getAllImpCalls :: Prog -> [(String,[String])]
getAllImpCalls (Prog mod imps _ funs _) =
calls2impCalls imps
(mergeSort (\ (_,n1) (_,n2) -> n1 <= n2)
(allFunCalls mod funs))
(mergeSortBy (\ (_,n1) (_,n2) -> n1 <= n2)
(allFunCalls mod funs))
calls2impCalls :: [String] -> [QName] -> [(String,[String])]
calls2impCalls [] _ = []
......
......@@ -496,7 +496,7 @@ listView erdname (Entity entityName attrlist) _ _ =
],
applyF (pre "map") [
constF (viewModuleName entityName,"list"++entityName),
applyF ("Sort","mergeSort") [
applyF ("Sort","mergeSortBy") [
constF (viewModuleName entityName,"leq"++entityName),
CVar entsvar
]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment