[Pkg-haskell-commits] r866 - in /packages/haskell-uulib/branches/upstream/current: README configure configure.in src/DDataProps.hs src/UU/DData/MultiSet.hs src/UU/Parsing/Interface.hs src/UU/Parsing/Perms.hs uulib.cabal uulib.cabal.in

arjan at users.alioth.debian.org arjan at users.alioth.debian.org
Sun Dec 30 19:00:29 UTC 2007


Author: arjan
Date: Sun Dec 30 19:00:28 2007
New Revision: 866

URL: http://svn.debian.org/wsvn/pkg-haskell/?sc=1&rev=866
Log:
[svn-upgrade] Integrating new upstream version, haskell-uulib (0.9.3~snapshot20071230)

Added:
    packages/haskell-uulib/branches/upstream/current/src/DDataProps.hs
Removed:
    packages/haskell-uulib/branches/upstream/current/configure
    packages/haskell-uulib/branches/upstream/current/uulib.cabal
Modified:
    packages/haskell-uulib/branches/upstream/current/README
    packages/haskell-uulib/branches/upstream/current/configure.in
    packages/haskell-uulib/branches/upstream/current/src/UU/DData/MultiSet.hs
    packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Interface.hs
    packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Perms.hs
    packages/haskell-uulib/branches/upstream/current/uulib.cabal.in

Modified: packages/haskell-uulib/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/README?rev=866&op=diff
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/README (original)
+++ packages/haskell-uulib/branches/upstream/current/README Sun Dec 30 19:00:28 2007
@@ -1,3 +1,6 @@
+Please check the right section in this file for instructions depending on how you obtained the source files.
+
+
 Installing uulib from a source distribution
 -------------------------------------------
 
@@ -9,11 +12,25 @@
   System wide installation (assumming GHC is the
   Haskell compiler) can be done like this:
 
-    ./configure
     ghc --make Setup.hs -o setup -package Cabal
     ./setup configure
     ./setup build
     ./setup install
+
+
+Installing uulib to a non-standard location
+-------------------------------------------
+
+  This is useful if you don't want (or can't)
+  modify system wide settings.
+
+    ghc --make Setup.hs -o setup -package Cabal
+    ./setup configure --prefix=/foo
+    ./setup build
+    ./setup install --user
+
+  The last command registers the package only for
+  the user.
 
 
 Installing uulib from the subversion repository
@@ -27,6 +44,10 @@
 
     autoconf
     ./configure
+  
+  NOTE: the above instructions are REQUIRED when you install from the
+  subversion repository. They are not needed when you download a
+  source distribution.
 
   This generates uulib.cabal which is needed for the cabal commands:
 
@@ -40,22 +61,6 @@
   the steps outlined above.
 
 
-Installing uulib to a non-standard location
--------------------------------------------
-
-  This is useful if you don't want (or can't)
-  modify system wide settings.
-
-    ./configure
-    ghc --make Setup.hs -o setup -package Cabal
-    ./setup configure --prefix=/foo
-    ./setup build
-    ./setup install --user
-
-  The last command registers the package only for
-  the user.
-
-
 Optionally generating Haddock Documentation
 -------------------------------------------
 
@@ -64,19 +69,3 @@
 
     ./setup haddock
 
-
-
-Revision information (for bug reporting)
-----------------------------------------
-
-Path: trunk
-URL: https://svn.cs.uu.nl:12443/repos/uust-repo/uulib/trunk
-Repository Root: https://svn.cs.uu.nl:12443/repos/uust-repo
-Repository UUID: 30b93d28-2606-0410-b7f1-95e0edb40354
-Revision: 178
-Node Kind: directory
-Schedule: normal
-Last Changed Author: arthurvl
-Last Changed Rev: 154
-Last Changed Date: 2007-05-09 13:55:16 +0200 (Wed, 09 May 2007)
-

Modified: packages/haskell-uulib/branches/upstream/current/configure.in
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/configure.in?rev=866&op=diff
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/configure.in (original)
+++ packages/haskell-uulib/branches/upstream/current/configure.in Sun Dec 30 19:00:28 2007
@@ -29,26 +29,6 @@
 AC_PATH_PROG(LD,ld)
 AC_PATH_PROG(GREP,grep)
 AC_PATH_PROG(CHMOD,chmod)
-AC_PATH_PROG(GHC,ghc)
-
-# determine GHC version
-ghcVersion=`$GHC --numeric-version`
-AC_SUBST(GHC_VERSION, $ghcVersion)
-
-# after ghc 6.4.1 the names of cabal option(s) changed
-case $ghcVersion in
-  6.4.1)
-    optCabalInstances=AllowUndecidableInstances
-    srcDirsField=Hs-Source-Dir
-    ;;
-  *)
-    optCabalInstances=UndecidableInstances
-    srcDirsField=Hs-Source-Dirs
-    ;;
-esac
-
-AC_SUBST(EXTENSIONS,"$optCabalInstances")
-AC_SUBST(SRC_DIRS_FIELD,"$srcDirsField")
 
 # cheap relative_dir, see GH for proper use
 relative_dir=.

Added: packages/haskell-uulib/branches/upstream/current/src/DDataProps.hs
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/src/DDataProps.hs?rev=866&op=file
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/src/DDataProps.hs (added)
+++ packages/haskell-uulib/branches/upstream/current/src/DDataProps.hs Sun Dec 30 19:00:28 2007
@@ -1,0 +1,51 @@
+
+import UU.DData.MultiSet
+
+import Test.QuickCheck
+
+type MInt = MultiSet Int
+
+-- Can a singleton multiset constructed from a singleton list?
+propSingle :: Int -> Bool
+propSingle x = single x == fromList [x]
+
+-- Singleton multisets have one occurrence of an element.
+propSingle2 :: Int -> Bool
+propSingle2 x = occur x (single x) == 1
+
+-- An element occurring once has occurrence zero if deleted.
+propDelete :: Int -> Bool
+propDelete x = (occur x $ delete x $ fromList [x]) == 0
+
+-- An element with 0 occurrences does not show in the occurrences list.
+propDelete2 :: Int -> Bool
+propDelete2 x = (toOccurList $ delete x $ fromList [x]) == []
+
+-- Insertion of 0-occurring elements
+propInsert :: Int -> Bool
+propInsert x = (occur x $ insertMany x 0 empty) == 0
+
+-- Deletiong of an element with one occurrence yields a valid multiset.
+propValid :: Int -> Bool
+propValid x = valid $ delete x $ fromList [x]
+
+-- Union of non-disjoint multisets adds the occurrences of overlapping elements.
+propUnion :: Bool
+propUnion =  (toOccurList $ unions [fromList "abbc", fromList "aabdd"]) == [('a',3),('b',3),('c',1),('d',2)]
+
+-- This property fails if for example the result of delete has the following occurrence list [('a',0)]
+-- while equality assumes that zero-occurring elements do not appear in that list.
+propEq :: Bool
+propEq = delete 'a' (fromList "a") == empty
+
+-- A bit silly, most properties do not really need quickcheck
+testMM = do
+       quickCheck propSingle
+       quickCheck propSingle2
+       quickCheck propDelete
+       quickCheck propDelete2
+       quickCheck propInsert
+       quickCheck propValid
+       quickCheck propUnion
+       quickCheck propEq
+

Modified: packages/haskell-uulib/branches/upstream/current/src/UU/DData/MultiSet.hs
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/src/UU/DData/MultiSet.hs?rev=866&op=diff
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/src/UU/DData/MultiSet.hs (original)
+++ packages/haskell-uulib/branches/upstream/current/src/UU/DData/MultiSet.hs Sun Dec 30 19:00:28 2007
@@ -164,7 +164,7 @@
 -- | /O(1)/. Create a singleton multi set.
 single :: a -> MultiSet a
 single x 
-  = MultiSet (M.single x 0)
+  = MultiSet (M.single x 1)
     
 {--------------------------------------------------------------------
   Insertion, Deletion
@@ -177,6 +177,8 @@
 -- | /O(min(n,W))/. The expression (@insertMany x count mset@)
 -- inserts @count@ instances of @x@ in the multi set @mset at .
 insertMany ::  Ord a => a -> Int -> MultiSet a -> MultiSet a
+-- We still expect not to get count < 0
+insertMany x 0 multiset = multiset
 insertMany x count (MultiSet m)          
   = MultiSet (M.insertWith (+) x count m)
 
@@ -185,7 +187,7 @@
 delete x (MultiSet m)
   = MultiSet (M.updateWithKey f x m)
   where
-    f x n  | n > 0     = Just (n-1)
+    f x n  | n > 1     = Just (n-1)
            | otherwise = Nothing
 
 -- | /O(log n)/. Delete all occurrences of an element.
@@ -226,7 +228,14 @@
 -- | The union of a list of multisets.
 unions :: Ord a => [MultiSet a] -> MultiSet a
 unions multisets
-  = MultiSet (M.unions [m | MultiSet m <- multisets])
+  -- Original, wrong
+  -- = MultiSet (M.unions [m | MultiSet m <- multisets])
+  -- Map has no unionsWith
+  -- = MultiSet (M.unionsWith (+) [m | MultiSet m <- multisets])
+  -- Correct, but requires Data.List.foldl'
+  -- = MultiSet (foldl' (M.unionWith (+)) M.empty [m | MultiSet m <- multisets])
+  -- Correct, but not strict like the original (M.unions uses foldStrict)
+  = foldr union empty multisets
 
 {--------------------------------------------------------------------
   Filter and partition

Modified: packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Interface.hs
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Interface.hs?rev=866&op=diff
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Interface.hs (original)
+++ packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Interface.hs Sun Dec 30 19:00:28 2007
@@ -1,3 +1,4 @@
+{-# OPTIONS -fglasgow-exts  #-}
 module UU.Parsing.Interface 
        ( AnaParser, pWrap, pMap
        , module UU.Parsing.MachineInterface
@@ -34,6 +35,9 @@
   -- | Sequential composition. Often used in combination with <$>.
   -- The function returned by parsing the left-hand side is applied 
   -- to the value returned by parsing the right-hand side.
+  -- Note: Implementations of this combinator should lazily match on
+  -- and evaluate the right-hand side parser. The derived combinators 
+  -- for list parsing will explode if they do not.
   (<*>) :: p (a->b) -> p a -> p b
   -- | Value ignoring versions of sequential composition. These ignore
   -- either the value returned by the parser on the right-hand side or 

Modified: packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Perms.hs
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Perms.hs?rev=866&op=diff
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Perms.hs (original)
+++ packages/haskell-uulib/branches/upstream/current/src/UU/Parsing/Perms.hs Sun Dec 30 19:00:28 2007
@@ -1,3 +1,4 @@
+{-# OPTIONS -fglasgow-exts  #-}
 module UU.Parsing.Perms(Perms(), pPerms, pPermsSep, succeedPerms, (~*~), (~$~)) where
 
 import UU.Parsing
@@ -53,4 +54,4 @@
                 let empty          = fromMaybe  pFail mbempty
                     pars (Br t p)  = flip ($) <$ fsep <*> p <*> p2p sep t
                 in foldr (<|>) empty (map pars nonempties)              
-        p2p_sep =  p2p sep                   
+        p2p_sep =  p2p sep                   

Modified: packages/haskell-uulib/branches/upstream/current/uulib.cabal.in
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-uulib/branches/upstream/current/uulib.cabal.in?rev=866&op=diff
==============================================================================
--- packages/haskell-uulib/branches/upstream/current/uulib.cabal.in (original)
+++ packages/haskell-uulib/branches/upstream/current/uulib.cabal.in Sun Dec 30 19:00:28 2007
@@ -1,7 +1,7 @@
 name: uulib
 version: @VERSION@
 license: OtherLicense
-maintainer: Alexey Rodriguez <alexey at cs.uu.nl>
+maintainer: Arie Middelkoop <ariem at cs.uu.nl>
 Build-Depends: base, haskell98
 exposed-modules: UU.Parsing.CharParser UU.Parsing.Derived
                  UU.Parsing.Interface UU.Parsing.MachineInterface
@@ -17,5 +17,5 @@
                  UU.Pretty.Basic UU.Parsing.Machine    
                  UU.DData.IntMap  
                  UU.DData.IntSet        
-Extensions:  RankNTypes CPP @EXTENSIONS@
- at SRC_DIRS_FIELD@: src
+Extensions:  RankNTypes FunctionalDependencies TypeSynonymInstances UndecidableInstances FlexibleInstances MultiParamTypeClasses FlexibleContexts CPP
+Hs-Source-Dirs: src




More information about the Pkg-haskell-commits mailing list