diff -Nru curry-libs-2.0.0/CPNS.curry curry-libs-2.0.1/CPNS.curry --- curry-libs-2.0.0/CPNS.curry 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/CPNS.curry 2018-01-23 11:28:39.000000000 +0000 @@ -31,10 +31,13 @@ -- Distributed Curry! If this port is occupied by another process -- on a host, you cannot run Distributed Curry on it.) -cpnsSocket = 8767 -- standard port number of CPNS demon +-- The standard port number of CPNS demon. +cpnsSocket :: Int +cpnsSocket = 8767 -- The time out before considering the server as unreachable: +cpnsTimeOut :: Int cpnsTimeOut = 3000 --- Type of messages to be processed by the Curry Port Name Server. @@ -59,6 +62,7 @@ | ShowRegistry -- The lock file to coordinate the startup of the CPNS demon: +cpnsStartupLockfile :: String cpnsStartupLockfile = "/tmp/CurryPNSD.lock" --- Starts the "Curry Port Name Server" (CPNS) running on the local machine. @@ -138,6 +142,8 @@ cpnsServer newregs socket ) msg +tryRegisterPortName :: [(String,Int,Int,Int)] -> String -> Int -> Int -> Int + -> IO (Bool, [(String, Int, Int, Int)]) tryRegisterPortName regs name pid sn pn = do let nameregs = filter (\(n,_,_,_)->name==n) regs ack <- if null nameregs @@ -157,6 +163,8 @@ return (ack, newregs) -- Delete all registrations for a given port name: +unregisterPortName :: [(String,Int,Int,Int)] -> String + -> IO [(String,Int,Int,Int)] unregisterPortName regs name = do ctime <- getLocalTime putStrLn $ "Unregister port \""++name++"\" at "++calendarTimeToString ctime @@ -237,9 +245,11 @@ hClose h --- Shows all registered ports at the local CPNS demon (in its logfile). +cpnsShow :: IO () cpnsShow = sendToLocalCPNS ShowRegistry --- Terminates the local CPNS demon +cpnsStop :: IO () cpnsStop = sendToLocalCPNS Terminate --- Gets an answer from a Curry port name server on a host, @@ -300,6 +310,7 @@ done --- Main function for CPNS demon. Check arguments and execute command. +main :: IO () main = do args <- getArgs case args of diff -Nru curry-libs-2.0.0/debian/changelog curry-libs-2.0.1/debian/changelog --- curry-libs-2.0.0/debian/changelog 2017-12-12 18:29:21.000000000 +0000 +++ curry-libs-2.0.1/debian/changelog 2018-02-09 11:02:51.000000000 +0000 @@ -1,3 +1,14 @@ +curry-libs (2.0.1-1) unstable; urgency=medium + + * New upstream release. + * debian/control: + + Bump Standards-Version: to 4.1.3. No changes needed. + + Add B (curry-libs-source): pakcs (<< 2.0.1~). + * debian/{control,compat}: + + Bump to DH version level 10 (level 11 not yet supported by CDBS). + + -- Mike Gabriel Fri, 09 Feb 2018 12:02:51 +0100 + curry-libs (2.0.0-1) unstable; urgency=medium * Upload to unstable. diff -Nru curry-libs-2.0.0/debian/compat curry-libs-2.0.1/debian/compat --- curry-libs-2.0.0/debian/compat 2016-11-02 07:34:47.000000000 +0000 +++ curry-libs-2.0.1/debian/compat 2018-02-09 11:02:51.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru curry-libs-2.0.0/debian/control curry-libs-2.0.1/debian/control --- curry-libs-2.0.0/debian/control 2017-12-08 10:45:56.000000000 +0000 +++ curry-libs-2.0.1/debian/control 2018-02-09 11:02:51.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Build-Depends: cdbs, - debhelper (>= 9), + debhelper (>= 10~), tar (>= 1.28), Maintainer: Debian Curry Maintainers Uploaders: @@ -12,12 +12,13 @@ Homepage: https://git.ps.informatik.uni-kiel.de/curry/curry-libs Vcs-Browser: https://anonscm.debian.org/git/pkg-curry/curry-libs.git Vcs-Git: https://anonscm.debian.org/git/pkg-curry/curry-libs.git -Standards-Version: 4.1.1 +Standards-Version: 4.1.3 Package: curry-libs-source Architecture: all Depends: ${misc:Depends}, +Breaks: pakcs (<< 2.0.1~), Description: Standard libraries of the Curry distributions PAKCS and KiCS2 (source files) PAKCS and KICS2 are two different implementations of the programming language Curry. Curry is a functional programming language being developed diff -Nru curry-libs-2.0.0/Distribution.curry curry-libs-2.0.1/Distribution.curry --- curry-libs-2.0.0/Distribution.curry 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/Distribution.curry 2018-01-23 11:28:39.000000000 +0000 @@ -38,7 +38,7 @@ import FilePath ( FilePath, (), (<.>), addTrailingPathSeparator , dropFileName, joinPath, normalise, splitDirectories , splitExtension, splitFileName, splitSearchPath - , takeFileName + , takeDirectory, takeFileName ) import IO import PropertyFile @@ -458,7 +458,9 @@ else ioError (userError "Illegal source program") where callParseCurry = do - path <- maybe (getLoadPathForModule modpath) return (fullPath params) + path <- maybe (getLoadPathForModule modpath) + (\p -> return (nub (takeDirectory modpath : p))) + (fullPath params) return (quote (installDir "bin" curryCompiler ++ "-frontend") ++ concatMap ((" -i" ++) . quote) path) diff -Nru curry-libs-2.0.0/Makefile_pakcs curry-libs-2.0.1/Makefile_pakcs --- curry-libs-2.0.0/Makefile_pakcs 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/Makefile_pakcs 2018-01-23 11:28:39.000000000 +0000 @@ -84,7 +84,7 @@ # generate all Prolog translations: .curry/pakcs/%.pl: .curry/%.fcy - rm -f $@ && "$(PAKCS)" --quiet :compile $(subst /,.,$*) :quit + rm -f $@ && "$(PAKCS)" --nocypm --quiet :compile $(subst /,.,$*) :quit ############################################################################## # create HTML documentation files for system libraries diff -Nru curry-libs-2.0.0/Prelude.curry curry-libs-2.0.1/Prelude.curry --- curry-libs-2.0.0/Prelude.curry 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/Prelude.curry 2018-01-23 11:28:39.000000000 +0000 @@ -44,6 +44,8 @@ , PEVAL , Monad(..) , Functor(..) + , sequence, sequence_, mapM, mapM_, foldM, liftM, liftM2, forM, forM_ + , unlessM, whenM #ifdef __PAKCS__ , (=:<<=), letrec #endif @@ -788,7 +790,11 @@ --- @param filename - The name of the file to be written. --- @param contents - The contents to be written to the file. writeFile :: String -> String -> IO () +#ifdef __PAKCS__ writeFile f s = (prim_writeFile $## f) s +#else +writeFile f s = (prim_writeFile $## f) $## s +#endif prim_writeFile :: String -> String -> IO () prim_writeFile external @@ -798,7 +804,11 @@ --- @param filename - The name of the file to be written. --- @param contents - The contents to be appended to the file. appendFile :: String -> String -> IO () +#ifdef __PAKCS__ appendFile f s = (prim_appendFile $## f) s +#else +appendFile f s = (prim_appendFile $## f) $## s +#endif prim_appendFile :: String -> String -> IO () prim_appendFile external @@ -1645,7 +1655,7 @@ abs :: a -> a signum :: a -> a - fromInteger :: Int -> a + fromInt :: Int -> a x - y = x + negate y negate x = 0 - x @@ -1664,7 +1674,7 @@ | x == 0 = 0 | otherwise = -1 - fromInteger x = x + fromInt x = x instance Num Float where x + y = x +. y @@ -1681,9 +1691,9 @@ | x == 0 = 0 | otherwise = -1 - fromInteger x = i2f x + fromInt x = i2f x --- minimal definition: fromRational and (recip or (/)) +-- minimal definition: fromFloat and (recip or (/)) class Num a => Fractional a where (/) :: a -> a -> a @@ -1692,16 +1702,16 @@ recip x = 1/x x / y = x * recip y - fromRational :: Float -> a -- since we have no type Rational + fromFloat :: Float -> a -- since we have no type Rational instance Fractional Float where x / y = x /. y recip x = 1.0/x - fromRational x = x + fromFloat x = x class (Num a, Ord a) => Real a where - -- toRational :: a -> Rational + -- toFloat :: a -> Float class Real a => Integral a where div :: a -> a -> a @@ -1804,3 +1814,71 @@ xs >>= f = [y | x <- xs, y <- f x] return x = [x] fail _ = [] + +---------------------------------------------------------------------------- +-- Some useful monad operations which might be later generalized +-- or moved into some other base module. + +--- Evaluates a sequence of monadic actions and collects all results in a list. +sequence :: Monad m => [m a] -> m [a] +sequence = foldr (\m n -> m >>= \x -> n >>= \xs -> return (x:xs)) (return []) + +--- Evaluates a sequence of monadic actions and ignores the results. +sequence_ :: Monad m => [m _] -> m () +sequence_ = foldr (>>) (return ()) + +--- Maps a monadic action function on a list of elements. +--- The results of all monadic actions are collected in a list. +mapM :: Monad m => (a -> m b) -> [a] -> m [b] +mapM f = sequence . map f + +--- Maps a monadic action function on a list of elements. +--- The results of all monadic actions are ignored. +mapM_ :: Monad m => (a -> m _) -> [a] -> m () +mapM_ f = sequence_ . map f + +--- Folds a list of elements using a binary monadic action and a value +--- for the empty list. +foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a +foldM _ z [] = return z +foldM f z (x:xs) = f z x >>= \z' -> foldM f z' xs + +--- Apply a pure function to the result of a monadic action. +liftM :: Monad m => (a -> b) -> m a -> m b +liftM f m = m >>= return . f + +--- Apply a pure binary function to the result of two monadic actions. +liftM2 :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r +liftM2 f m1 m2 = do x1 <- m1 + x2 <- m2 + return (f x1 x2) + +--- Like `mapM`, but with flipped arguments. +--- +--- This can be useful if the definition of the function is longer +--- than those of the list, like in +--- +--- forM [1..10] $ \n -> do +--- ... +forM :: Monad m => [a] -> (a -> m b) -> m [b] +forM xs f = mapM f xs + +--- Like `mapM_`, but with flipped arguments. +--- +--- This can be useful if the definition of the function is longer +--- than those of the list, like in +--- +--- forM_ [1..10] $ \n -> do +--- ... +forM_ :: Monad m => [a] -> (a -> m b) -> m () +forM_ xs f = mapM_ f xs + +--- Performs a monadic action unless the condition is met. +unlessM :: Monad m => Bool -> m () -> m () +unlessM p act = if p then return () else act + +--- Performs a monadic action when the condition is met. +whenM :: Monad m => Bool -> m () -> m () +whenM p act = if p then act else return () + +---------------------------------------------------------------------------- diff -Nru curry-libs-2.0.0/Profile.curry curry-libs-2.0.1/Profile.curry --- curry-libs-2.0.0/Profile.curry 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/Profile.curry 2018-01-23 11:28:39.000000000 +0000 @@ -77,6 +77,7 @@ --- Print a human readable version of the current memory situation --- of the Curry process. +printMemInfo :: IO () printMemInfo = getProcessInfos >>= putStrLn . showMemInfo --- Print the time needed to execute a given IO action. @@ -129,6 +130,8 @@ profileSpaceNF :: a -> IO () profileSpaceNF exp = profileSpace (seq (id $!! exp) done) +showInfoDiff :: [(ProcessInfo, Int)] -> [(ProcessInfo, Int)] -> ProcessInfo + -> String showInfoDiff infos1 infos2 item = show (maybe 0 id (lookup item infos2) - maybe 0 id (lookup item infos1)) diff -Nru curry-libs-2.0.0/SetFunctions.curry curry-libs-2.0.1/SetFunctions.curry --- curry-libs-2.0.0/SetFunctions.curry 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/SetFunctions.curry 2018-01-23 11:28:39.000000000 +0000 @@ -46,25 +46,27 @@ --- the set functions itself will be evaluated. --- --- @author Michael Hanus, Fabian Reck ---- @version June 2017 +--- @version January 2018 --- @category general ------------------------------------------------------------------------ {-# LANGUAGE CPP #-} module SetFunctions - (set0,set1,set2,set3,set4,set5,set6,set7 + (set0, set1, set2, set3, set4, set5, set6, set7 #ifdef __PAKCS__ #else - ,set0With,set1With,set2With,set3With,set4With,set5With,set6With,set7With + , set0With, set1With, set2With, set3With, set4With, set5With, set6With + , set7With #endif - ,Values,isEmpty,notEmpty,valueOf - ,choose,chooseValue,select,selectValue - ,mapValues,foldValues,filterValues,minValue,maxValue - ,values2list,printValues,sortValues,sortValuesBy + , Values, isEmpty, notEmpty, valueOf + , choose, chooseValue, select, selectValue + , mapValues, foldValues, filterValues + , minValue, minValueBy, maxValue, maxValueBy + , values2list, printValues, sortValues, sortValuesBy ) where -import List(delete) -import Sort(mergeSortBy) +import List ( delete, minimum, minimumBy, maximum, maximumBy ) +import Sort ( mergeSortBy ) #ifdef __PAKCS__ import Findall #else @@ -259,31 +261,32 @@ data Values a = Values [a] #endif +--- Internal operation to extract all elements of a multiset of values. +valuesOf :: Values a -> [a] #ifdef __PAKCS__ ---- Is a multiset of values empty? -isEmpty :: Eq a => Values a -> Bool -isEmpty (Values firstval _) = firstval == Nothing +valuesOf (Values _ s) = s +#else +valuesOf (Values s) = s +#endif ---- Is a multiset of values not empty? -notEmpty :: Eq a => Values a -> Bool -notEmpty vs = not (isEmpty vs) +---------------------------------------------------------------------- ---- Is some value an element of a multiset of values? -valueOf :: Eq a => a -> Values a -> Bool -valueOf e (Values _ s) = e `elem` s -#else --- Is a multiset of values empty? -isEmpty :: Values _ -> Bool +isEmpty :: Values a -> Bool +#ifdef __PAKCS__ +isEmpty (Values firstval _) = case firstval of Nothing -> True + Just _ -> False +#else isEmpty (Values vs) = null vs +#endif --- Is a multiset of values not empty? -notEmpty :: Values _ -> Bool +notEmpty :: Values a -> Bool notEmpty vs = not (isEmpty vs) --- Is some value an element of a multiset of values? valueOf :: Eq a => a -> Values a -> Bool -valueOf e (Values s) = e `elem` s -#endif +valueOf e s = e `elem` valuesOf s --- Chooses (non-deterministically) some value in a multiset of values --- and returns the chosen value and the remaining multiset of values. @@ -358,11 +361,7 @@ --- must be commutative so that the result is independent of the order --- of applying this operation to all elements in the multiset. foldValues :: (a -> a -> a) -> a -> Values a -> a -#ifdef __PAKCS__ -foldValues f z (Values _ s) = foldr f z s -#else -foldValues f z (Values s) = foldr f z s -#endif +foldValues f z s = foldr f z (valuesOf s) --- Keeps all elements of a multiset of values that satisfy a predicate. filterValues :: (a -> Bool) -> Values a -> Values a @@ -375,41 +374,31 @@ filterValues p (Values s) = Values (filter p s) #endif ---- Returns the minimal element of a non-empty multiset of values ---- with respect to a given total ordering on the elements. -minValue :: (a -> a -> Bool) -> Values a -> a -#ifdef __PAKCS__ -minValue leq (Values _ s) = minOf s -#else -minValue leq (Values s) = minOf s -#endif - where - minOf [x] = x - minOf (x:y:ys) = let m1 = minOf (y:ys) - in if leq x m1 then x else m1 - ---- Returns the maximal element of a non-empty multiset of value ---- with respect to a given total ordering on the elements. -maxValue :: (a -> a -> Bool) -> Values a -> a -#ifdef __PAKCS__ -maxValue leq (Values _ s) = maxOf s -#else -maxValue leq (Values s) = maxOf s -#endif - where - maxOf [x] = x - maxOf (x:y:ys) = let m1 = maxOf (y:ys) - in if leq x m1 then m1 else x +--- Returns the minimum of a non-empty multiset of values +--- according to the given comparison function on the elements. +minValue :: Ord a => Values a -> a +minValue s = minimum (valuesOf s) + +--- Returns the minimum of a non-empty multiset of values +--- according to the given comparison function on the elements. +minValueBy :: (a -> a -> Ordering) -> Values a -> a +minValueBy cmp s = minimumBy cmp (valuesOf s) + +--- Returns the maximum of a non-empty multiset of values +--- according to the given comparison function on the elements. +maxValue :: Ord a => Values a -> a +maxValue s = maximum (valuesOf s) + +--- Returns the maximum of a non-empty multiset of values +--- according to the given comparison function on the elements. +maxValueBy :: (a -> a -> Ordering) -> Values a -> a +maxValueBy cmp s = maximumBy cmp (valuesOf s) --- Puts all elements of a multiset of values in a list. --- Since the order of the elements in the list might depend on --- the time of the computation, this operation is an I/O action. values2list :: Values a -> IO [a] -#ifdef __PAKCS__ -values2list (Values _ s) = return s -#else -values2list (Values s) = return s -#endif +values2list s = return (valuesOf s) --- Prints all elements of a multiset of values. printValues :: Show a => Values a -> IO () @@ -427,10 +416,6 @@ --- In order to ensure that the result of this operation is independent of the --- evaluation order, the given ordering must be a total order. sortValuesBy :: (a -> a -> Bool) -> Values a -> [a] -#ifdef __PAKCS__ -sortValuesBy leq (Values _ s) = mergeSortBy leq s -#else -sortValuesBy leq (Values s) = mergeSortBy leq s -#endif +sortValuesBy leq s = mergeSortBy leq (valuesOf s) ------------------------------------------------------------------------ diff -Nru curry-libs-2.0.0/Time.curry curry-libs-2.0.1/Time.curry --- curry-libs-2.0.0/Time.curry 2017-12-05 08:46:28.000000000 +0000 +++ curry-libs-2.0.1/Time.curry 2018-01-23 11:28:39.000000000 +0000 @@ -2,7 +2,7 @@ --- Library for handling date and time information. --- --- @author Michael Hanus ---- @version April 2007 +--- @version January 2018 --- @category general ------------------------------------------------------------------------------ @@ -17,14 +17,14 @@ --- ClockTime represents a clock time in some internal representation. data ClockTime = CTime Int - deriving (Eq, Ord, Show) + deriving (Eq, Ord, Show, Read) --- A calendar time is presented in the following form: --- (CalendarTime year month day hour minute second timezone) --- where timezone is an integer representing the timezone as a difference --- to UTC time in seconds. data CalendarTime = CalendarTime Int Int Int Int Int Int Int - deriving (Eq, Ord, Show) + deriving (Eq, Ord, Show, Read) --- The year of a calendar time. ctYear :: CalendarTime -> Int