Commit 4b338944 authored by Michael Hanus 's avatar Michael Hanus

Recursive type analysis added to check recursive constructors

parent 841786c8
# Root direcotry of Curry system:
ROOT = $(HOME)/pakcs
# Root location of the Curry System specified by variable CURRYROOT
CURRYROOT ?= $(error Please specify the variable CURRYROOT)
# Curry system binary:
export CURRY = $(ROOT)/bin/curry
export CURRY = $(CURRYROOT)/bin/curry
# The default options for the REPL
export REPL_OPTS = --noreadline :set -time
# Load path for building:
CPATH = $(ROOT)/currytools/analysis:$(ROOT)/currytools/CASS
CPATH = $(CURRYROOT)/currytools/analysis:$(CURRYROOT)/currytools/CASS
# Source modules of CPM:
DEPS = src/CPM/*.curry src/CPM/*/*.curry
.PHONY: build
build: fetchdeps
build: fetchdeps $(DEPS)
@export CURRYPATH="$(CPATH)"; \
for i in `ls vendor`; do \
export CURRYPATH="$$CURRYPATH:`pwd`/vendor/$$i/src"; \
......@@ -16,7 +22,7 @@ build: fetchdeps
echo "Set CURRYPATH to $$CURRYPATH"; \
cd src; $(CURRY) $(REPL_OPTS) :l CPM.Main :save :quit
@if [ ! -d bin ]; then mkdir bin; fi
cp -p src/CPM.Main bin/cpm
mv -f src/CPM.Main bin/cpm
.PHONY: buildperf
buildperf: fetchdeps
......
This diff is collapsed.
This diff is collapsed.
......@@ -22,10 +22,15 @@ module CPM.ErrorLogger
import Global
import Pretty
import Profile -- for show run-time
infixl 0 |>=
infixl 0 |>
-- Should the current time be shown with every log information?
withShowTime :: Bool
withShowTime = False
--- An error logger.
type ErrorLogger a = ([LogEntry], Either LogEntry a)
......@@ -115,10 +120,10 @@ showLogEntry (LogEntry lvl msg) = do
else return ()
where
lvlText = case lvl of
Info -> text "INFO "
Debug -> green $ text "DEBUG "
Critical -> red $ text "CRITICAL "
Error -> red $ text "ERROR "
Info -> text "INFO "
Debug -> green $ text "DEBUG "
Critical -> red $ text "CRITICAL "
Error -> red $ text "ERROR "
--- Compares two log levels.
levelGte :: LogLevel -> LogLevel -> Bool
......@@ -157,4 +162,12 @@ failIO msg = return $ fail msg
--- Create an IO action that logs a message.
log :: LogLevel -> String -> IO (ErrorLogger ())
log lvl msg = return $ ([LogEntry lvl msg], Right ())
log lvl msg =
if withShowTime
then do
runtime <- getProcessInfos >>= return . maybe 0 id . lookup ElapsedTime
return $ ([LogEntry lvl (showTime runtime ++ ' ':msg)], Right ())
else
return $ ([LogEntry lvl msg], Right ())
where
showTime t = show (t `div` 1000) ++ "." ++ show ((t `mod` 1000) `div` 10)
\ No newline at end of file
......@@ -180,9 +180,9 @@ resolveAndCopyDependencies cfg repo gc dir = loadPackageSpec dir |>=
++ (intercalate "," $ map packageId missingDeps)
++ "\nUse `cpm install` to install missing dependencies."
in if length missingDeps > 0
then failIO failMsg
else copyDependencies cfg gc pkgSpec deps dir |>=
\_ -> succeedIO deps
then failIO failMsg
else copyDependencies cfg gc pkgSpec deps dir |>= \_ ->
succeedIO deps
--- Resolves the dependencies for a package copy.
resolveDependencies :: Config -> Repository -> GC.GlobalCache -> String
......
......@@ -137,7 +137,9 @@ behaviorDiffPerformance o = do
genTestProgram :: IO (ErrorLogger ())
genTestProgram = preparePackageDirs defaultConfig emptyRepository GC.emptyCache "/tmp/verA" "/tmp/verB" |>=
\info -> findFunctionsToCompare defaultConfig emptyRepository GC.emptyCache (infSourceDirA info) (infSourceDirB info) False Nothing |>=
\(acyCache, funcs, _) -> genCurryCheckProgram defaultConfig emptyRepository GC.emptyCache funcs info acyCache |>
\(acyCache, loadpath, funcs, _) ->
genCurryCheckProgram defaultConfig emptyRepository GC.emptyCache funcs
info acyCache loadpath |>
succeedIO ()
apiDiffPerformance :: Options -> IO ()
......
Markdown is supported
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