From jpm at cs.uu.nl Tue Feb 2 03:06:55 2010 From: jpm at cs.uu.nl (=?ISO-8859-1?Q?Jos=E9_Pedro_Magalh=E3es?=) Date: Tue Feb 2 02:38:29 2010 Subject: packedstring should depend on base >= 4 Message-ID: <52f14b211002020006n6b2b4ce8i666abee648989e5e@mail.gmail.com> Hello all, While installing packedstring: > cabal install packedstring > Resolving dependencies... > Configuring packedstring-0.1.0.1... > Preprocessing library packedstring-0.1.0.1... > Building packedstring-0.1.0.1... > > Data\PackedString.hs:83:7: > Could not find module `Data.Data': > It is a member of the hidden package `base'. > Perhaps you need to add `base' to the build-depends in your .cabal > file. > Use -v to see a list of the files searched for. > cabal: Error: some packages failed to install: > packedstring-0.1.0.1 failed during the building phase. The exception was: > ExitFailure 1 > > > cabal install packedstring --preference="base >= 4" > Then it installs fine. Shouldn't the constraint "base >= 4" be added to the packedstring package? I know it's deprecated, but many things depend on it ( http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/revdeps/packedstring-0.1.0.1), namely template-haskell... Thanks, Pedro -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/libraries/attachments/20100202/402d4ec1/attachment.html From jnf at arcor.de Tue Feb 2 17:09:05 2010 From: jnf at arcor.de (=?ISO-8859-1?Q?J=FCrgen?= Nicklisch-Franken) Date: Tue Feb 2 16:40:02 2010 Subject: Can the Haddock library expose more (then just reading interface files)? In-Reply-To: References: <26854367.post@talk.nabble.com> Message-ID: <1265148545.2547.78.camel@deus-x-machina> Hi David, Leksah calls createInterfaces and uses the returned Interface, which means to analyse the HsDecl structure. Leksah wants to know the type, source position and comment for every exported item. If you can't expose the modules we need, you will find a haddock-leksah package on hackage soon, with the original haddock, and only the cabal file with the added exposed modules. That would be ugly. J?rgen Am Dienstag, den 22.12.2009, 19:13 +0100 schrieb David Waern: > 2009/12/19 jutaro : > > > > I've ported part of the Leksah metadata collection to use Haddock. > > But, now it comes, I have not created another backend, but would like to use > > Haddock as a > > library and call "createInterface" directly. > > So I need to change the exposed-modules section of haddock.cabal file to > > include: > > "Haddock.Types Haddock.Interface Haddock.Options" > > Would that be an acceptable patch for the general release, or do you feel it > > to be too unhygienic or something? > > There has been some discussion about introducing a full-information > format that haddock can produce that tools can read. It's not > something anyone is working on at the moment, though. So while waiting > for something like that, we could try to work something out. Exporting > more of Haddock to the outside is a possibility. It would be > interesting to know which parts of the Interface structure that you're > after. > > David From david.waern at gmail.com Wed Feb 3 15:28:53 2010 From: david.waern at gmail.com (David Waern) Date: Wed Feb 3 15:00:21 2010 Subject: Can the Haddock library expose more (then just reading interface files)? In-Reply-To: <1265148545.2547.78.camel@deus-x-machina> References: <26854367.post@talk.nabble.com> <1265148545.2547.78.camel@deus-x-machina> Message-ID: 2010/2/2 J?rgen Nicklisch-Franken : > Hi David, > Leksah calls createInterfaces and uses the returned Interface, > which means to analyse the HsDecl structure. Leksah wants to know the > type, source position and comment for every exported item. > If you can't expose the modules we need, you will find a haddock-leksah > package on hackage soon, with the original haddock, and only the cabal > file with the added exposed modules. That would be ugly. I don't see any problems with exposing createInterface and Interface other than it would bring in a lot of additional data types. I'll see if I can expose createInterface in the next major release. I'll probably also rename the current API from Distribution.Haddock to Documentation.Haddock. Don't expect the API to be very stable, however, since it will directly expose internal data structures and functions. David David From jnf at arcor.de Fri Feb 5 08:11:12 2010 From: jnf at arcor.de (=?ISO-8859-1?Q?J=FCrgen?= Nicklisch-Franken) Date: Fri Feb 5 07:41:58 2010 Subject: Can the Haddock library expose more (then just reading interface files)? In-Reply-To: References: <26854367.post@talk.nabble.com> <1265148545.2547.78.camel@deus-x-machina> Message-ID: <1265375472.12541.14.camel@deus-x-machina> Hi David, that would be great. Please drop me a note when you have done the changes, so that I can test if it works. Maybe I still need a haddock-leksah project, to bridge the time, but we can throw it away soon. Regarding the stability of the interface, I've just seen that DocDecl has changed completely with ghc 6.12, (Do you know why?) J?rgen Am Mittwoch, den 03.02.2010, 21:28 +0100 schrieb David Waern: > 2010/2/2 J?rgen Nicklisch-Franken : > > Hi David, > > Leksah calls createInterfaces and uses the returned Interface, > > which means to analyse the HsDecl structure. Leksah wants to know the > > type, source position and comment for every exported item. > > If you can't expose the modules we need, you will find a haddock-leksah > > package on hackage soon, with the original haddock, and only the cabal > > file with the added exposed modules. That would be ugly. > > I don't see any problems with exposing createInterface and Interface > other than it would bring in a lot of additional data types. I'll see > if I can expose createInterface in the next major release. I'll > probably also rename the current API from Distribution.Haddock to > Documentation.Haddock. Don't expect the API to be very stable, > however, since it will directly expose internal data structures and > functions. > > David > > David From david.waern at gmail.com Mon Feb 8 18:10:42 2010 From: david.waern at gmail.com (David Waern) Date: Mon Feb 8 17:42:02 2010 Subject: Can the Haddock library expose more (then just reading interface files)? In-Reply-To: <1265375472.12541.14.camel@deus-x-machina> References: <26854367.post@talk.nabble.com> <1265148545.2547.78.camel@deus-x-machina> <1265375472.12541.14.camel@deus-x-machina> Message-ID: 2010/2/5 J?rgen Nicklisch-Franken : > Regarding the stability of the interface, I've just seen that DocDecl > has changed completely with ghc 6.12, (Do you know why?) > J?rgen Isaac Dupree moved the parser and lexer for the Haddock markup syntax out of GHC during his Summer of Code project. That's why DocDecl now just contains strings. I suggest we move this discussion to the Haddock list since it's getting off-topic for libraries@. David From itkovian at gmail.com Tue Feb 9 07:43:28 2010 From: itkovian at gmail.com (Andy Georges) Date: Tue Feb 9 07:14:45 2010 Subject: ANN: haxr 3000.5 and haxr-th 3000.5 In-Reply-To: References: Message-ID: Hello, On Jan 16, 2010, at 16:03 PM, Gracjan Polak wrote: > > Hello fellow haskellers, > > New release of HaXR 3000.5 availalble! HaXR is a library for writing XML-RPC > client and server applications in Haskell. HaXR consists of two packages: haxr > and haxr-th. The latter package contains the Template Haskell code used for > automatically deriving XML-RPC struct representations for Haskell records. > > http://hackage.haskell.org/package/haxr > > Goodies in this release include: > > * UTF-8 encoding > * HTTP 4000 and ByteStrings > * HaXml dependency upgrade to 1.20 > > My request to The Powers: since I have no access rights to the HaXR home page > http://www.haskell.org/haxr/ could we please move it to haskellwiki? Also the > old repository http://darcs.haskell.org/haxr is now stale. Can we do something > about this? > I've added a link to the new repo on the haskellwiki pages (http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming) Unfortunately, I cannot alter the info given on http://www.haskell.org/haxr/. -- Andy Georges From malcolm.wallace at cs.york.ac.uk Tue Feb 9 09:37:07 2010 From: malcolm.wallace at cs.york.ac.uk (Malcolm Wallace) Date: Tue Feb 9 09:08:19 2010 Subject: ANN: haxr 3000.5 and haxr-th 3000.5 In-Reply-To: References: Message-ID: <56BF4116-267D-4C46-B693-189B0A761D1D@cs.york.ac.uk> >> My request to The Powers: since I have no access rights to the HaXR >> home page >> http://www.haskell.org/haxr/ could we please move it to haskellwiki? > I've added a link to the new repo on the haskellwiki pages (http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming > ) Unfortunately, I cannot alter the info given on http://www.haskell.org/haxr/ > . I have placed an HTML refresh/redirect from haskell.org/haxr to haskell.org/haskellwiki/HaXR Regards, Malcolm From gracjanpolak at gmail.com Tue Feb 9 10:43:29 2010 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Tue Feb 9 10:15:07 2010 Subject: Cabal build depends and if cpp-options Message-ID: Hi, I'd like to do something like this in cabal: Library Build-depends: base >= 3 && <= 5 if (base==4.*) cpp-options: -DUSE_BASE_4 else cpp-options: -DUSE_BASE_3 Is there a way to use the if construct that check what version of dependent package has been chosen? -- Gracjan From malcolm.wallace at cs.york.ac.uk Tue Feb 9 11:04:31 2010 From: malcolm.wallace at cs.york.ac.uk (Malcolm Wallace) Date: Tue Feb 9 10:35:42 2010 Subject: Cabal build depends and if cpp-options In-Reply-To: References: Message-ID: > Library > Build-depends: base >= 3 && <= 5 > if (base==4.*) > cpp-options: -DUSE_BASE_4 > else > cpp-options: -DUSE_BASE_3 > > > Is there a way to use the if construct that check what version of > dependent > package has been chosen? Flag foo Library if foo build-depends: base >=4 && <=5 cpp-options: -DUSE_BASE_4 else build-depends: base >=3 && <4 cpp-options: -DUSE_BASE_3 Regards, Malcolm From simon at joyful.com Tue Feb 9 13:52:20 2010 From: simon at joyful.com (Simon Michael) Date: Tue Feb 9 13:24:01 2010 Subject: add waitForTermination to process package ? Message-ID: happstack-state has this function: http://hackage.haskell.org/packages/archive/happstack-state/0.4.1/doc/html/src/Happstack-State-Control.html#waitForTermination which I find handy. Here's what I use it for: tid <- forkIO $ server opts args l putStrLn "starting web browser" openBrowserOn homeurl waitForTermination putStrLn "shutting down web server..." killThread tid putStrLn "shutdown complete" I'd like to not depend on happstack just for this. Could it be added to System.Process ? Best - Simon From simon at joyful.com Tue Feb 9 13:57:24 2010 From: simon at joyful.com (Simon Michael) Date: Tue Feb 9 13:31:16 2010 Subject: libraries list posting permission Message-ID: PS, for what it's worth I note that a mail sent to the maintainer address in the process haddock (libraries@haskell.org) is unconditionally rejected unless you're already subscribed, but I was able to post easily via gmane. From gracjanpolak at gmail.com Wed Feb 10 04:51:13 2010 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Wed Feb 10 04:22:48 2010 Subject: Cabal build depends and if cpp-options References: Message-ID: Malcolm Wallace cs.york.ac.uk> writes: > > Flag foo > > Library > if foo > build-depends: base >=4 && <=5 > cpp-options: -DUSE_BASE_4 > else > build-depends: base >=3 && <4 > cpp-options: -DUSE_BASE_3 > This seems to be classic solution. I have a library that could accommodate to whatever base it compiles with. But that base version number depends on the requirements of the program or of all the other libraries involved. Therefore I imagine that: 1. dependency solver will pick base version that satisfies all of the constraints 2. tells my library which one has been chosen for this particular build 3. my lib happily compiles Look ma! No flags! How to do cabal install MyProg where MyProg depends on MyLib but with particular MyFlag set? -- Gracjan From conrad at metadecks.org Thu Feb 11 03:22:58 2010 From: conrad at metadecks.org (Conrad Parker) Date: Thu Feb 11 02:54:06 2010 Subject: [darcs patch] filepath: normalise trailing dot In-Reply-To: References: Message-ID: Hi, the attached darcs patch modifies the behaviour of normalise to handle trailing dots in a path. The previous behaviour yielded this: Prelude System.FilePath> normalise "../." "../." Prelude System.FilePath> normalise ".././" ".././" Prelude System.FilePath> normalise ".././.." "../.." This patch modifies dropDots such that the check for (".":[]) only occurs once for the path, after which a driver function dropDots' is used which skips this check. Hence "." can be removed from the end of a longer path, but a path of just "." is unchanged. (my trac account is pending verification, I'll reply with a trac ticket # later if needed) cheers, Conrad. -------------- next part -------------- A non-text attachment was scrubbed... Name: normalise-trailing-dot.patch Type: text/x-diff Size: 3694 bytes Desc: not available Url : http://www.haskell.org/pipermail/libraries/attachments/20100211/31e22a23/normalise-trailing-dot.bin From kathleen.fisher at gmail.com Thu Feb 11 17:28:20 2010 From: kathleen.fisher at gmail.com (Kathleen Fisher) Date: Thu Feb 11 16:59:26 2010 Subject: Installing syb(-0.1.03) package in head version of Haskell Message-ID: <4AE99B7C-98CC-490D-93CA-D03F5BB18F54@gmail.com> Hi all, I'm trying to get a program that uses the Data.Generics module to compile under the head version of GHC, but I am having trouble getting the syb package installed. I believe I am using the most recent version of cabal: > kfisher-laptop:/Users/kfisher/pads/dirpads/language-c-quote>~/.cabal/bin/cabal --version > cabal-install version 0.8.0 > using version 1.8.0.1 of the Cabal library When I ask cabal to install the syb package, I get the following error: > kfisher-laptop:/Users/kfisher/pads/dirpads/language-c-quote>~/.cabal/bin/cabal install -w ~/sw/ghc-head/bin/ghc > Resolving dependencies... > Downloading mtl-1.1.0.2... > Configuring mtl-1.1.0.2... > Preprocessing library mtl-1.1.0.2... > ... > Registering syb-0.1.0.3... > cabal: ghc-pkg: : hGetContents: invalid argument (invalid UTF-8 byte > sequence) > cabal: Error: some packages failed to install: > language-c-quote-0.1 depends on syb-0.1.0.3 which failed to install. > syb-0.1.0.3 failed during the building phase. The exception was: > exit: ExitFailure 1 The full trace is included below. Here's the version information for the ghc I am running. > Kfisher-laptop:/Users/kfisher/pads/dirpads/language-c-quote>~/sw/ghc-head/bin/ghc --version > The Glorious Glasgow Haskell Compilation System, version 6.13.20100210 The cabal website suggests sending questions to this list... Any suggestions for how to fix this problem? Kathleen > kfisher-laptop:/Users/kfisher/pads/dirpads/language-c-quote>~/.cabal/bin/cabal install -w ~/sw/ghc-head/bin/ghc > Resolving dependencies... > Downloading mtl-1.1.0.2... > Configuring mtl-1.1.0.2... > Preprocessing library mtl-1.1.0.2... > Building mtl-1.1.0.2... > [ 1 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, dist/build/Control/Monad/Identity.o ) > > Control/Monad/Cont.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Cont/Class.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Error.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Error/Class.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/List.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/RWS/Lazy.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/RWS/Strict.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Reader.hs:2:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Reader/Class.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/State/Lazy.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/State/Strict.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Writer.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Writer/Class.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Writer/Lazy.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > > Control/Monad/Writer/Strict.hs:1:12: > Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead > [ 2 of 21] Compiling Control.Monad.Writer.Class ( Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o ) > [ 3 of 21] Compiling Control.Monad.Error.Class ( Control/Monad/Error/Class.hs, dist/build/Control/Monad/Error/Class.o ) > [ 4 of 21] Compiling Control.Monad.State.Class ( Control/Monad/State/Class.hs, dist/build/Control/Monad/State/Class.o ) > [ 5 of 21] Compiling Control.Monad.Reader.Class ( Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o ) > [ 6 of 21] Compiling Control.Monad.RWS.Class ( Control/Monad/RWS/Class.hs, dist/build/Control/Monad/RWS/Class.o ) > [ 7 of 21] Compiling Control.Monad.Trans ( Control/Monad/Trans.hs, dist/build/Control/Monad/Trans.o ) > > Control/Monad/Trans.hs:26:1: > Warning: The import of `System.IO' is redundant > except perhaps to import instances from `System.IO' > To import instances alone, use: import System.IO() > [ 8 of 21] Compiling Control.Monad.Cont.Class ( Control/Monad/Cont/Class.hs, dist/build/Control/Monad/Cont/Class.o ) > [ 9 of 21] Compiling Control.Monad.Reader ( Control/Monad/Reader.hs, dist/build/Control/Monad/Reader.o ) > [10 of 21] Compiling Control.Monad.Error ( Control/Monad/Error.hs, dist/build/Control/Monad/Error.o ) > > Control/Monad/Error.hs:63:1: > Warning: The import of `System.IO' is redundant > except perhaps to import instances from `System.IO' > To import instances alone, use: import System.IO() > [11 of 21] Compiling Control.Monad.List ( Control/Monad/List.hs, dist/build/Control/Monad/List.o ) > [12 of 21] Compiling Control.Monad.RWS.Lazy ( Control/Monad/RWS/Lazy.hs, dist/build/Control/Monad/RWS/Lazy.o ) > [13 of 21] Compiling Control.Monad.RWS ( Control/Monad/RWS.hs, dist/build/Control/Monad/RWS.o ) > [14 of 21] Compiling Control.Monad.RWS.Strict ( Control/Monad/RWS/Strict.hs, dist/build/Control/Monad/RWS/Strict.o ) > [15 of 21] Compiling Control.Monad.State.Lazy ( Control/Monad/State/Lazy.hs, dist/build/Control/Monad/State/Lazy.o ) > [16 of 21] Compiling Control.Monad.State ( Control/Monad/State.hs, dist/build/Control/Monad/State.o ) > [17 of 21] Compiling Control.Monad.State.Strict ( Control/Monad/State/Strict.hs, dist/build/Control/Monad/State/Strict.o ) > [18 of 21] Compiling Control.Monad.Writer.Lazy ( Control/Monad/Writer/Lazy.hs, dist/build/Control/Monad/Writer/Lazy.o ) > [19 of 21] Compiling Control.Monad.Writer ( Control/Monad/Writer.hs, dist/build/Control/Monad/Writer.o ) > [20 of 21] Compiling Control.Monad.Writer.Strict ( Control/Monad/Writer/Strict.hs, dist/build/Control/Monad/Writer/Strict.o ) > [21 of 21] Compiling Control.Monad.Cont ( Control/Monad/Cont.hs, dist/build/Control/Monad/Cont.o ) > Registering mtl-1.1.0.2... > Installing library in /Users/kfisher/.cabal/lib/mtl-1.1.0.2/ghc-6.13.20100210 > Registering mtl-1.1.0.2... > Configuring syb-0.1.0.3... > Preprocessing library syb-0.1.0.3... > Building syb-0.1.0.3... > [1 of 7] Compiling Data.Generics.Basics ( src/Data/Generics/Basics.hs, dist/build/Data/Generics/Basics.o ) > [2 of 7] Compiling Data.Generics.Instances ( src/Data/Generics/Instances.hs, dist/build/Data/Generics/Instances.o ) > > src/Data/Generics/Instances.hs:34:1: > Warning: In the use of `mkNorepType' > (imported from Data.Data): > Deprecated: "Use mkNoRepType instead" > > src/Data/Generics/Instances.hs:38:1: > Warning: Module `GHC.IOBase' is deprecated: use GHC.IO instead > [3 of 7] Compiling Data.Generics.Aliases ( src/Data/Generics/Aliases.hs, dist/build/Data/Generics/Aliases.o ) > [4 of 7] Compiling Data.Generics.Schemes ( src/Data/Generics/Schemes.hs, dist/build/Data/Generics/Schemes.o ) > [5 of 7] Compiling Data.Generics.Text ( src/Data/Generics/Text.hs, dist/build/Data/Generics/Text.o ) > > src/Data/Generics/Text.hs:30:1: > Warning: The import of `Data.Maybe' is redundant > except perhaps to import instances from `Data.Maybe' > To import instances alone, use: import Data.Maybe() > > src/Data/Generics/Text.hs:91:10: > Warning: A do-notation statement discarded a result of type Char. > Suppress this warning by saying "_ <- char '('", > or by using the flag -fno-warn-unused-do-bind > > src/Data/Generics/Text.hs:101:10: > Warning: A do-notation statement discarded a result of type Char. > Suppress this warning by saying "_ <- char ')'", > or by using the flag -fno-warn-unused-do-bind > [6 of 7] Compiling Data.Generics.Twins ( src/Data/Generics/Twins.hs, dist/build/Data/Generics/Twins.o ) > [7 of 7] Compiling Data.Generics ( src/Data/Generics.hs, dist/build/Data/Generics.o ) > > src/Data/Generics.hs:40:1: > Warning: The import of `Prelude' is redundant > except perhaps to import instances from `Prelude' > To import instances alone, use: import Prelude() > Registering syb-0.1.0.3... > cabal: ghc-pkg: : hGetContents: invalid argument (invalid UTF-8 byte > sequence) > cabal: Error: some packages failed to install: > language-c-quote-0.1 depends on syb-0.1.0.3 which failed to install. > syb-0.1.0.3 failed during the building phase. The exception was: > exit: ExitFailure 1 From igloo at earth.li Sat Feb 13 08:45:22 2010 From: igloo at earth.li (Ian Lynagh) Date: Sat Feb 13 08:16:21 2010 Subject: Bug in Parsec.Token In-Reply-To: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> Message-ID: <20100213134522.GA6582@matrix.chaos.earth.li> On Tue, Nov 24, 2009 at 09:35:13PM -0800, Greg Fitzgerald wrote: > In Text.Parsec.Token, the list of reserved names is not necessarily sorted > for case-insensitive languages. When the list of reserved names contains a > string with capital letters, the 'identifier' combinator can accept > identifiers that conflict with reserved names. Attached are patches for > Parsec 2.1 and 3.0. I've applied the 2.1 patch to http://darcs.haskell.org/old-from-monk/parsec/ but I think that is unmaintained now. Thanks Ian From igloo at earth.li Sat Feb 13 09:28:18 2010 From: igloo at earth.li (Ian Lynagh) Date: Sat Feb 13 08:59:17 2010 Subject: packedstring In-Reply-To: <9436bffe1001170133y6d7b8ba4h986e27287a59f0fd@mail.gmail.com> References: <9436bffe1001170133y6d7b8ba4h986e27287a59f0fd@mail.gmail.com> Message-ID: <20100213142818.GA32038@matrix.chaos.earth.li> On Sun, Jan 17, 2010 at 07:33:12PM +1000, Jens Petersen wrote: > I needed to apply the follow patch to packedstring to install it with > ghc-6.12.1 and cabal-install-0.8.0 on my machine: I've applied the patch to the repo here: http://darcs.haskell.org/old-from-monk/packedstring/ but I think packedstring is now unmaintained. Thanks Ian From igloo at earth.li Sun Feb 14 09:06:59 2010 From: igloo at earth.li (Ian Lynagh) Date: Sun Feb 14 08:37:56 2010 Subject: cabal user guide character set In-Reply-To: References: Message-ID: <20100214140659.GA7706@matrix.chaos.earth.li> On Thu, Jan 28, 2010 at 04:34:02PM +0000, Jon Fairbairn wrote: > http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/ > is served as Content-Type: text/html; charset=utf-8 > but the content appears to be iso8859-1 It does have a HTML header. I've just tried to get xsltproc to generate utf8 instead, but I was not successful. Thanks Ian From Malcolm.Wallace at cs.york.ac.uk Mon Feb 15 06:14:35 2010 From: Malcolm.Wallace at cs.york.ac.uk (Malcolm Wallace) Date: Mon Feb 15 05:47:03 2010 Subject: packedstring In-Reply-To: <20100213142818.GA32038@matrix.chaos.earth.li> References: <9436bffe1001170133y6d7b8ba4h986e27287a59f0fd@mail.gmail.com> <20100213142818.GA32038@matrix.chaos.earth.li> Message-ID: <01F2441C-2DFB-4408-98A0-E886E312FC73@cs.york.ac.uk> >> I needed to apply the follow patch to packedstring to install it >> with ghc-6.12.1 and cabal-install-0.8.0 on my machine: > > I've applied the patch to the repo here: > http://darcs.haskell.org/old-from-monk/packedstring/ > but I think packedstring is now unmaintained. I hereby volunteer to adopt maintainership of packedstring. The new location of its darcs repo is: http://www.cs.york.ac.uk/fp/darcs/packedstring (although at some later point I may move it to code.haskell.org). Regards, Malcolm From rl at cse.unsw.edu.au Mon Feb 15 10:38:59 2010 From: rl at cse.unsw.edu.au (Roman Leshchinskiy) Date: Mon Feb 15 10:09:52 2010 Subject: ANN: vector 0.5 Message-ID: <56328854-5578-4377-BEE0-EA3499CC092E@cse.unsw.edu.au> Hi everyone, I am pleased to announce the release of version 0.5 of package vector, a high-performance Haskell array library with a powerful loop fusion framework. The main highlights compared to previous versions are: * DPH-style unboxed vectors (in Data.Vector.Unboxed) which use associated types to select the appropriate unboxed representation depending on the type of the elements. * A redesigned interface between mutable and immutable vectors. In particular, the popular unsafeFreeze primitive is now supported for all vector types. * Many new operations on both immutable and mutable vectors. * Significant performance improvements. The library comes with a fairly complete testsuite (mainly thanks to Max Bolingbroke) and is quite stable by now. Barring various disasters, I expect to release version 1.0 in the next 3 to 4 months. The release is accompanied by a new version of the NoSlow array benchmark suite. A few quite meaningless preliminary benchmarks are available at: http://unlines.wordpress.com/2010/02/15/vector-0-5-is-here-2 Both vector and NoSlow are on Hackage. Hackers can get the darcs repos from http://code.haskell.org/vector and http://code.haskell.org/NoSlow Enjoy! Roman From ndmitchell at gmail.com Tue Feb 16 11:50:18 2010 From: ndmitchell at gmail.com (Neil Mitchell) Date: Tue Feb 16 11:21:10 2010 Subject: [darcs patch] filepath: normalise trailing dot In-Reply-To: References: Message-ID: <404396ef1002160850v7cd6b7e6jc564753bbbbea216@mail.gmail.com> Hi Conrad, Your proposal seems sensible (+1). Although in the past some people complained about normalising away .'s being a bug in some corner cases, so if anyone can find one of them I withdraw my support. Creating a trac ticket is important so that the patch doesn't get lost. Thanks, Neil On Thu, Feb 11, 2010 at 8:22 AM, Conrad Parker wrote: > Hi, > > the attached darcs patch modifies the behaviour of normalise to handle > trailing dots in a path. The previous behaviour yielded this: > > Prelude System.FilePath> normalise "../." > "../." > Prelude System.FilePath> normalise ".././" > ".././" > Prelude System.FilePath> normalise ".././.." > "../.." > > This patch modifies dropDots such that the check for (".":[]) only > occurs once for the path, after which a driver function dropDots' is > used which skips this check. Hence "." can be removed from the end of > a longer path, but a path of just "." is unchanged. > > (my trac account is pending verification, I'll reply with a trac > ticket # later if needed) > > cheers, > > Conrad. > > _______________________________________________ > Libraries mailing list > Libraries@haskell.org > http://www.haskell.org/mailman/listinfo/libraries > > From ndmitchell at gmail.com Tue Feb 16 13:48:44 2010 From: ndmitchell at gmail.com (Neil Mitchell) Date: Tue Feb 16 13:19:34 2010 Subject: Network library patches Message-ID: <404396ef1002161048k78fedf4dha990db17e6c80ae6@mail.gmail.com> Hi I finally got the network library (darcs) building, installing and basically working on Windows with GHC 6.12.1. To do this I set up my environment as follows: 1) Install Cygwin 1.7 (include autoreconf) 2) Install GHC 6.12.1 3) export PATH=/cygdrive/c/ghc/ghc-6.12.1/mingw/bin:$PATH I then did the network steps: 1) Grab network from darcs 2) autoreconf 3) Apply the patch attached, which just changes the .cabal file 4) Change all instances of CALLCONV to stdcall 5) cabal install Please can you apply the attached patch, which should be compatible with Linux/Mac too. I found lots of references to CALLCONV all over the place, but couldn't figure out where it started/ended up - my attempts at #define were rather unsuccessful. Could you please change the logic so Windows gets stdcall as standard? I'm happy to test any patches you come up with. Having a working network library on Windows will be really nice, as it's stopped me upgrading to GHC 6.12.1 for a while now. Thanks, Neil -------------- next part -------------- A non-text attachment was scrubbed... Name: network_windows.patch Type: application/octet-stream Size: 459 bytes Desc: not available Url : http://www.haskell.org/pipermail/libraries/attachments/20100216/068c1e6a/network_windows.obj From claus.reinke at talk21.com Tue Feb 16 18:10:28 2010 From: claus.reinke at talk21.com (Claus Reinke) Date: Tue Feb 16 17:41:02 2010 Subject: Network library patches In-Reply-To: <404396ef1002161048k78fedf4dha990db17e6c80ae6@mail.gmail.com> References: <404396ef1002161048k78fedf4dha990db17e6c80ae6@mail.gmail.com> Message-ID: <17C25AD5086F4EC694E361BA57161F2E@VAIO> > 1) Install Cygwin 1.7 (include autoreconf) .. > 4) Change all instances of CALLCONV to stdcall > 5) cabal install > > Please can you apply the attached patch, which should be compatible > with Linux/Mac too. I found lots of references to CALLCONV all over > the place, but couldn't figure out where it started/ended up - my > attempts at #define were rather unsuccessful. Could you please change > the logic so Windows gets stdcall as standard? That part rings a bell, as the opengl binding had the same issue when dropping out of ghc's extralibs: those packages tend to be integrated into ghc's build system (or one version thereof), which sets things like CALLCONV. This particular setting tended to happen (ghc's build system has changed since I last looked, and I can't check right now) in configure (generated from configure.ac), by simply checking the build's $host variable for '*-mingw32'. This doesn't work when building on cygwin (even when using the mingw tool chain, configure will see cygwin as the host), and the simple workaround was only documented for ghc builds, not for the packages depending on ghc's build system. If that information is still relevant, you should be able to get around the CALLCONV issue when building from cygwin by passing a configure option. Here is the example that used to do the trick for building opengl/glut from cygwin: cabal install opengl glut --configure-option="--host=i386-unknown-mingw32" --reinstall A better solution would be for configure to test for the gcc tool chain, not the host environment, before setting CALLCONV. Might apply to other packages that have dropped out of the old extralibs. Hope this helps, Claus From garious at gmail.com Tue Feb 16 20:01:44 2010 From: garious at gmail.com (Greg Fitzgerald) Date: Tue Feb 16 19:32:52 2010 Subject: Bug in Parsec.Token In-Reply-To: <20100213134522.GA6582@matrix.chaos.earth.li> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> <20100213134522.GA6582@matrix.chaos.earth.li> Message-ID: <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> > I've applied the 2.1 patch to > http://darcs.haskell.org/old-from-monk/parsec/ > but I think that is unmaintained now. Thanks Ian! Unmaintained, eh? Are people migrating to Parsec 3.0? Last discussion I heard about that (many months ago), Parsec 3.0 had some performance issues when used as a drop-in replacement for 2.1. I notice that Haskell Platform ships with 2.1 and that the RWH chapter stays within the subset of 2.1. Anyone know if the Haskell Platform is changing to 3.0 in the next release? Thanks, Greg From dons at galois.com Tue Feb 16 20:04:05 2010 From: dons at galois.com (Don Stewart) Date: Tue Feb 16 19:35:06 2010 Subject: Bug in Parsec.Token In-Reply-To: <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> <20100213134522.GA6582@matrix.chaos.earth.li> <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> Message-ID: <20100217010405.GF10141@whirlpool.galois.com> garious: > > I've applied the 2.1 patch to > > http://darcs.haskell.org/old-from-monk/parsec/ > > but I think that is unmaintained now. > > Thanks Ian! > > Unmaintained, eh? Are people migrating to Parsec 3.0? Last > discussion I heard about that (many months ago), Parsec 3.0 had some > performance issues when used as a drop-in replacement for 2.1. I > notice that Haskell Platform ships with 2.1 and that the RWH chapter > stays within the subset of 2.1. Anyone know if the Haskell Platform > is changing to 3.0 in the next release? > The gitit team *won't move to parsec 3 because it is too slow*. I vote the HP doesn't move either. In fact, parsec-3.x should be the parsec3 package, and out of the business of breaking our dependency chains. From ross at soi.city.ac.uk Tue Feb 16 20:11:21 2010 From: ross at soi.city.ac.uk (Ross Paterson) Date: Tue Feb 16 19:42:53 2010 Subject: Bug in Parsec.Token In-Reply-To: <20100217010405.GF10141@whirlpool.galois.com> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> <20100213134522.GA6582@matrix.chaos.earth.li> <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> <20100217010405.GF10141@whirlpool.galois.com> Message-ID: <20100217011121.GA24712@soi.city.ac.uk> On Tue, Feb 16, 2010 at 05:04:05PM -0800, Don Stewart wrote: > The gitit team *won't move to parsec 3 because it is too slow*. > > I vote the HP doesn't move either. > > In fact, parsec-3.x should be the parsec3 package, and out of the > business of breaking our dependency chains. How about moving parsec-3 to a new name, and bumping parsec-2 to version 4? From dons at galois.com Wed Feb 17 02:22:02 2010 From: dons at galois.com (Don Stewart) Date: Wed Feb 17 01:52:50 2010 Subject: Bug in Parsec.Token In-Reply-To: <20100217011121.GA24712@soi.city.ac.uk> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> <20100213134522.GA6582@matrix.chaos.earth.li> <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> <20100217010405.GF10141@whirlpool.galois.com> <20100217011121.GA24712@soi.city.ac.uk> Message-ID: <20100217072202.GC11557@whirlpool.galois.com> ross: > On Tue, Feb 16, 2010 at 05:04:05PM -0800, Don Stewart wrote: > > The gitit team *won't move to parsec 3 because it is too slow*. > > > > I vote the HP doesn't move either. > > > > In fact, parsec-3.x should be the parsec3 package, and out of the > > business of breaking our dependency chains. > > How about moving parsec-3 to a new name, and bumping parsec-2 to version 4? That's not a bad idea. From ganesh.sittampalam at credit-suisse.com Wed Feb 17 02:44:04 2010 From: ganesh.sittampalam at credit-suisse.com (Sittampalam, Ganesh) Date: Wed Feb 17 02:15:03 2010 Subject: Bug in Parsec.Token In-Reply-To: <20100217010405.GF10141@whirlpool.galois.com> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com><20100213134522.GA6582@matrix.chaos.earth.li><1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> <20100217010405.GF10141@whirlpool.galois.com> Message-ID: Don Stewart wrote: > garious: >>> I've applied the 2.1 patch to >>> http://darcs.haskell.org/old-from-monk/parsec/ >>> but I think that is unmaintained now. >> >> Thanks Ian! >> >> Unmaintained, eh? Are people migrating to Parsec 3.0? Last >> discussion I heard about that (many months ago), Parsec 3.0 had some >> performance issues when used as a drop-in replacement for 2.1. I >> notice that Haskell Platform ships with 2.1 and that the RWH chapter >> stays within the subset of 2.1. Anyone know if the Haskell Platform >> is changing to 3.0 in the next release? >> > > The gitit team *won't move to parsec 3 because it is too slow*. I thought someone recently had a look at the performance of parsec 3 and managed to get it pretty much the same as that of parsec 2? http://www.haskell.org/pipermail/haskell-cafe/2009-December/070196.html The main obstacle to applying the work seemed to be that the author was worried about having made a fundamental data structure change in the process of switching to CPS. Ganesh =============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html =============================================================================== From igloo at earth.li Wed Feb 17 06:13:34 2010 From: igloo at earth.li (Ian Lynagh) Date: Wed Feb 17 05:44:22 2010 Subject: Bug in Parsec.Token In-Reply-To: <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> <20100213134522.GA6582@matrix.chaos.earth.li> <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> Message-ID: <20100217111334.GA10201@matrix.chaos.earth.li> On Tue, Feb 16, 2010 at 05:01:44PM -0800, Greg Fitzgerald wrote: > > I've applied the 2.1 patch to > > http://darcs.haskell.org/old-from-monk/parsec/ > > but I think that is unmaintained now. > > Thanks Ian! > > Unmaintained, eh? Are people migrating to Parsec 3.0? Just because people are still using parsec 2 doesn't mean it's maintained. If someone wants to take over maintenance of it then I'd suggest creating a project for it on community: http://community.haskell.org/admin/ Thanks Ian From aslatter at gmail.com Wed Feb 17 07:24:14 2010 From: aslatter at gmail.com (Antoine Latter) Date: Wed Feb 17 06:55:03 2010 Subject: Bug in Parsec.Token In-Reply-To: References: <1f3dc80d0911242135k69177f02o1377b24a91b30f2c@mail.gmail.com> <20100213134522.GA6582@matrix.chaos.earth.li> <1f3dc80d1002161701r312c82cdv51b3567a37a6daf6@mail.gmail.com> <20100217010405.GF10141@whirlpool.galois.com> Message-ID: <694519c51002170424k4d70c6bl9ea5d37c877f355d@mail.gmail.com> On Wed, Feb 17, 2010 at 1:44 AM, Sittampalam, Ganesh wrote: > Don Stewart wrote: >> garious: >>>> I've applied the 2.1 patch to >>>> ? ?http://darcs.haskell.org/old-from-monk/parsec/ >>>> but I think that is unmaintained now. >>> >>> Thanks Ian! >>> >>> Unmaintained, eh? ?Are people migrating to Parsec 3.0? ?Last >>> discussion I heard about that (many months ago), Parsec 3.0 had some >>> performance issues when used as a drop-in replacement for 2.1. ?I >>> notice that Haskell Platform ships with 2.1 and that the RWH chapter >>> stays within the subset of 2.1. ?Anyone know if the Haskell Platform >>> is changing to 3.0 in the next release? >>> >> >> The gitit team *won't move to parsec 3 because it is too slow*. > > I thought someone recently had a look at the performance of parsec 3 and > managed to get it pretty much the same as that of parsec 2? > http://www.haskell.org/pipermail/haskell-cafe/2009-December/070196.html > > The main obstacle to applying the work seemed to be that the author was > worried about having made a fundamental data structure change in the > process of switching to CPS. > I've managed to convince myself that what I'm doing is good over here: http://panicsonic.blogspot.com/2009/12/adventures-in-parsec.html For what it's worth. Antoine From Axel.Simon at in.tum.de Thu Feb 18 03:54:45 2010 From: Axel.Simon at in.tum.de (Axel Simon) Date: Thu Feb 18 03:25:30 2010 Subject: Setup doesn't know Cabal's version Message-ID: <04A0D7AD-C802-472C-A248-82E19B8E4BBF@in.tum.de> Good morning, I'm currently migrating Gtk2hs to use Cabal to build. There is one issue that makes it really difficult to build Setup.hs files that work with several Cabal versions, namely that the version of Cabal itself is not passed to Setup.hs via CPP #defines. Thus, even though I can portably pre-process my Setup.hs scripts, I cannot reliably write code that works with Cabal 1.6 and 1.8. Am I missing something? Furthermore, I cannot build an executable that depends on the library being built in the same Cabal file. Is that intentional? Cheers, Axel. From anotheraddress at gmx.de Thu Feb 18 14:53:06 2010 From: anotheraddress at gmx.de (anotheraddress@gmx.de) Date: Thu Feb 18 14:53:08 2010 Subject: darcs patch: Monoid instance for Html Message-ID: <20100218195306.69DE8324305@www.haskell.org> Thu Feb 18 05:58:09 CET 2010 Daniel Schüssler * Monoid instance for Html Will unfortunately break packages which already define their own instance. Possibly useful for use with things such as HoleyMonoid, though. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/x-darcs-patch Size: 811 bytes Desc: A darcs patch for your repository! Url : http://www.haskell.org/pipermail/libraries/attachments/20100218/7924b901/attachment.bin From gwern0 at gmail.com Thu Feb 18 16:03:32 2010 From: gwern0 at gmail.com (Gwern Branwen) Date: Thu Feb 18 15:34:14 2010 Subject: darcs patch: Monoid instance for Html In-Reply-To: <20100218195306.69DE8324305@www.haskell.org> References: <20100218195306.69DE8324305@www.haskell.org> Message-ID: On Thu, Feb 18, 2010 at 2:53 PM, wrote: > Thu Feb 18 05:58:09 CET 2010 ?Daniel Sch?ssler > ?* Monoid instance for Html > ?Will unfortunately break packages which already define their own instance. Possibly useful for use with things such as HoleyMonoid, though. As far as I know, the only package which defined a Monoid instance for Html is 'haskell-ugly', and the current version of that may no longer do even that. So I don't think breakage is a concern. (The command I ran over all my local repos was 'find . -name "*.hs" -exec sh -c 'grep "instance Monoid Html where" {} && echo {}' \;') -- gwern From igloo at earth.li Sat Feb 20 09:58:18 2010 From: igloo at earth.li (Ian Lynagh) Date: Sat Feb 20 09:28:56 2010 Subject: darcs patch: Monoid instance for Html In-Reply-To: <20100218195306.69DE8324305@www.haskell.org> References: <20100218195306.69DE8324305@www.haskell.org> Message-ID: <20100220145818.GA21784@matrix.chaos.earth.li> On Thu, Feb 18, 2010 at 02:53:06PM -0500, anotheraddress@gmx.de wrote: > Thu Feb 18 05:58:09 CET 2010 Daniel Sch??ssler > * Monoid instance for Html > Will unfortunately break packages which already define their own instance. Possibly useful for use with things such as HoleyMonoid, though. html is currently unmaintained. If someone would like to take it over, let me know and I'll put you in the html group on community. Also, it would be nice if html and xhtml didn't needlessly diverge. The latter is maintained by Bjorn: http://hackage.haskell.org/package/xhtml Thanks Ian From marlowsd at gmail.com Wed Feb 24 04:58:40 2010 From: marlowsd at gmail.com (Simon Marlow) Date: Wed Feb 24 04:29:17 2010 Subject: Proposed addition to stm: atomicallyIO and afterCommit Message-ID: <4B84F850.7060901@gmail.com> John Lauchbury has proposed the following addition to Control.Concurrent.STM. John's proposal is below, comments welcome. Personally I'm in two minds about this. It certainly captures a useful idiom, but it fails the "don't name compositions" test, and one of the additions is just a renaming of 'return', which makes it hard to justify. Cheers, Simon ----- I find I often write STM code with the structure: do ... IO code ... v <- atomically $ do ... STM code ... if ..... then do ... STM code ... return (Left ...) else do ... STM code ... return (Right ...) case v of Left ... -> ... IO actions ... Right ... -> ... IO actions ... where I have to communicate the result of choices inside STM code to corresponding code in the outer IO monad. This means that two separate parts of the code have to be kept in sync. In this simple case it's merely irritating. With larger and more complex structures it can be quite tricky to keep right. Now I use the functions 'atomicallyIO' and 'afterCommit', and can structure the code as do ... IO code ... v <- atomicallyIO $ do ... STM code ... if ..... then do ... STM code ... afterCommit $ ... IO actions ... else do ... STM code ... afterCommit $ ... IO actions ... As you see, it allows the IO code to be placed in the appropriate part of the STM code, ready to be executed when that STM branch is committed. Here's the code to would be added to the STM module: ---------------------------------------------------------------------- -- 'atomicallyIO' and 'afterCommit' are useful syntactic sugar for a -- simple continuation paradigm. They allow IO code to be placed within -- the same block of STM code in which control decisions are made -- (avoiding the need to communicate those decisions with a data type -- sent to a subsequent matching case). atomicallyIO :: STM (IO a) -> IO a atomicallyIO ioSTM = join $ atomically ioSTM afterCommit :: IO a -> STM (IO a) afterCommit mIO = return mIO ---------------------------------------------------------------------- Obviously the code is very simple, but I still find it useful to name the paradigm, and to have the specific type declarations to catch errors. From marlowsd at gmail.com Wed Feb 24 05:07:07 2010 From: marlowsd at gmail.com (Simon Marlow) Date: Wed Feb 24 04:37:35 2010 Subject: Proposed addition to stm: atomicallyIO and afterCommit In-Reply-To: <4B84F850.7060901@gmail.com> References: <4B84F850.7060901@gmail.com> Message-ID: <4B84FA4B.9000408@gmail.com> Simon just pointed out to me that this is quite closely related, though more general: http://hackage.haskell.org/package/stm-io-hooks http://www.haskell.org/haskellwiki/New_monads/MonadAdvSTM Cheers, Simon On 24/02/2010 09:58, Simon Marlow wrote: > John Lauchbury has proposed the following addition to > Control.Concurrent.STM. John's proposal is below, comments welcome. > > Personally I'm in two minds about this. It certainly captures a useful > idiom, but it fails the "don't name compositions" test, and one of the > additions is just a renaming of 'return', which makes it hard to justify. > > Cheers, > Simon > > ----- > I find I often write STM code with the structure: > > do > ... IO code ... > v <- atomically $ do > ... STM code ... > if ..... > then do > ... STM code ... > return (Left ...) > else do > ... STM code ... > return (Right ...) > case v of > Left ... -> ... IO actions ... > Right ... -> ... IO actions ... > > where I have to communicate the result of choices inside STM code to > corresponding code in the outer IO monad. This means that two separate > parts of the code have to be kept in sync. In this simple case it's > merely irritating. With larger and more complex structures it can be > quite tricky to keep right. > > Now I use the functions 'atomicallyIO' and 'afterCommit', and can > structure the code as > > do > ... IO code ... > v <- atomicallyIO $ do > ... STM code ... > if ..... > then do > ... STM code ... > afterCommit $ ... IO actions ... > else do > ... STM code ... > afterCommit $ ... IO actions ... > > As you see, it allows the IO code to be placed in the appropriate part > of the STM code, ready to be executed when that STM branch is committed. > > Here's the code to would be added to the STM module: > > ---------------------------------------------------------------------- > -- 'atomicallyIO' and 'afterCommit' are useful syntactic sugar for a > -- simple continuation paradigm. They allow IO code to be placed within > -- the same block of STM code in which control decisions are made > -- (avoiding the need to communicate those decisions with a data type > -- sent to a subsequent matching case). > > atomicallyIO :: STM (IO a) -> IO a > atomicallyIO ioSTM = join $ atomically ioSTM > > afterCommit :: IO a -> STM (IO a) > afterCommit mIO = return mIO > ---------------------------------------------------------------------- > > Obviously the code is very simple, but I still find it useful to name > the paradigm, and to have the specific type declarations to catch errors. > From marcus at gabriel.name Wed Feb 24 07:10:38 2010 From: marcus at gabriel.name (Marcus D. Gabriel) Date: Wed Feb 24 06:41:05 2010 Subject: Text.PrettyPrint bug or doc bug Message-ID: <4B85173E.10308@gabriel.name> Hello, The documentation for Text.PrettyPrint.HughesPJ states that vcat is the "List version of $$", but it works as the list version ($+$). In the source code, this is because vcat = reduceAB . foldr (above_' True) empty instead of vcat = reduceAB . foldr (above_' False) empty So either the documentation needs to be changed or the code. It would be nice to have both versions. Cheers, - Marcus From gwern0 at gmail.com Wed Feb 24 15:23:59 2010 From: gwern0 at gmail.com (Gwern Branwen) Date: Wed Feb 24 14:54:26 2010 Subject: Status of nubOrd (Proposal #2629) In-Reply-To: <49a77b7a0810052107h5da08c00v8553aa16d219ea4d@mail.gmail.com> References: <200809300220.13140.dan.doel@gmail.com> <49a77b7a0810052107h5da08c00v8553aa16d219ea4d@mail.gmail.com> Message-ID: On Sun, Oct 5, 2008 at 11:07 PM, David Menendez wrote: > On Sat, Oct 4, 2008 at 3:26 AM, Bart Massey wrote: >> I need to know what the community wants me to do to close >> out my proposal to add nubOrd to the standard libraries. >> After ruling out a lot of marginal choices, I guess I see >> three leading alternatives, all of which have negatives. >> I'd love to have some feedback on these so I can start >> thinking about other things. > > I realize I'm coming into this discussion late, but has anyone > surveyed existing Haskell code to see how often nub is used? How many > of those cases require the specific functionality of nub, as opposed > to something like "Set.toList . Set.fromList"? I may be misjudging > things, but I can't imagine it's often enough to justify three or more > implementations in the standard library. > > If there are really a lot of cases where people need a collection that > (1) has no duplicates, and (2) preserves an arbitrary order of > elements, maybe we'd be better off designing a data structure > specifically for that. > > -- > Dave Menendez nub . sort (and the reverse) are very frequent. The attached sort.txt was produced by find bin/ -name "*.hs" -exec sh -c "grep sort {} | grep nub && echo {}" \; > sort.txt It's very crude and obviously produces lots of false positives & negatives, but even so, there's at least >50 uses of nub . sort etc. -- gwern -------------- next part -------------- fixFromChars op = case sort (nub (intersect op "+-*/<>")) of bin/timber/src/Fixity.hs transClose (c,(cs,ss)) = (c, sort (ss ++ nub(concat (map (selectors [c]) cs)))) bin/timber/src/Desugar1.hs fixFromChars op = case sort (nub (intersect op "+-*/<>")) of bin/timber/_darcs/pristine/src/Fixity.hs transClose (c,(cs,ss)) = (c, sort (ss ++ nub(concat (map (selectors [c]) cs)))) bin/timber/_darcs/pristine/src/Desugar1.hs import List (sort, nub) (nub . sort) flags == toFlags (fromFlags flags) bin/gtk2hs/_darcs/pristine/glib/System/Glib/Flags.hs import Data.List as List (nub, isPrefixOf, sortBy) bin/gtk2hs/_darcs/pristine/tools/apidiff/HiDiff.hs import List (sort, nub) (nub . sort) flags == toFlags (fromFlags flags) bin/gtk2hs/glib/System/Glib/Flags.hs import Data.List as List (nub, isPrefixOf, sortBy) bin/gtk2hs/tools/apidiff/HiDiff.hs import Data.List (nub,sort,sortBy,group,sort,intersperse,genericLength) bin/xmonad-bluetile/tests/Properties.hs prop_nubSort l = forAll (nubl l) $ \l0 -> sort (nub l0) == Nub.nubSort l0 bin/nub/NubTests.hs nubSort = map head . group . sort bin/nub/Nub.hs import Data.List (intersect, intersperse, intercalate, sort, nub, sortBy, isSuffixOf, find, isPrefixOf) bin/meta-gitit/MetaGitit/Serve.hs snub x = sort (nub x) bin/yhc/Make/Useful.hs contentions = nub (gc sortedNames) bin/yhc/tests/nofib/real/anna/LambdaLift5.hs = let typeVars = sort (nub (tcTvars_in texpr)) bin/yhc/tests/nofib/real/anna/TExpr2DExpr.hs -- sorted nub snub = map head . group . sort bin/yhc/src/libraries/core/Yhc/Core/FreeVar.hs snub, snubFst, snubUnder, smerge, sortFst, groupFst, foldl', {-# RULES "snub/sort" forall x . snub (sort x) = snub x #-} {-# RULES "sort/snub" forall x . sort (snub x) = snub x #-} -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) -- | sorted nub of list based on function of values snubUnder f = map head . groupUnder f . sortUnder f bin/yhc/src/interactive/GenUtil.hs tests = sort $ nub $ map (fst . fst) items dates = sort $ nub $ map (snd . fst) items bin/yhc/src/tester/Report.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toList (fromList xs)) bin/yhc/src/packages/yhc-base-1.0/Data/Set.hs import List(nub,sort) == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toList (fromList [(x,()) | x <- xs])]) bin/yhc/src/packages/yhc-base-1.0/Data/Map.hs import List(nub,groupBy,intersperse,sortBy) bin/yhc/src/compiler98/ReportImports.hs import Data.List((\\), partition, nubBy, sort) bin/djinn/_darcs/pristine/Djinn/MJ.hs import Data.List(sortBy, nub, intersperse) bin/djinn/_darcs/pristine/Djinn/Djinn.hs import Data.List((\\), partition, nubBy, sort) bin/djinn/Djinn/MJ.hs import Data.List(sortBy, nub, intersperse) bin/djinn/Djinn/Djinn.hs s ==? xs = invariant s && sort (toList s) == nub (sort xs) bin/quickcheck/examples/ExSet2.hs s ==? xs = invariant s && sort (toList s) == nub (sort xs) bin/quickcheck/examples/ExTrie.hs s ==? xs = invariant s && sort (toList s) == nub (sort xs) bin/quickcheck/examples/ExSet.hs s ==? xs = invariant s && sort (toList s) == nub (sort xs) bin/quickcheck/_darcs/pristine/examples/ExSet2.hs s ==? xs = invariant s && sort (toList s) == nub (sort xs) bin/quickcheck/_darcs/pristine/examples/ExTrie.hs s ==? xs = invariant s && sort (toList s) == nub (sort xs) bin/quickcheck/_darcs/pristine/examples/ExSet.hs import Sort ( msort, nub' ) bin/alex/src/DFA.hs `nub'' is an n.log(n) version of `nub' and `group_sort' sorts a list into nub' (<=) l = group_sort (<=) const l bin/alex/src/Sort.hs import Sort ( msort, nub' ) bin/alex/_darcs/pristine/src/DFA.hs `nub'' is an n.log(n) version of `nub' and `group_sort' sorts a list into nub' (<=) l = group_sort (<=) const l bin/alex/_darcs/pristine/src/Sort.hs snub, snubFst, sortFst, groupFst, -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) bin/pencilpond/GenUtil.hs snub, snubFst, sortFst, groupFst, -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) bin/pencilpond/_darcs/pristine/GenUtil.hs import Data.List (nub,sortBy) bin/cabal-install/parsec-2.1.0.1/Text/ParserCombinators/Parsec/Error.hs import Data.List (nub,sort) bin/cabal-install/parsec-2.1.0.1/Text/ParserCombinators/Parsec/Token.hs ( unfoldr, find, nub, sort ) (nub . sort . depends $ pkg) (nub . sort . depends $ pkg') bin/cabal-install/Distribution/Client/Install.hs import Data.List (groupBy, sortBy, nub, find, isInfixOf) bin/cabal-install/Distribution/Client/PackageIndex.hs ( sortBy, groupBy, sort, nub, intersperse, maximumBy ) else nub . sort $ installedVersions pkg bin/cabal-install/Distribution/Client/List.hs ( foldl', maximumBy, minimumBy, nub, sort, groupBy ) bin/cabal-install/Distribution/Client/Dependency/TopDown.hs ( unfoldr, find, nub, sort ) (nub . sort . depends $ pkg) (nub . sort . depends $ pkg') bin/cabal-install/_darcs/pristine/Distribution/Client/Install.hs import Data.List (groupBy, sortBy, nub, find, isInfixOf) bin/cabal-install/_darcs/pristine/Distribution/Client/PackageIndex.hs ( sortBy, groupBy, sort, nub, intersperse, maximumBy ) else nub . sort $ installedVersions pkg bin/cabal-install/_darcs/pristine/Distribution/Client/List.hs ( foldl', maximumBy, minimumBy, nub, sort, groupBy ) bin/cabal-install/_darcs/pristine/Distribution/Client/Dependency/TopDown.hs , groupBy, sortBy, find, isInfixOf, nubBy, deleteBy, deleteFirstsBy ) bin/cabal-install/Cabal-1.8.0.2/Distribution/Simple/PackageIndex.hs import Data.List ( nub, sort, isSuffixOf ) let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs)) bin/cabal-install/Cabal-1.8.0.2/Distribution/Simple/Hugs.hs import Data.List (sort, group, isPrefixOf, nub, find) bin/cabal-install/Cabal-1.8.0.2/Distribution/PackageDescription/Check.hs -- you supply for @x@ and @xs@ as they will be sorted and nubed anyway. We mkGConst x xs = GeniVal Nothing (Just . sort . nub $ x:xs) mkGVar x mxs = GeniVal (Just x) ((sort . nub) `fmap` mxs) bin/geni/src/NLP/GenI/GeniVal.hs -- you supply for @x@ and @xs@ as they will be sorted and nubed anyway. We mkGConst x xs = GeniVal Nothing (Just . sort . nub $ x:xs) mkGVar x mxs = GeniVal (Just x) ((sort . nub) `fmap` mxs) bin/geni/_darcs/pristine/src/NLP/GenI/GeniVal.hs import Data.List (intersperse, sort, sortBy, nub) , nub $ takeWhile (<= BC.length str) $ dropWhile (<0) $ map fromIntegral $ sort gs) bin/bio/Bio/Alignment/Test.hs import Data.List (nub,sort) where listElements = nub . sort . concatMap (\(_,x,y)->[x,y]) clusterElements = nub . sort . concatMap cE bin/bio/Bio/Clustering/Test.hs import Data.List (intersperse, sort, sortBy, nub) , nub $ takeWhile (<= BC.length str) $ dropWhile (<0) $ map fromIntegral $ sort gs) bin/bio/_darcs/pristine/Bio/Alignment/Test.hs import Data.List (nub,sort) where listElements = nub . sort . concatMap (\(_,x,y)->[x,y]) clusterElements = nub . sort . concatMap cE bin/bio/_darcs/pristine/Bio/Clustering/Test.hs import List (nub,sort) == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toAscList (fromList [(x,()) | x <- xs])]) bin/archive/buddha-1.2.1/libbuddha/IntMap.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toAscList (fromList xs)) bin/archive/buddha-1.2.1/libbuddha/IntSet.hs import qualified Data.List as List (sort, nub) , tcFreeVariables = List.sort $ List.nub vs bin/agda2/src/full/Agda/TypeChecking/Test/Generators.hs efficientNub xs =*= List.sort (List.nub xs) bin/agda2/src/prototyping/mixfix/Utilities.hs efficientNub xs =*= List.sort (List.nub xs) bin/agda2/src/prototyping/mixfix/benchmarks/PrecedenceGraph.hs xs' = List.sort $ List.nubBy ((==) `on` fst) xs bin/agda2/src/prototyping/eval/Data/Trie.hs import qualified Data.List as List (sort, nub) , tcFreeVariables = List.sort $ List.nub vs bin/agda2/_darcs/pristine/src/full/Agda/TypeChecking/Test/Generators.hs efficientNub xs =*= List.sort (List.nub xs) bin/agda2/_darcs/pristine/src/prototyping/mixfix/Utilities.hs efficientNub xs =*= List.sort (List.nub xs) bin/agda2/_darcs/pristine/src/prototyping/mixfix/benchmarks/PrecedenceGraph.hs xs' = List.sort $ List.nubBy ((==) `on` fst) xs bin/agda2/_darcs/pristine/src/prototyping/eval/Data/Trie.hs import qualified Data.List as List (sort, nub) , tcFreeVariables = List.sort $ List.nub vs bin/agda2/_darcs/pristine-old/src/full/Agda/TypeChecking/Test/Generators.hs efficientNub xs =*= List.sort (List.nub xs) bin/agda2/_darcs/pristine-old/src/prototyping/mixfix/Utilities.hs efficientNub xs =*= List.sort (List.nub xs) bin/agda2/_darcs/pristine-old/src/prototyping/mixfix/benchmarks/PrecedenceGraph.hs xs' = List.sort $ List.nubBy ((==) `on` fst) xs bin/agda2/_darcs/pristine-old/src/prototyping/eval/Data/Trie.hs import Data.List (foldl', intersperse, sortBy, groupBy, nub) bin/xmc-bluetile/XMonad/Util/EZConfig.hs import Data.List ( nub, sortBy, (\\) ) bin/xmc-bluetile/XMonad/Layout/WindowNavigation.hs import Data.List ( sort, nub ) mkXPrompt (Wor "") c (mkCompl $ sort $ nub ls) (sendMessage . JumpToLayout) bin/xmc-bluetile/XMonad/Prompt/Layout.hs seenTopics = nub $ sort $ M.keys (topicDirs tg) ++ M.keys (topicActions tg) bin/xmc-bluetile/XMonad/Actions/TopicSpace.hs import Data.List (nub,concat,sortBy) bin/xmc-bluetile/XMonad/Actions/TagWindows.hs import Data.List (foldl', sortBy, groupBy, nub) bin/xmc/XMonad/Util/EZConfig.hs import Data.List ( nub, sortBy, (\\) ) bin/xmc/XMonad/Layout/WindowNavigation.hs import Data.List ( sort, nub ) mkXPrompt (Wor "") c (mkComplFunFromList' $ sort $ nub ls) (sendMessage . JumpToLayout) bin/xmc/XMonad/Prompt/Layout.hs seenTopics = nub $ sort $ M.keys (topicDirs tg) ++ M.keys (topicActions tg) bin/xmc/XMonad/Actions/TopicSpace.hs import Data.List (nub,sortBy) bin/xmc/XMonad/Actions/TagWindows.hs import Data.List (foldl', sortBy, groupBy, nub) bin/xmc/_darcs/pristine/XMonad/Util/EZConfig.hs import Data.List ( nub, sortBy, (\\) ) bin/xmc/_darcs/pristine/XMonad/Layout/WindowNavigation.hs import Data.List ( sort, nub ) mkXPrompt (Wor "") c (mkComplFunFromList' $ sort $ nub ls) (sendMessage . JumpToLayout) bin/xmc/_darcs/pristine/XMonad/Prompt/Layout.hs seenTopics = nub $ sort $ M.keys (topicDirs tg) ++ M.keys (topicActions tg) bin/xmc/_darcs/pristine/XMonad/Actions/TopicSpace.hs import Data.List (nub,sortBy) bin/xmc/_darcs/pristine/XMonad/Actions/TagWindows.hs -> all (== (nub $ sort xx)) [ nub $ sort (y:ys) | (y, ys) <- eachAndOthers xx] bin/ddc/src/Util/Data/List/Select.hs -> all (== (nub $ sort xx)) [ nub $ sort (y:ys) | (y, ys) <- eachAndOthers xx] bin/ddc/_darcs/pristine/src/Util/Data/List/Select.hs import Data.List (sortBy, nub, sort, elemIndex) ((eitherOrEditor (comboSelectionEditor ((sort . nub) (map (display . pkgName) packages)) id bin/leksah/src/Graphics/UI/Editor/Composite.hs import Data.List (sort,nub,nubBy) (staticListEditor ((nub . sort) list) id) bin/leksah/src/IDE/ImportTool.hs import Data.List (foldl',nub,delete,sort) bin/leksah/src/IDE/Metainfo/SourceCollector.hs assertEqual (length . nub . sort $ map keyB bs) (length bs) assertEqual 1 (length . nub . sort $ bs') bin/yi/attic/testsuite/Tests/Buffer.hs import Data.List (partition, sort, nub) fromVtyEvent (EvKey Vty.KBackTab mods) = Event Yi.Event.KTab (sort $ nub $ Yi.Event.MShift : map fromVtyMod mods) bin/yi/src/Yi/UI/Vty.hs import Data.List (span, length, sort, nub, break, reverse, filter, takeWhile, dropWhile) indentToB $ chooseIndent currentIndent (sort $ nub $ indents) bin/yi/src/Yi/Buffer/Indent.hs import Data.List (sort, nub) shift (Event k ms) = Event k $ nub $ sort (MShift:ms) ctrl (Event k ms) = Event k $ nub $ sort (MCtrl:ms) meta (Event k ms) = Event k $ nub $ sort (MMeta:ms) super (Event k ms) = Event k $ nub $ sort (MSuper:ms) bin/yi/src/Yi/Keymap/Keys.hs import Data.List ( isPrefixOf, find, nubBy, sort, (\\) ) bin/yi/src/Shim/Hsinfo.hs import Data.List (nub,sortBy) bin/hat/src/lib/Text/ParserCombinators/Parsec/Error.hs import Data.List (nub,sort) bin/hat/src/lib/Text/ParserCombinators/Parsec/Token.hs import List(nub,groupBy,intersperse,sortBy) bin/hat/src/compiler98/ReportImports.hs import Data.List (nub,sortBy) bin/hat/_darcs/pristine/src/lib/Text/ParserCombinators/Parsec/Error.hs import Data.List (nub,sort) bin/hat/_darcs/pristine/src/lib/Text/ParserCombinators/Parsec/Token.hs import List(nub,groupBy,intersperse,sortBy) bin/hat/_darcs/pristine/src/compiler98/ReportImports.hs snub, snubFst, sortFst, groupFst, foldl', -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) bin/riot-1ds-20080618/Ginsu/GenUtil.hs prop_span3 dist ps = length ps > 1 ==> sort (nub ps) == sort (nub qs) bin/wired/_darcs/pristine/Data/Hardware/Internal.hs prop_span3 dist ps = length ps > 1 ==> sort (nub ps) == sort (nub qs) bin/wired/Data/Hardware/Internal.hs import Data.List -- (nub, sort) bin/haskell/hcorpus/hcorpus.hs import Data.List -- (nub, sort) let knownwords = nub $ sort ["You", "dont", "see", "more", "than", "that", "The", "first", "episode", "of", "Kare", "Kano", "is", "rotten", "with", "Evangelion", "visual", "motifs", "the", "trains", "the", "spotlights", "and", "telephone", "poles", "and", "wires", "the", "masks", "and", "this", "is", "how", "everyone", "sees", "me", "etc", "And", "later", "there", "are", "some", "even", "more", "obvious", "borrowings"] uniquefy = nub . sort . concat -- be much more efficient than doing something like 'nub $ sort $ map take n $ Data.List.permutations xs'. bin/haskell/hcorpus/hcorpus-slow.hs sort = nub . List.sort bin/edison/test/src/Data/Edison/Test/Set.hs b = L.sort (L.nub (keysList xs ++ keysList ys)) bin/edison/test/src/Data/Edison/Test/FM.hs sort = nub . List.sort bin/edison/_darcs/pristine/test/src/Data/Edison/Test/Set.hs b = L.sort (L.nub (keysList xs ++ keysList ys)) bin/edison/_darcs/pristine/test/src/Data/Edison/Test/FM.hs ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" ["after","append","AppleScript","argv","argc","array","auto_execk","auto_load","auto_mkindex","auto_path","auto_reset","beep","bell","binary","bind","bindtags","bgerror","break","button","canvas","case","catch","cd","checkbutton","clipboard","clock","close","concat","console","continue","dde","destroy","else","elseif","encoding","entry","env","eof","error","errorCode","errorInfo","eval","event","exec","exit","expr","fblocked","fconfigure","fcopy","file","fileevent","flush","focus","font","for","foreach","format","frame","gets","glob","global","grab","grid","history","if","image","incr","info","interp","join","label","lappend","lindex","linsert","list","listbox","llength","load","lower","lrange","lreplace","lsearch","lsort","menu","menubutton","message","namespace","open","option","OptProc","pack","package","parray","pid","place","pkg_mkindex","proc","puts","pwd","radiobutton","raise","read","regexp","registry","regsub","rename","resource","return","scale","scan","scrollbar","seek","selection","send","set","socket","source","split","string","subst","switch","tclLog","tcl_endOfWord","tcl_findLibrary","tcl_library","tcl_patchLevel","tcl_platform","tcl_precision","tcl_rcFileName","tcl_rcRsrcName","tcl_startOfNextWord","tcl_startOfPreviousWord","tcl_traceCompile","tcl_traceExec","tcl_version","tcl_wordBreakAfter","tcl_wordBreakBefore","tell","text","time","tk","tkTabToWindow","tkwait","tk_chooseColor","tk_chooseDirectory","tk_focusFollowMouse","tk_focusNext","tk_focusPrev","tk_getOpenFile","tk_getSaveFile","tk_library","tk_messageBox","tk_optionMenu","tk_patchLevel","tk_popup","tk_strictMotif","tk_version","toplevel","trace","unknown","unset","update","uplevel","upvar","variable","vwait","while","winfo","wm"] >>= withAttribute "Keyword")) bin/highlighting-kate/Text/Highlighting/Kate/Syntax/Tcl.hs ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" ["above","action","alinkColor","alert","anchor","anchors","appCodeName","applets","apply","appName","appVersion","argument","arguments","arity","availHeight","availWidth","back","background","below","bgColor","border","big","blink","blur","bold","border","call","caller","charAt","charCodeAt","checked","clearInterval","clearTimeout","click","clip","close","closed","colorDepth","complete","compile","constructor","confirm","cookie","current","cursor","data","defaultChecked","defaultSelected","defaultStatus","defaultValue","description","disableExternalCapture","domain","elements","embeds","enabledPlugin","enableExternalCapture","encoding","eval","exec","fgColor","filename","find","fixed","focus","fontcolor","fontsize","form","forms","formName","forward","frames","fromCharCode","getDate","getDay","getHours","getMiliseconds","getMinutes","getMonth","getSeconds","getSelection","getTime","getTimezoneOffset","getUTCDate","getUTCDay","getUTCFullYear","getUTCHours","getUTCMilliseconds","getUTCMinutes","getUTCMonth","getUTCSeconds","getYear","global","go","hash","height","history","home","host","hostname","href","hspace","ignoreCase","images","index","indexOf","innerHeight","innerWidth","input","italics","javaEnabled","join","language","lastIndex","lastIndexOf","lastModified","lastParen","layers","layerX","layerY","left","leftContext","length","link","linkColor","links","location","locationbar","load","lowsrc","match","MAX_VALUE","menubar","method","mimeTypes","MIN_VALUE","modifiers","moveAbove","moveBelow","moveBy","moveTo","moveToAbsolute","multiline","name","NaN","NEGATIVE_INFINITY","negative_infinity","next","open","opener","options","outerHeight","outerWidth","pageX","pageY","pageXoffset","pageYoffset","parent","parse","pathname","personalbar","pixelDepth","platform","plugins","pop","port","POSITIVE_INFINITY","positive_infinity","preference","previous","print","prompt","protocol","prototype","push","referrer","refresh","releaseEvents","reload","replace","reset","resizeBy","resizeTo","reverse","rightContext","screenX","screenY","scroll","scrollbar","scrollBy","scrollTo","search","select","selected","selectedIndex","self","setDate","setHours","setMinutes","setMonth","setSeconds","setTime","setTimeout","setUTCDate","setUTCDay","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear","shift","siblingAbove","siblingBelow","small","sort","source","splice","split","src","status","statusbar","strike","sub","submit","substr","substring","suffixes","sup","taintEnabled","target","test","text","title","toGMTString","toLocaleString","toLowerCase","toolbar","toSource","toString","top","toUpperCase","toUTCString","type","URL","unshift","unwatch","userAgent","UTC","value","valueOf","visibility","vlinkColor","vspace","width","watch","which","width","write","writeln","x","y","zIndex"] >>= withAttribute "Data Type")) bin/highlighting-kate/Text/Highlighting/Kate/Syntax/Javascript.hs ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" ["after","append","AppleScript","argv","argc","array","auto_execk","auto_load","auto_mkindex","auto_path","auto_reset","beep","bell","binary","bind","bindtags","bgerror","break","button","canvas","case","catch","cd","checkbutton","clipboard","clock","close","concat","console","continue","dde","destroy","else","elseif","encoding","entry","env","eof","error","errorCode","errorInfo","eval","event","exec","exit","expr","fblocked","fconfigure","fcopy","file","fileevent","flush","focus","font","for","foreach","format","frame","gets","glob","global","grab","grid","history","if","image","incr","info","interp","join","label","lappend","lindex","linsert","list","listbox","llength","load","lower","lrange","lreplace","lsearch","lsort","menu","menubutton","message","namespace","open","option","OptProc","pack","package","parray","pid","place","pkg_mkindex","proc","puts","pwd","radiobutton","raise","read","regexp","registry","regsub","rename","resource","return","scale","scan","scrollbar","seek","selection","send","set","socket","source","split","string","subst","switch","tclLog","tcl_endOfWord","tcl_findLibrary","tcl_library","tcl_patchLevel","tcl_platform","tcl_precision","tcl_rcFileName","tcl_rcRsrcName","tcl_startOfNextWord","tcl_startOfPreviousWord","tcl_traceCompile","tcl_traceExec","tcl_version","tcl_wordBreakAfter","tcl_wordBreakBefore","tell","text","time","tk","tkTabToWindow","tkwait","tk_chooseColor","tk_chooseDirectory","tk_focusFollowMouse","tk_focusNext","tk_focusPrev","tk_getOpenFile","tk_getSaveFile","tk_library","tk_messageBox","tk_optionMenu","tk_patchLevel","tk_popup","tk_strictMotif","tk_version","toplevel","trace","unknown","unset","update","uplevel","upvar","variable","vwait","while","winfo","wm"] >>= withAttribute "Keyword")) bin/highlighting-kate/_darcs/pristine/Text/Highlighting/Kate/Syntax/Tcl.hs ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" ["above","action","alinkColor","alert","anchor","anchors","appCodeName","applets","apply","appName","appVersion","argument","arguments","arity","availHeight","availWidth","back","background","below","bgColor","border","big","blink","blur","bold","border","call","caller","charAt","charCodeAt","checked","clearInterval","clearTimeout","click","clip","close","closed","colorDepth","complete","compile","constructor","confirm","cookie","current","cursor","data","defaultChecked","defaultSelected","defaultStatus","defaultValue","description","disableExternalCapture","domain","elements","embeds","enabledPlugin","enableExternalCapture","encoding","eval","exec","fgColor","filename","find","fixed","focus","fontcolor","fontsize","form","forms","formName","forward","frames","fromCharCode","getDate","getDay","getHours","getMiliseconds","getMinutes","getMonth","getSeconds","getSelection","getTime","getTimezoneOffset","getUTCDate","getUTCDay","getUTCFullYear","getUTCHours","getUTCMilliseconds","getUTCMinutes","getUTCMonth","getUTCSeconds","getYear","global","go","hash","height","history","home","host","hostname","href","hspace","ignoreCase","images","index","indexOf","innerHeight","innerWidth","input","italics","javaEnabled","join","language","lastIndex","lastIndexOf","lastModified","lastParen","layers","layerX","layerY","left","leftContext","length","link","linkColor","links","location","locationbar","load","lowsrc","match","MAX_VALUE","menubar","method","mimeTypes","MIN_VALUE","modifiers","moveAbove","moveBelow","moveBy","moveTo","moveToAbsolute","multiline","name","NaN","NEGATIVE_INFINITY","negative_infinity","next","open","opener","options","outerHeight","outerWidth","pageX","pageY","pageXoffset","pageYoffset","parent","parse","pathname","personalbar","pixelDepth","platform","plugins","pop","port","POSITIVE_INFINITY","positive_infinity","preference","previous","print","prompt","protocol","prototype","push","referrer","refresh","releaseEvents","reload","replace","reset","resizeBy","resizeTo","reverse","rightContext","screenX","screenY","scroll","scrollbar","scrollBy","scrollTo","search","select","selected","selectedIndex","self","setDate","setHours","setMinutes","setMonth","setSeconds","setTime","setTimeout","setUTCDate","setUTCDay","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear","shift","siblingAbove","siblingBelow","small","sort","source","splice","split","src","status","statusbar","strike","sub","submit","substr","substring","suffixes","sup","taintEnabled","target","test","text","title","toGMTString","toLocaleString","toLowerCase","toolbar","toSource","toString","top","toUpperCase","toUTCString","type","URL","unshift","unwatch","userAgent","UTC","value","valueOf","visibility","vlinkColor","vspace","width","watch","which","width","write","writeln","x","y","zIndex"] >>= withAttribute "Data Type")) bin/highlighting-kate/_darcs/pristine/Text/Highlighting/Kate/Syntax/Javascript.hs import List(sort,nub) let prop_list x xs = sort (List.delete x $ nub xs) == toList p where bin/jhc/src/selftest/SelfTest.hs snub, snubFst, snubUnder, smerge, sortFst, groupFst, foldl', {-# RULES "snub/sort" forall x . snub (sort x) = snub x #-} {-# RULES "sort/snub" forall x . sort (snub x) = snub x #-} -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) -- | sorted nub of list based on function of values snubUnder f = map head . groupUnder f . sortUnder f bin/jhc/src/GenUtil.hs == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toAscList (fromList [(x,()) | x <- xs])]) bin/jhc/src/Util/IntBag.hs | all (== r) rs = ARules (fvsa `mappend` fvsb) (sortUnder (\r -> (ruleNArgs r,ruleUniq r)) (snubUnder ruleUniq $ a ++ b)) bin/jhc/src/E/Rules.hs collectUsedFuncs (as :-> exp) = (snub $ concatMap tagToFunction (Seq.toList iu),sort $ Seq.toList du) where bin/jhc/src/Grin/Simplify.hs import Data.List (intersperse, sortBy, groupBy, nub, maximumBy) bin/hackage-server/Distribution/Server/Pages/Index.hs import Data.List (intersperse, sortBy, groupBy, nub, maximumBy) bin/hackage-server/_darcs/pristine/Distribution/Server/Pages/Index.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toList (fromList xs)) bin/ehc/src/lvm/Common/Set.hs import List (sortBy, sort, partition, union, nub) bin/ehc/src/helium/StaticAnalysis/Messages/Messages.hs -- group/sort/nub combi's bin/ehc/src/libutil/EH/Util/Utils.hs . nub . sort . concat in sortBy (cmpByVersionOrder vo) . nub . sort $ all = let allN = nub . sort . concat $ vo = map (\p@((v,_):_) -> (ixOf v,map ixOf . nub . sort . (v:) . concat . map snd $ p)) in sortBy (cmpByVersionOrder vo) . nub . sort $ allN' availVersions = nub . sort . map vciVer $ nonPre bin/ehc/build/shuffle/MainAG.hs raltLPatNms = nub . sort . map (rcpPNm . rcaPat) bin/ehc/build/101/lib-ehc/EH101/Core.hs import Data.List( (\\), sort, intercalate, nub, intersperse ) bin/hashed-storage/Storage/Hashed/Test.hs con = sort $ nub [(c,v) | TApp (TLit c) xs <- a, x <- xs, v <- variables x, v `elem` vs] bin/hoogle/src/Hoogle/DataBase/Instances.hs normAliases as t = first (sort . nub) $ f t bin/hoogle/src/Hoogle/DataBase/Aliases.hs con = sort $ nub [(c,v) | TApp (TLit c) xs <- a, x <- xs, v <- variables x, v `elem` vs] bin/hoogle/_darcs/pristine/src/Hoogle/DataBase/Instances.hs normAliases as t = first (sort . nub) $ f t bin/hoogle/_darcs/pristine/src/Hoogle/DataBase/Aliases.hs import Data.List (nub,sort,sortBy,group,sort,intersperse,genericLength) bin/xmonad/tests/Properties.hs import Data.List (nub,sort,sortBy,group,sort,intersperse,genericLength) bin/xmonad/_darcs/pristine/tests/Properties.hs Key.nub fst (Key.sort fst (allIntEquations (permute [1,5,6,7]))) bin/htam/src/Riddle/Equation.hs import Data.List (genericIndex, sort, nub, ) Key.nub fst . sort nub . sort nub . sort bin/htam/src/Test/Combinatorics.hs Key.nub fst (Key.sort fst (allIntEquations (permute [1,5,6,7]))) bin/htam/_darcs/pristine/src/Riddle/Equation.hs import Data.List (genericIndex, sort, nub, ) Key.nub fst . sort nub . sort nub . sort bin/htam/_darcs/pristine/src/Test/Combinatorics.hs snub, snubFst, sortFst, groupFst, foldl', -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) bin/drift/src/GenUtil.hs import List (nub,sortBy) bin/drift/src/Rules/Xml.hs snub, snubFst, sortFst, groupFst, foldl', -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) bin/drift/_darcs/pristine/src/GenUtil.hs import List (nub,sortBy) bin/drift/_darcs/pristine/src/Rules/Xml.hs snub, snubFst, sortFst, groupFst, foldl', -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub = map head . group . sort -- | sorted nub of list of tuples, based solely on the first element of each tuple. snubFst = map head . groupBy (\(x,_) (y,_) -> x == y) . sortBy (\(x,_) (y,_) -> compare x y) bin/drift/_darcs/pristine-old/src/GenUtil.hs import List (nub,sortBy) bin/drift/_darcs/pristine-old/src/Rules/Xml.hs module Darcs.Utils ( catchall, ortryrunning, nubsort, breakCommand, nubsort :: Ord a => [a] -> [a] nubsort = map head . group . sort bin/darcs/src/Darcs/Utils.hs import Darcs.Utils ( nubsort ) nubsort $ concatMap nonTouches x ++ listTouchedFiles c ++ nonTouches p nubsort $ concatMap nonTouches x ++ listTouchedFiles c ++ nonTouches p bin/darcs/src/Darcs/Patch/Real.hs import Darcs.Utils ( promptYorn, catchall, withCurrentDirectory, withUMask, nubsort ) case nubsort $ listTouchedFiles $ resolved_pw of bin/darcs/src/Darcs/Repository/Internal.hs nubsort [e1 | e <- exps, Right e1 <- [checkExpr pgf e ty]] bin/gf/src/runtime/haskell/PGF/Parse.hs import Data.List (nub,sort,group) bin/gf/src/runtime/haskell/PGF/Paraphrase.hs import Data.List (intersperse,nub,isPrefixOf,sort,sortBy) bin/gf/src/runtime/haskell/PGF/VisualizeTree.hs import Data.List (sortBy,nub) bin/gf/src/compiler/GF/Grammar/Macros.hs import Data.List (nub,sortBy) bin/gf/src/compiler/GF/Grammar/Lookup.hs if null end then return (nub (sort ws)) else do bin/gf/src/compiler/GF/Compile/ExampleBased.hs nubsort, union, nubsort :: Ord a => [a] -> SList a nubsort = union . map return bin/gf/src/compiler/GF/Data/SortedList.hs import Data.List (nub, sortBy, sort, deleteBy, nubBy) bin/gf/src/compiler/GF/Data/Operations.hs -- | Like 'nub', but more efficient as it uses sorting internally. -- | Like 'nubBy', but more efficient as it uses sorting internally. bin/gf/src/compiler/GF/Data/Utilities.hs anames = sort $ nub $ map paccount ps bin/hledger/Ledger/Journal.hs anames = sort $ nub $ map paccount ps bin/hledger/Commands/Register.hs import Data.List (sort, sortBy, nub) let allVersionsUsed = nub (sort (versionsUsed vr1 ++ versionsUsed vr2)) bin/cabal/tests/Test/Distribution/Version.hs , groupBy, sortBy, find, isInfixOf, nubBy, deleteBy, deleteFirstsBy ) bin/cabal/Distribution/Simple/PackageIndex.hs import Data.List ( nub, sort, isSuffixOf ) let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs)) bin/cabal/Distribution/Simple/Hugs.hs import Data.List (sort, group, isPrefixOf, nub, find) bin/cabal/Distribution/PackageDescription/Check.hs import Data.List (sort, sortBy, nub) let allVersionsUsed = nub (sort (versionsUsed vr1 ++ versionsUsed vr2)) bin/cabal/_darcs/pristine/tests/Test/Distribution/Version.hs , groupBy, sortBy, find, isInfixOf, nubBy, deleteBy, deleteFirstsBy ) bin/cabal/_darcs/pristine/Distribution/Simple/PackageIndex.hs import Data.List ( nub, sort, isSuffixOf ) let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs)) bin/cabal/_darcs/pristine/Distribution/Simple/Hugs.hs import Data.List (sort, group, isPrefixOf, nub, find) bin/cabal/_darcs/pristine/Distribution/PackageDescription/Check.hs stPath d v sts = sort $ nub $ (concat $ map (ndfadestinationsFrom d v) sts) ++ sts bin/pure/software/haskell/libraries/Language/HaLex/Ndfa.hs stPath d v sts = sort $ nub $ bin/pure/software/haskell/libraries/Language/HaLex/Dfa.hs import List (nub, intersperse, partition, sort,sort,group) precLevels cf = sort $ nub $ [ precCat c | c <- allCats cf] bin/bnfc/CF.hs import List (nub, intersperse, partition, sort,sort,group) precLevels cf = sort $ nub $ [ precCat c | c <- allCats cf] bin/bnfc/_darcs/pristine/CF.hs import List (nub, intersperse, partition, sort,sort,group) precLevels cf = sort $ nub $ [ precCat c | c <- allCats cf] bin/bnfc/_darcs/pristine-old/CF.hs import Data.List (intersperse,sortBy,partition,nub) bin/xml2x/src/Xml2X.hs import Data.List (intersperse,sortBy,partition,nub) bin/xml2x/_darcs/pristine/src/Xml2X.hs import List (elemIndex, sort, nub) valid xs = is 'a' $ nub $ sort xs bin/lcs/_darcs/pristine/testsuite/Test.hs import List (elemIndex, sort, nub) valid xs = is 'a' $ nub $ sort xs bin/lcs/testsuite/Test.hs import Data.List (sort,nub,group,intersperse) bin/xmonad-fork/tests/StackProperties.hs import Data.List (sort,nub,group,intersperse) bin/xmonad-fork/tests/NestedStackProperties.hs import Data.List (nub,sort,sortBy,group,sort,intersperse,genericLength) bin/xmonad-fork/tests/Properties.hs import Data.List ( nub, sortBy, (\\) ) bin/xmonad-fork/XMonad/Layout/WindowNavigation.hs import Data.List (nub, sortBy, partition) bin/hackage-scripts/SearchAlgorithm.hs import Data.List (nub, sortBy, partition) bin/hackage-scripts/_darcs/pristine/SearchAlgorithm.hs periods = sort $ nub $ map sysPeriod systems bin/atom/Atom/Scheduling.hs periods = sort $ nub $ map sysPeriod systems bin/atom/_darcs/pristine/Atom/Scheduling.hs import Data.List (intersect, nub, sort, isPrefixOf, isInfixOf) bin/filestore-pt/Data/FileStore/Darcs.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toList (fromList xs)) bin/heliumsystem/lvm/src/lib/common/Set.hs import List (nub,sortBy) bin/heliumsystem/lvm/src/lib/parsec/ParsecError.hs import List (nub, intersperse, sort, partition) bin/heliumsystem/helium/src/staticanalysis/messages/StaticErrors.hs import Data.List (nub,sort,sortBy,group,sort,intersperse,genericLength) bin/xmonad-monoid/tests/Properties.hs import Data.List (nub,sort,sortBy,group,sort,intersperse,genericLength) bin/xmonad-monoid/_darcs/pristine/tests/Properties.hs , sortBy, mapAccumL, nub ) bin/citeproc-hs/src/Text/CSL/Proc.hs import Data.List(transpose,nub,maximumBy,genericLength,elemIndex, genericTake, sort) bin/easyvision/cabal/vision/lib/Vision/Camera.hs import Data.List(sortBy, sort, nub, elemIndex, intersperse, transpose, partition, delete) bin/easyvision/cabal/patrec/lib/Classifier/Simple.hs import Data.List(sortBy, sort, nub, elemIndex, intersperse, transpose, partition, delete) ls = sort $ nub $ map snd l bin/easyvision/cabal/patrec/lib/Classifier/Base.hs import Data.List(sort,nub,sortBy,minimumBy) print (sort $ nub $ map snd okclasses) bin/easyvision/cabal/ev/lib/EasyVision/MiniApps.hs import Data.List(sort,nub,sortBy,minimumBy) bin/easyvision/cabal/ev/lib/EasyVision/MiniApps/PoseTracker.hs import Data.List(transpose,nub,maximumBy,genericLength,elemIndex, genericTake, sort) bin/easyvision/_darcs/pristine/cabal/vision/lib/Vision/Camera.hs import Data.List(sortBy, sort, nub, elemIndex, intersperse, transpose, partition, delete) bin/easyvision/_darcs/pristine/cabal/patrec/lib/Classifier/Simple.hs import Data.List(sortBy, sort, nub, elemIndex, intersperse, transpose, partition, delete) ls = sort $ nub $ map snd l bin/easyvision/_darcs/pristine/cabal/patrec/lib/Classifier/Base.hs import Data.List(sort,nub,sortBy,minimumBy) print (sort $ nub $ map snd okclasses) bin/easyvision/_darcs/pristine/cabal/ev/lib/EasyVision/MiniApps.hs import Data.List(sort,nub,sortBy,minimumBy) bin/easyvision/_darcs/pristine/cabal/ev/lib/EasyVision/MiniApps/PoseTracker.hs lines, nub, partition, sortBy, unlines, words, break, lookup, tail, bin/seereason/autobuilder/Debian/AutoBuilder/Target.hs lines, nub, partition, sortBy, unlines, words, break, lookup, tail, bin/seereason/autobuilder/_darcs/pristine/Debian/AutoBuilder/Target.hs import Data.List (intercalate, nub, sort) intercalate "\n " (nub (sort (map (format . sourcePackageID) deps))))) bin/seereason/haskell-debian-3/_darcs/pristine/demos/DependsOn.hs import Data.List (intercalate, nub, sort) intercalate "\n " (nub (sort (map (format . sourcePackageID) deps))))) bin/seereason/haskell-debian-3/demos/DependsOn.hs nubOn selector list = map head $ groupBy ((==) `on` selector) $ sortBy (compare `on` selector) list bin/seereason/backups/System/Archive/AptMethods.hs nubOn selector list = map head $ groupBy ((==) `on` selector) $ sortBy (compare `on` selector) list bin/seereason/backups/_darcs/pristine/System/Archive/AptMethods.hs nub' = map head . group . sort bin/seereason/mirror/Debian/Mirror/Dist.hs nub' = map head . group . sort bin/seereason/mirror/_darcs/pristine/Debian/Mirror/Dist.hs import List (nub,sort) == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toAscList (fromList [(x,()) | x <- xs])]) bin/ghc/libraries/containers/Data/IntMap.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toList (fromList xs)) bin/ghc/libraries/containers/Data/Set.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toAscList (fromList xs)) bin/ghc/libraries/containers/Data/IntSet.hs import List(nub,sort) == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toList (fromList [(x,()) | x <- xs])]) bin/ghc/libraries/containers/Data/Map.hs import Data.List (sort, sortBy, nub) let allVersionsUsed = nub (sort (versionsUsed vr1 ++ versionsUsed vr2)) bin/ghc/libraries/Cabal/tests/Test/Distribution/Version.hs , groupBy, sortBy, find, isInfixOf, nubBy, deleteBy, deleteFirstsBy ) bin/ghc/libraries/Cabal/Distribution/Simple/PackageIndex.hs import Data.List ( nub, sort, isSuffixOf ) let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs)) bin/ghc/libraries/Cabal/Distribution/Simple/Hugs.hs import Data.List (sort, group, isPrefixOf, nub, find) bin/ghc/libraries/Cabal/Distribution/PackageDescription/Check.hs free = sort $ nub [x | x <- lexs, length x == 1, all isAlpha x] bin/ghc/libraries/filepath/test/GenTests.hs getLabels = sort . nub . filter is_interesting_label bin/ghc/utils/debugNCG/Diff_Gcc_Nat.hs nubBy ((==) `on` wayName) $ unsorted bin/ghc/compiler/main/StaticFlags.hs ordered = sortAssocs . nubAssocs bin/blas/tests/Vector.hs ordered = sortAssocs . nubAssocs bin/blas/tests/Banded.hs ordered = sortAssocs . nubAssocs bin/blas/tests/Matrix.hs ordered = sortAssocs . nubAssocs bin/blas/_darcs/pristine/tests/Vector.hs ordered = sortAssocs . nubAssocs bin/blas/_darcs/pristine/tests/Banded.hs ordered = sortAssocs . nubAssocs bin/blas/_darcs/pristine/tests/Matrix.hs dataDeclFields = sort . nub . filter (not . null) . map fst . concatMap ctorDeclFields . dataDeclCtors bin/derive/Language/Haskell.hs dataDeclFields = sort . nub . filter (not . null) . map fst . concatMap ctorDeclFields . dataDeclCtors bin/derive/_darcs/pristine/Language/Haskell.hs sort, (\\), nub ) bin/shim/Shim/Hsinfo.hs sort, (\\), nub ) bin/shim/_darcs/pristine/Shim/Hsinfo.hs import Data.List ( nub, transpose, sort ) bin/chart/Graphics/Rendering/Chart/Renderable.hs mxs = nub $ sort $ map mapX xs bin/chart/Graphics/Rendering/Chart/Plot.hs import Data.List(sort,nub) bin/chart/tests/darcs_usage.hs import Data.List(sort,nub,scanl1) bin/chart/tests/test.hs import Data.List ( nub, transpose, sort ) bin/chart/_darcs/pristine/Graphics/Rendering/Chart/Renderable.hs mxs = nub $ sort $ map mapX xs bin/chart/_darcs/pristine/Graphics/Rendering/Chart/Plot.hs import Data.List(sort,nub) bin/chart/_darcs/pristine/tests/darcs_usage.hs import Data.List(sort,nub,scanl1) bin/chart/_darcs/pristine/tests/test.hs import List (nub,sort) == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toAscList (fromList [(x,()) | x <- xs])]) bin/lhc/lib/containers-0.2.0.1/Data/IntMap.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toList (fromList xs)) bin/lhc/lib/containers-0.2.0.1/Data/Set.hs import List (nub,sort) == List.sort ((List.\\) (nub xs) (nub ys)) == List.sort (nub ((List.intersect) (xs) (ys))) = (sort (nub xs) == toAscList (fromList xs)) bin/lhc/lib/containers-0.2.0.1/Data/IntSet.hs import List(nub,sort) == List.sort ((List.\\) (nub (Prelude.map fst xs)) (nub (Prelude.map fst ys))) == List.sort (nub ((List.intersect) (Prelude.map fst xs) (Prelude.map fst ys))) = (sort (nub xs) == [x | (x,()) <- toList (fromList [(x,()) | x <- xs])]) bin/lhc/lib/containers-0.2.0.1/Data/Map.hs import Data.List(nub, nubBy, (\\), find, sort, sortBy, group, groupBy) bin/graphalyze/_darcs/pristine/Data/Graph/Analysis/Utils.hs import Data.List(nub, nubBy, (\\), find, sort, sortBy, group, groupBy) bin/graphalyze/Data/Graph/Analysis/Utils.hs let nub = map head . group . sort bin/maak/hssrc/Export.hs import Data.List (intersperse, nub, sortBy, find, isPrefixOf, inits, sort) liftM (nub . sort . concat) $ bin/gitit/Network/Gitit/Handlers.hs import Data.List (intercalate, sortBy, nub) -- TODO: 'nub . sort' `persons` - but no Eq or Ord instances! persons = map authorToPerson $ nub $ sortBy (comparing authorName) $ map revAuthor revs bin/gitit/Network/Gitit/Feed.hs nub . sort . concat <$> traverse exts mods allModules xs = nub . sort . concat <$> (traverse (fmap unM . dep) =<< localModules xs) nub . sort . concat . (mods:) <$> traverse depLocalTrans mods nub . sort . concat . (ms:) <$> traverse depLocalTrans ms bin/hbuild/Make/RulesIO.hs import Data.List (nub, sort) bin/hbuild/Make/Rules.hs nub . sort . concat <$> traverse exts mods allModules = memoPure1 "allModules" $ nub . sort . concat <$> (traverse dep =<< localModules) nub . sort . concat . (mods:) <$> traverse depLocalTrans mods nub . sort . concat . (ms:) <$> traverse depLocalTrans ms bin/hbuild/Make/Rules/Dyn.hs free = sort $ nub [x | x <- lexs, length x == 1, all isAlpha x] bin/filepath/test/GenTests.hs free = sort $ nub [x | x <- lexs, length x == 1, all isAlpha x] bin/filepath/_darcs/pristine/test/GenTests.hs f xs = filter (`Map.member` mp) $ sort $ nub $ xs ++ new bin/tagsoup/TagSoup/Generate/Supercompile.hs f xs = filter (`Map.member` mp) $ sort $ nub $ xs ++ new bin/tagsoup/_darcs/pristine/TagSoup/Generate/Supercompile.hs From gwern0 at gmail.com Wed Feb 24 20:31:53 2010 From: gwern0 at gmail.com (Gwern Branwen) Date: Wed Feb 24 20:02:17 2010 Subject: Status of nubOrd (Proposal #2629) In-Reply-To: <201002242139.o1OLdLii008595@murzim.cs.pdx.edu> References: <200809300220.13140.dan.doel@gmail.com> <49a77b7a0810052107h5da08c00v8553aa16d219ea4d@mail.gmail.com> <201002242139.o1OLdLii008595@murzim.cs.pdx.edu> Message-ID: On Wed, Feb 24, 2010 at 4:39 PM, Barton C Massey wrote: > I think in the end everyone agreed that putting nubOrd in > Data.Set (and nubInt in Data.IntSet?) would be a good thing. > I just never got it done; I was burned out by the process, > and I really struggled with getting Darcs to produce a > reasonable-sized patch that could be submitted. That sounds odd. You ask for help in #darcs? > I'll pick it up again if folks want, or someone else can. > I've attached a nubOrd patch I had lying around; it's > against ancient libraries and isn't even a context diff, but > it should be sufficient to reconstruct what needs to be > done. ?It includes QuickCheck tests and benchmarked as quite > fast IIRC. > Some of the false positives in sort.txt, BTW, will be > because the values often need to be sorted anyway. > In this case, the speed win of nubOrd over > (map head . group . sort) isn't so clear---it probably > depends on the degree of replication in the input list. > Somebody should do some benchmarking, probably. ?On the > other hand, nubOrd preserves the input ordering, which is > occasionally handy. Looking over the various versions of 'nub' I've collected and my notes, I wonder if we might not be best off with 3 nubs: the current stable Eq, a stable Ord (using Sets), and an unstable Ord. > I have to wonder if some sort of nubOrdWith that uses a > specified equality test wouldn't be a good thing also, Hm. Seems kind of redundant with the Eq typeclass, and I don't think I saw any uses which were equivalent to nubOrdWith. > but I > hate to spend any more time beating on this proposal. > > ? ?Bart Massey > ? ?bart@cs.pdx.edu It just needs someone to take the time to put together a criterion benchmark module and figure out which of the bikesheds are best. It only took a year or so for Control.Monad.void, so no reason we couldn't have faster nubs in the 2011 GHC, -- gwern -------------- next part -------------- A non-text attachment was scrubbed... Name: nub.tar.gz Type: application/x-gzip Size: 49463 bytes Desc: not available Url : http://www.haskell.org/pipermail/libraries/attachments/20100224/9fd801ad/nub.tar-0001.gz From ben.franksen at online.de Thu Feb 25 13:59:12 2010 From: ben.franksen at online.de (Ben Franksen) Date: Thu Feb 25 13:29:50 2010 Subject: Proposed addition to stm: atomicallyIO and afterCommit References: <4B84F850.7060901@gmail.com> Message-ID: > do > ... IO code ... > v <- atomicallyIO $ do > ... STM code ... > if ..... > then do > ... STM code ... > afterCommit $ ... IO actions ... > else do > ... STM code ... > afterCommit $ ... IO actions ... Interesting idea, reminds me of the wrap combinator of cml (http://hackage.haskell.org/packages/archive/cml/0.1.3/doc/html/Control-Concurrent-CML.html#v%3Awrap). Simon Marlow wrote: > Personally I'm in two minds about this. It certainly captures a useful > idiom, but it fails the "don't name compositions" test, and one of the > additions is just a renaming of 'return', which makes it hard to justify. I'd say resolve this and similar proposals in a generic way: add it to a separate module on top of (name-space-hierarchically speaking) Control.Concurrent.STM, e.g. Control.Concurrent.STM.Util, whatever. Cheers Ben From ml at isaac.cedarswampstudios.org Thu Feb 25 14:21:39 2010 From: ml at isaac.cedarswampstudios.org (Isaac Dupree) Date: Thu Feb 25 13:52:24 2010 Subject: Proposed addition to stm: atomicallyIO and afterCommit In-Reply-To: <4B84FA4B.9000408@gmail.com> References: <4B84F850.7060901@gmail.com> <4B84FA4B.9000408@gmail.com> Message-ID: <4B86CDC3.3020405@isaac.cedarswampstudios.org> On 02/24/10 05:07, Simon Marlow wrote: > Simon just pointed out to me that this is quite closely related, though > more general: > > http://hackage.haskell.org/package/stm-io-hooks > http://www.haskell.org/haskellwiki/New_monads/MonadAdvSTM Because of those ideas that are already floating around, I think this one is misleading. In those, the afterCommit::IO(something)->STM(something) means even if it's not the last statement in the monad, to execute the IO when the transaction commits. Which has notable effects on the compositionality of STM (not sure about "good" or "bad" effects, but it's notable). As a coder, instead of Left and Right or atomicallyIO/afterCommit, I think I'd tend to write those functions inlined where it's readable; join{-IO-} $ atomically $ do{-STM-} ... return $ do{-IO-} ... ... (I do use that sort of which-monad-is-it comment in my code whenever it's not utterly obvious... Haskell doesn't provide any equally concise way to write those notes such that it will be checked by the compiler, sadly.) -Isaac From twanvl at gmail.com Thu Feb 25 18:00:02 2010 From: twanvl at gmail.com (Twan van Laarhoven) Date: Thu Feb 25 17:30:10 2010 Subject: Proposed addition to stm: atomicallyIO and afterCommit In-Reply-To: <4B84F850.7060901@gmail.com> References: <4B84F850.7060901@gmail.com> Message-ID: <4B8700F2.3000100@gmail.com> Simon Marlow wrote: > atomicallyIO :: STM (IO a) -> IO a > atomicallyIO ioSTM = join $ atomically ioSTM > > afterCommit :: IO a -> STM (IO a) > afterCommit mIO = return mIO The name "afterCommit" might be confusing. To me it suggests that the argument is added to some kind of list to be run at the end of the transaction. For example: atomicallyIO $ do .. STM .. afterCommit $ print 1 .. STM .. afterCommit $ print 2 This does would only print 2, because the return value of the first afterCommit is ignored. Twan From igloo at earth.li Sun Feb 28 14:58:51 2010 From: igloo at earth.li (Ian Lynagh) Date: Sun Feb 28 14:29:04 2010 Subject: Text.PrettyPrint bug or doc bug In-Reply-To: <4B85173E.10308@gabriel.name> References: <4B85173E.10308@gabriel.name> Message-ID: <20100228195850.GA24713@matrix.chaos.earth.li> On Wed, Feb 24, 2010 at 01:10:38PM +0100, Marcus D. Gabriel wrote: > > The documentation for Text.PrettyPrint.HughesPJ states > that vcat is the "List version of $$", but it works as > the list version ($+$). > > So either the documentation needs to be changed or > the code. It would be nice to have both versions. It looks like the behaviour changed in Tue Jun 24 12:37:15 BST 2008 benedikt.huber@gmail.com * fillNB bug, lazy vcat i.e. the version that came with GHC 6.10. As it's had the current behaviour for some time, it would probably make sense to have a library submission to determine what the behaviour should be, and whether we want another function for the other behaviour: http://www.haskell.org/haskellwiki/Library_submissions Thanks Ian From leon.p.smith at gmail.com Sun Feb 28 21:27:56 2010 From: leon.p.smith at gmail.com (Leon Smith) Date: Sun Feb 28 20:58:07 2010 Subject: Proposed additions to Data.Map: lookupFloor and lookupCeiling Message-ID: Hi, here are two quick, modest additions to Data.Map. As Map is exported abstractly, lookupFlor can't be defined outside the library except via splitLookup and findMax. On the other hand, these implementations should be nearly the same cost as a regular lookup. Best, Leon -- | /O(log n)/. Find the greatest key that is smaller or equal -- to the given target key. This \"floor\" key is returned, along with it's -- associated value, as @'Just' (key, value)@. If the map does not have -- a key that is smaller or equal to the target key, then this function -- returns 'Nothing'. lookupFloor :: Ord k => k -> Map k a -> Maybe (k,a) lookupFloor = go Tip where go s k t = case t of Tip -> case s of Tip -> Nothing Bin _ ka a _ _ -> Just (ka,a) Bin _ ka a l r -> case compare ka k of LT -> go t k r GT -> go s k l EQ -> Just (ka,a) -- | /O(log n)/. Find the smallest key that is greater or equal -- to the given target key. This \"ceiling\" key is returned, along with it's -- associated value, as @'Just' (key, value)@. If the map does not have -- a key that is greater or equal to the target key, then this function -- returns 'Nothing'. lookupCeiling :: Ord k => k -> Map k a -> Maybe (k,a) lookupCeiling = go Tip where go s k t = case t of Tip -> case s of Tip -> Nothing Bin _ ka a _ _ -> Just (ka,a) Bin _ ka a l r -> case compare ka k of LT -> go s k r GT -> go t k l EQ -> Just (ka,a) From leon.p.smith at gmail.com Sun Feb 28 21:39:53 2010 From: leon.p.smith at gmail.com (Leon Smith) Date: Sun Feb 28 21:10:05 2010 Subject: Status of nubOrd (Proposal #2629) Message-ID: On Wed, Feb 24, 2010 at 3:23 PM, Gwern Branwen wrote: > nub . sort (and the reverse) are very frequent. The attached sort.txt > was produced by > > find bin/ -name "*.hs" -exec sh -c "grep sort {} | grep nub && echo > {}" \; > sort.txt > > It's very crude and obviously produces lots of false positives & > negatives, but even so, there's at least >50 uses of nub . sort etc. Incidentally, data-ordlist has a nubSort implementation that's never more expensive than Data.List.sort. It's the same mergesort algorithm provided in Data.List except that it removes duplicates as it merges the lists. The library also provides a linear-time nub and nubBy on ordered lists, however this implementation is not used as part of nubSort. http://hackage.haskell.org/package/data-ordlist Best, Leon