runhaskell a parallel program

2009-05-06 Thread Neil Mitchell
Hi, I've got a program which I'd like to run on multiple threads. If I compile it with ghc --make -threaded, then run with +RTS -N2 it runs on 2 cores very nicely. If however I run it with runhaskell Test.hs +RTS -N2 I get told the -N2 flag isn't supported. Is there a way to runhaskell a program

Re: [Haskell-cafe] Research in functional programming

2009-05-04 Thread Neil Mitchell
Hi http://www.haskell.org/haskell-symposium/2009/ And you've got til Friday! Thanks, Neil On Sun, May 3, 2009 at 10:13 PM, Louis Wasserman wasserman.lo...@gmail.com wrote: Where might I find or submit a paper on functional data structures? Examples I've found so far include ICFP and the JFP,

Re: [Haskell-cafe] chr/ord?

2009-05-01 Thread Neil Mitchell
Hi But I get this when I try to use it: sheep.hs:30:22: Not in scope: `mplus' [mich...@localhost ~]$ You need to import Control.Monad. You can find answers to these sorts of questions with Hoogle: http://haskell.org/hoogle/?hoogle=mplus Thanks Neil

Re: [Haskell-cafe] can I query if package is in Hackage?

2009-04-24 Thread Neil Mitchell
Hi   Hoogle allows me to query about Haskell functionality. But is there a mechanism for querying about a package, e.g. Swish? Yes: http://haskell.org/hoogle/?hoogle=hoogle+%2Bhackage http://haskell.org/hoogle/?hoogle=swish+%2Bhackage Answer, swish is not on hackage, but hoogle is.

Re: writeFile/readFile on multiple threads leads to error

2009-04-22 Thread Neil Mitchell
 Is it too difficult to try this on Linux or Mac, just to see  if it shows up there as well? Yes ;-) I might be able to try it on Linux next week, but that's as far as I'm likely to be able to go. If I get any results I'll email them in. Thanks Neil

Re: writeFile/readFile on multiple threads leads to error

2009-04-22 Thread Neil Mitchell
Hi Claus, do print (READ START,x) ; res - readFile x ; print (READ STOP,x) ; return res Unless you've defined your own version of 'readFile', to mean read entire file now, the first 'print' is optimistic and the second 'print' is a lie. readFile calls openFile = hGetContents. It's the

Re: writeFile/readFile on multiple threads leads to error

2009-04-22 Thread Neil Mitchell
Bulat: I haven't tried moving to Posix calls, I'll try that next - although I was hoping the application wouldn't be posix dependent. readFile calls openFile = hGetContents. It's the openFile that causes the problem, so READ START happens before openFile and READ STOP happens after openFile.

Re: Parallel performance drops off a cliff

2009-04-21 Thread Neil Mitchell
Yes, what's happening is this: GHC 6.10.2 contains some slightly bogus heuristics about when to turn on the parallel GC, and it just so happens that 8 processors tips it over the point where the parallel GC is enabled for young-generation collections.  In 6.10.2 the parallel GC really

Re: Parallel performance drops off a cliff

2009-04-21 Thread Neil Mitchell
Hi This is using GHC 6.10.2 on Windows XP, 2 processors. Is this a known bug, or should I try and replicate it? (benchmark is fairly big and very dependent on internal things, but I suspect the dramatic performance slowdown is unlikely to be related to these bits). Yes, what's happening is

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-21 Thread Neil Mitchell
Hi I believe it is a good practice too keep each line short and easy to read.  The following is taken from python style guide.  Maximum Line Length    Limit all lines to a maximum of 79 characters.    There are still many devices around that are limited to 80 character    lines; plus,

Re: [Haskell-cafe] Getting the x out

2009-04-21 Thread Neil Mitchell
Hi It's not too hard. You wanted a function that converted Maybe a - a, you just Hoogle for it: http://haskell.org/hoogle/?hoogle=Maybe+a+-+a Thanks Neil On Wed, Apr 22, 2009 at 2:07 AM, michael rice nowg...@yahoo.com wrote: Got it! I figured there must be some way to unpack it. My

Parallel performance drops off a cliff

2009-04-20 Thread Neil Mitchell
Hi, Using one benchmark I have, which doesn't create any threads, I have: $ benchmark +RTS -Nx x time (Seconds) 1 2 2 2 3 2 4 3 5 3 6 3 7 3 8 aborted after 2 minutes This is

GHC threading bug in QSem

2009-04-08 Thread Neil Mitchell
Hi I believe the following program should always print 100: import Data.IORef import Control.Concurrent main = do sem - newQSem (-99) r - newIORef 0 let incRef = atomicModifyIORef r (\a - (a+1,a)) sequence_ $ replicate 100 $ forkIO $ incRef signalQSem sem waitQSem sem v

Re: GHC threading bug in QSem

2009-04-08 Thread Neil Mitchell
I've now raised a ticket to track this issue: http://hackage.haskell.org/trac/ghc/ticket/3159 Thanks, Neil On Wed, Apr 8, 2009 at 11:26 AM, Neil Mitchell ndmitch...@gmail.com wrote: Hi I believe the following program should always print 100: import Data.IORef import Control.Concurrent

[Haskell-cafe] Parallel combinator, performance advice

2009-04-07 Thread Neil Mitchell
Hi, I've written a parallel_ function, code attached. I'm looking for criticism, suggestions etc on how to improve the performance and fairness of this parallel construct. (If it turns out this construct is already in a library somewhere, I'd be interested in that too!) The problem I'm trying to

Re: [Haskell-cafe] System.Process.Posix

2009-04-07 Thread Neil Mitchell
Hi Is it me or the above package is not included in Hoogle? afair, Neil, being windows user, includes only packages available for his own system there was a large thread a few months ago and many peoples voted for excluding any OS-specific packages at all since this decreases portability

[Haskell-cafe] Re: Parallel combinator, performance advice

2009-04-07 Thread Neil Mitchell
Hi The problem I'm trying to solve is running system commands in parallel. system commands means execution of external commands or just system calls inside Haskell? Calls to System.Cmd.system, i.e. running external console processes. It's a make system I'm writing, so virtually all the

[Haskell-cafe] Re: Re[2]: Parallel combinator, performance advice

2009-04-07 Thread Neil Mitchell
Hi Sebastian: How about using unsafeInterleaveIO to get a lazy suspension of the result of each action, and then using par to spark off each of them? If that works you can reuse the existing task-parallel system of GHC to do the heavily lifting for you, instead of having to write your

[Haskell-cafe] Re: Re[2]: Parallel combinator, performance advice

2009-04-07 Thread Neil Mitchell
Hi Bulat, btw, if all that you need is to limit amount of simultaneous System.Cmd.system calls, you may go from opposite side: wrap this call into semaphore: sem = unsafePerformIO$ newQSem numCapabilities mysystem = bracket_ (waitQSem sem) (signalQSem sem) . system and implement para as

[Haskell-cafe] Re: Re[5]: Parallel combinator, performance advice

2009-04-07 Thread Neil Mitchell
Hi par is likely to spark all the computations, and then switch between them - which will mean I've got more than N things running in parallel. | par/GHC RTS limits amount of Haskell threads running simultaneously. | with a system call marked as safe, Capability will be freed while we |

Re: [Haskell-cafe] EclipseFP proposal for Google Summer of Code

2009-04-06 Thread Neil Mitchell
Hi Thomas, I send this e-mail because of possible scheduling issues: I will be away starting on April 15. So, if you want to ask me things, have suggestions for improvement, or want to do an interview or something, this can only be done *before* that date. I am pretty sure all the questions

Re: [Haskell-cafe] about import alias

2009-04-04 Thread Neil Mitchell
Hi You can always do {-# INLINE short #-} short = C.veryLongFunctionNameThatIReallyDoNotWantToTypeOutEveryTimeIUseIt The INLINE pragma is not necessary, if an optimising compiler fails to inline that then it's not very good. However, you might want to consider the (evil) monomorphism

Re: [Haskell-cafe] Announcement: Beta of Leksah IDE available

2009-04-01 Thread Neil Mitchell
Hi Just tried it out, a few notes: * Very easy install - if only gtk2hs could be installed with cabal it would have been perfect. * Select the package you have installed. I didn't have a clue what to do here. Do you mean where I keep my Haskell programs? Or where GHC installs them? Can't you

Re: [Haskell-cafe] GSoC proposal

2009-04-01 Thread Neil Mitchell
Hi Csaba, Do you mean you have submitted your proposal to the Haskell wiki thing, or to the official google application? If its the wiki, then submit it to the official Google thing as well. You can always edit it later, but the deadline is fast approaching. If its the Google thing, then not

copyFile and thread safety

2009-03-30 Thread Neil Mitchell
Hi, Using GHC 6.8.3, the copyFile routine isn't thread safe - it crashes when two threads try and open the same file. I think that improvements were made to avoid security race conditions in GHC 6.10.1 (or the base library associated with it), and as a nice side effect they seem to have fixed the

Re: Really bad code for single method dictionaries?

2009-03-26 Thread Neil Mitchell
Hi Jason, While experimenting with Uniplate I found that 1-member dictionaries were faster than N element dictionaries - which seems to run against what you see in the comment. 1-member dictionaries being cheaper does make sense as then instead of passing a tuple containing functions, you can

Re: [Haskell-cafe] Copying data files when installing, using Cabal

2009-03-26 Thread Neil Mitchell
Hi Henk-Jan, It works for me, see for example HLint: http://community.haskell.org/~ndm/darcs/hlint And a blog I wrote on it: http://neilmitchell.blogspot.com/2008/02/adding-data-files-using-cabal.html The data files are copied in to the data directory upon install. The data-files: bit must be

Re: [Haskell-cafe] Language.Haskell.Parser question

2009-03-26 Thread Neil Mitchell
Hi f1 = foo 5 f2 = foo 8 f3 = foo 9  I want to extract a list [5, 8, 9] (suppouse function takes only one argument) Firstly, use haskell-src-exts and Language.Haskell.Exts - its a much better library, deals with many extensions, and gives you everything Language.Haskell did. parser

Re: [Haskell-cafe] Language.Haskell.Parser question

2009-03-26 Thread Neil Mitchell
Hi John, Actually, looking at the docs for UniplateStr[1], isn't there an error in the following example statement in the Queries section? vals x = [Val i | i - universe x] Shouldn't that be: vals x = [i | Val i - universe x] Yep, you are indeed right. I've fixed the examples in the darcs

Re: [Haskell-cafe] Language.Haskell.Parser question

2009-03-26 Thread Neil Mitchell
it would be sensible to name such a function vals... Thanks Neil On Thu, Mar 26, 2009 at 4:23 PM, Neil Mitchell ndmitch...@gmail.com wrote: Hi John, Actually, looking at the docs for UniplateStr[1], isn't there an error in the following example statement in the Queries section

Re: [Haskell-cafe] Whats the use of !

2009-03-25 Thread Neil Mitchell
Hi A quick Hoogle for ! : http://haskell.org/hoogle/?hoogle=! Gives the first answer as: http://www.haskell.org/haskellwiki/Keywords#.21 If that isn't clear, someone should expand on it or give further links to useful resources. Thanks Neil 2009/3/25 Harsh Verma hjve...@hotmail.com: I have

Re: [Haskell-cafe] Google Summer of Code: Is this idea useful for the community?

2009-03-22 Thread Neil Mitchell
The main thing about reddit is the community, not the underlying code, and while I'm sure a SoC project could do something with the code, I don't see how you could build such a community. And if you did build a big community, then I think it would spiral out of control with only a summers work to

Re: [Haskell-cafe] Re: Haskell Logo write-in candidate

2009-03-20 Thread Neil Mitchell
semi-rant warning: This whole badge/logo business seems to me to be an excellent example of Parkinson's law of triviality (choosing the colour of the bikeshed). We have a large (too large) number of variations on relatively few themes and a really sophisticated voting system, but no very

Re: [Haskell-cafe] least fixed points above something

2009-03-19 Thread Neil Mitchell
I've used a similar function myself, but why write it in such a complicated way? How about lfp :: Eq a = (a - a) - a - a lfp f x  | f x == x = x  | otherwise = lfp f (f x) I've used a similar function too, but your version computes f x twice per iteration, I wrote mine as: fix :: Eq a =

Re: [Haskell-cafe] least fixed points above something

2009-03-19 Thread Neil Mitchell
:) On 19 Mar 2009, at 16:21, Neil Mitchell wrote: I've used a similar function myself, but why write it in such a complicated way? How about lfp :: Eq a = (a - a) - a - a lfp f x  | f x == x = x  | otherwise = lfp f (f x) I've used a similar function too, but your version computes f x twice per

Re: [Haskell-cafe] least fixed points above something

2009-03-19 Thread Neil Mitchell
Can you give an example of when CSE would not be the way to go? if length (replicate 'a' 1) == 1 then [] else head (replicate 'a' 1) This program will use O(1) memory. If we perform CSE: if length x == 1 then [] else head x where x = replicate 'a' 1 Now we use 1 cells of

Re: [Haskell-cafe] can GHC build an executable from a C source file?

2009-03-17 Thread Neil Mitchell
Yhc used to do this (when you could still build it). Turns out that on Windows using gcc that gets installed with ghc isn't particularly fun, while ghc makes a very pleasant build experience. Something to do with directory layouts, head file searching, and what is on the %PATH% by default. Thanks

Re: [GHC] #3081: Double output after Ctrl+C on Windows

2009-03-16 Thread Neil Mitchell
system cp foo foo.bup deleteFile foo If I Ctrl+C during the cp did I just delete my one copy of foo? On Windows, Ctrl-C will unblock a blocked system call.  e.g. read() returns with zero.  Apparently system foo also returns as soon as you press Ctrl-C, I'm not entirely sure why.  Perhaps

Re: [Haskell-cafe] Map in Terms of Fold in terms of Map

2009-03-16 Thread Neil Mitchell
Hi Mark, What's the definition of foldr in terms of map? As far as I was aware, its not possible. And as it happens, map is (or is sometimes) defined in term of foldr :-) While you can use mutual recursion, you can't define a in terms of b and b in terms of a unless one of them actually does

Re: [Haskell-cafe] View patterns and warnings about overlapping or non-exhaustive patterns

2009-03-11 Thread Neil Mitchell
Hi Stephan, I'm working on a data structure that uses Data.Sequence a lot, so views are important and I tried to simplify my code using view patterns. The problem is, that I keep getting warnings about both overlapping and non-exhaustive pattern matches. A simple test case:

Re: Windows building instructions

2009-03-10 Thread Neil Mitchell
Hi Simon, I got a brand new Vista machine yesterday (and a brand new monitor this morning), running Vista. I'll try out these instructions as soon as its all plugged together. When I had my last stab at compiling GHC I ended up creating a little script to automate some of the common bits and

Re: [Haskell-cafe] Data.Binary stack overflow with Data.Sequence String

2009-03-05 Thread Neil Mitchell
Hi Gwern, I get String/Data.Binary issues too. My suggestion would be to change your strings to ByteString's, serisalise, and then do the reverse conversion when reading. Interestingly, a String and a ByteString have identical Data.Binary reps, but in my experiments converting, including the cost

Re: [Haskell-cafe] Data.Binary stack overflow with Data.Sequence String

2009-03-05 Thread Neil Mitchell
Avoid massive reductions in runtime while maintaining the same API? I did move to using ByteString's internally for those bits later on, but reading String's from Data.Binary with a ByteString+unpack went much more quickly than reading String's On Thu, Mar 5, 2009 at 7:35 PM, Don Stewart

Re: [Haskell-cafe] Test if a file is empty or stat in haskell

2009-03-05 Thread Neil Mitchell
Hi I am on Linux. BTW, Hoogle does not seem to  know about System.Posix.Files, though it did point me to System.IO.FileSize which would also have served the purpose. To build the Hoogle libraries I need to build the packages. I run Windows not Linux, so its a bit difficult to index

Re: [Haskell-cafe] Difficulties in accessing inner elements of data types

2009-03-03 Thread Neil Mitchell
Hi David, What you are wanting to do is query and transform a reasonably large AST. Fortunately there are solutions, generic programming should do exactly what you want without too much hassle. I'd personally recommend taking a look at the Uniplate library, starting by reading the Haskell

Re: [Haskell-cafe] Assignment of grayCode

2009-03-02 Thread Neil Mitchell
Hi I'm working on a project for my university. But I do not understand the assignment. If you don't understand a university assignment the best place to ask is the person who set the assignment. If you don't understand what is being asked, most lecturers will provide clarification. It asks

Re: finally part run twice on Ctrl-C

2009-02-27 Thread Neil Mitchell
Hi Philip, Just to let you know; I tried it on the release version of 6.10.1 and it worked as expected (first run, I waited; second I pressed Ctrl-C): *Test main goodbye ExitSuccess *Test main goodbye ExitFailure 2 *Test It looks like you are running in GHCi, which I think works. It's

Re: [Haskell-cafe] Data.Binary, strict reading

2009-02-26 Thread Neil Mitchell
Hi With binary 0.5,    src - decodeFile _make/_make    return $! src I'm pretty sure I was on the latest Cabal released version of binary, and the above trick did not work. It _usually_ worked, but every so often I'd get a locking error. Shouldn't you use rnf[1]? Also, there seems to be

[Haskell-cafe] Data.Binary, strict reading

2009-02-25 Thread Neil Mitchell
Hi, I want to read a file using Data.Binary, and I want to read the file strictly - i.e. when I leave the read file I want to guarantee the handle is closed. The reason is that (possibly immediately after) I need to write to the file. The following is the magic I need to use - is it all

[Haskell-cafe] Data.Binary poor read performance

2009-02-23 Thread Neil Mitchell
Hi, In an application I'm writing with Data.Binary I'm seeing very fast write performance (instant), but much slower read performance. Can you advise where I might be going wrong? The data type I'm serialising is roughly: Map String [Either (String,[String]) [(String,Int)]] A lot of the

Re: [Haskell-cafe] Hoogle and Network.Socket

2009-02-22 Thread Neil Mitchell
Hi I don't want to get in to a platform war (which I certainly don't have time to engage in - plus its not nearly as much fun over email vs sitting in a pub with some beer having a platform war). Martijn's thoughts of +windows, +unix, +os is exactly right, I'm happy to let users say oh, please

Re: [Haskell-cafe] Hoogle and Network.Socket

2009-02-20 Thread Neil Mitchell
a small issue if you are searching on one platform and programming on/for another platform.  But the flags could still be used. Thomas On Thu, Feb 19, 2009 at 9:11 AM, Neil Mitchell ndmitch...@gmail.com wrote: Hi http://haskell.org/hoogle/?q=socket+%2Bnetwork By default it searches

Re: [Haskell-cafe] Hoogle and Network.Socket

2009-02-19 Thread Neil Mitchell
Hi http://haskell.org/hoogle/?q=socket+%2Bnetwork By default it searches the libraries supplied with Windows apart from Network (for various technical reasons). If you add +network it will then search the network library. What libraries should Hoogle search by default? What flags should be

Re: [Haskell-cafe] createProcess shutting file handles

2009-02-16 Thread Neil Mitchell
However the createProcess command structure has the close_fds flag, which seems like it should override that behaviour, and therefore this seems like a bug in createProcess. close_fds :: Bool Close all file descriptors except stdin, stdout and stderr in the new process

Users guide missing

2009-02-16 Thread Neil Mitchell
Hi The web page: http://haskell.org/haskellwiki/GHC Links to the latest users guide as a PDF, unfortunately the file is missing: http://www.haskell.org/ghc/docs/latest/users_guide.pdf Thanks Neil ___ Glasgow-haskell-users mailing list

Re: [Haskell-cafe] Looping after compiling with cabal

2009-02-16 Thread Neil Mitchell
Hi Henk-Jan, I believe cabal adds a -O on the command line, perhaps try ghc --make -O (after deleting all object files) Thanks Neil On Mon, Feb 16, 2009 at 12:04 PM, Henk-Jan van Tuyl hjgt...@chello.nl wrote: L.S., I have updated wxFruit to compile with GHC 6.10.1, but when I compil using

Re: [Haskell-cafe] createProcess shutting file handles

2009-02-16 Thread Neil Mitchell
However the createProcess command structure has the close_fds flag, which seems like it should override that behaviour, and therefore this seems like a bug in createProcess. close_fds :: Bool Close all file descriptors except stdin, stdout and stderr in the new process

Re: [Haskell-cafe] createProcess shutting file handles

2009-02-15 Thread Neil Mitchell
Hi However the createProcess command structure has the close_fds flag, which seems like it should override that behaviour, and therefore this seems like a bug in createProcess. close_fds :: Bool Close all file descriptors except stdin, stdout and stderr in the

Re: [Haskell-cafe] createProcess shutting file handles

2009-02-15 Thread Neil Mitchell
Hi What have I done wrong? Did createProcess close the handle, and is there a way round this? The docs for runProcess says: Any Handles passed to runProcess are placed immediately in the closed state. but the equivalent seems to be missing from the documentation for

Re: [Haskell-cafe] createProcess shutting file handles

2009-02-15 Thread Neil Mitchell
Hi However the createProcess command structure has the close_fds flag, which seems like it should override that behaviour, and therefore this seems like a bug in createProcess. close_fds :: Bool Close all file descriptors except stdin, stdout and stderr in the

DLL support with GHC

2009-02-13 Thread Neil Mitchell
Hi, What is the current status of shared object support within GHC? Using GHC 6.10.2 (or the branch for it) I can create DLL's under Windows, following these instructions: http://www.haskell.org/ghc/docs/latest/html/users_guide/win32-dlls.html .Can a similar thing be done under Linux? If so,

DLL thread safety

2009-02-13 Thread Neil Mitchell
Hi, I'm building a DLL using the instructions here: http://www.haskell.org/ghc/docs/latest/html/users_guide/win32-dlls.html I must call startupHaskell before I make any calls to Haskell functions. However, that page doesn't detail any thread safety rules. In particular: * If I call

Re: [Haskell-cafe] Re: Overloading functions based on arguments?

2009-02-13 Thread Neil Mitchell
Hi Table is a table of name-value pairs I want to substitute in a tree-like structure using: substitute :: Table - Tree - Tree For substituting a single name-value pair I want to define this utitlity routine so I don't have to construct a Table all the time in the user code: substitute

[Haskell-cafe] createProcess shutting file handles

2009-02-13 Thread Neil Mitchell
Hi, I want to run multiple programs and dump the stdout/stderr to a file, I've tried doing: h - openFile file WriteMode let c = CreateProcess (RawCommand file []) Nothing Nothing Inherit (UseHandle h) (UseHandle h) False (_,_,_,pid)

Re: [Haskell-cafe] Re: Overloading functions based on arguments?

2009-02-13 Thread Neil Mitchell
Hi Chances are the program you're using to write your e-mails was written in C++ (or at least C), so don't knock it. :-) Firefox (Javascript + C++) and Gmail (Python, so I think I read, no doubt with C underneath somewhere). However, I am sat writing C++ at the moment - which I think gives me

Re: Pragma not recognised when wrapped in #ifdef

2009-02-11 Thread Neil Mitchell
Hi Is there still a need for CPP now that Template Haskell exists? Yes. For a start you might need CPP to switch between Haskell compilers that do and don't support Template Haskell! Both technologies do different things, CPP is great for conditional compilation based on compiler

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Neil Mitchell
Hi Successor as in Happstack replaces HAppS entirely and all projects implemented in HAppS should aim to port to Happstack - or successor as in builds on the ideas in HAppS? Is HAppS now deprecated? Thanks Neil 2009/2/4 Matthew Elder m...@mattelder.org: Hello Haskell Cafe, I just wanted to

Re: [Haskell-cafe] Re: 1,000 packages, so let's build a few!

2009-02-03 Thread Neil Mitchell
Hi GHC doesn't bundle with cabal-install on any system. What is needed is not for the GHC team to be doing Windows platform packages, but for the Windows Haskell devs to build their own system, as happens on all the Unices. Take GHC's release, wrap it up with native installers, throw in

Re: [Haskell-cafe] Re: 1,000 packages, so let's build a few!

2009-02-02 Thread Neil Mitchell
Hi So actually just having more Windows users subscribed to cabal-devel and commenting on tickets would be very useful, even if you do not have much time for hacking. I believe that as soon as a Windows user starts doing that you'll start asking them for patches :-) There are a number of

Re: [Haskell-cafe] The case of the missing Arrow function

2009-01-30 Thread Neil Mitchell
Hi Henk, You're only a Hoogle away: http://haskell.org/hoogle/?hoogle=liftA2 Control.Applicative liftA2 :: Applicative f = (a - b - c) - f a - f b - f c I guess its both an arrow function and an applicative function. Thanks Neil On Fri, Jan 30, 2009 at 3:02 PM, Henk-Jan van Tuyl

Re: [Haskell-cafe] Re: How outdated is Hugs?

2009-01-28 Thread Neil Mitchell
Hi to mind), if Hugs is likely to continue to have compatibility problems with GHC, then is there any way an interface similar to that already available for WinHugs could be created for GHCi? If that gets underway, one additional improvement could be to improve the REPL at handling declared

Re: [Haskell-cafe] Re: Liskell installation configuration problems in Cygwin on Windows XP Professional, Service Pack 2

2009-01-23 Thread Neil Mitchell
Hi Benjamin, Try: cabal install ghc-paths If you want to install packages manually you can also get it from http://hackage.haskell.org Thanks Neil On Fri, Jan 23, 2009 at 9:16 AM, Benjamin L. Russell dekudekup...@yahoo.com wrote: On Fri, 23 Jan 2009 18:10:16 +0900, Benjamin L.Russell

Re: [Haskell-cafe] Expect module?

2009-01-19 Thread Neil Mitchell
Hi Erik, Is there a Haskell-Expect module? Something that would allow me to control an external Unix program via its stdin/stdout/stderr? System.Process does what you want, I think: http://hackage.haskell.org/packages/archive/process/1.0.1.1/doc/html/System-Process.html Thanks Neil

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Hi Henning, To install: cabal update cabal install hlint Fails for me, because of the base-4 dependency. - I'm still using GHC-6.8.2. Can HLint suggest view-pattern-free expressions, such that the program also runs on GHC-6.8 ? :-) HLint is written using view-patterns so requires GHC 6.10

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Hi My question was, whether HLint can help translating HLint to code without view patterns. Ah, I misunderstood. Yes, it could (in theory), but it can't automatically apply the hints it generates. Upgrading to GHC 6.10 is probably easier :-) Thanks Neil

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Ah, I misunderstood. Yes, it could (in theory), but it can't automatically apply the hints it generates. Upgrading to GHC 6.10 is probably easier :-) Also throwing away Hugs ... (YHC too ?) Yes :-( I normally develop in Hugs, for a change I wanted to try GHCi. It's also a project that has

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-15 Thread Neil Mitchell
Are you sure that you can't come up with some nice functions like 'maybe' to replace those view patterns by function calls? Did you really try? I remember the recent discussion on pattern combinators here on Haskell Cafe. I could, but it would look more ugly - and I want my code to be

Re: [Haskell-cafe] Re: [ANN] Working with HLint from Emacs

2009-01-14 Thread Neil Mitchell
Hi Gour, Alex Module is available from Alex http://xtalk.msk.su/~ott/common/emacs/hs-lint.el Module is not under some dvcs? I put it in the main HLint repo last night: http://www.cs.york.ac.uk/fp/darcs/hlint/data/hs-lint.el Please send all patches for this particular file via Alex. Thanks

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Neil Mitchell
Hi 1) In a Python string it is available the \U{name} escape, where name is a character name in the Unicode database. As an example: foo = uabc\N{VULGAR FRACTION ONE HALF} Hmm, looks nice, and sensible. But as soon as you've got \N{} syntax I want: foo\E{show i}bar i.e.

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Neil Mitchell
As an example: foo = uabc\N{VULGAR FRACTION ONE HALF} Hmm, looks nice, and sensible. But as soon as you've got \N{} syntax I want: foo\E{show i}bar i.e. embed expressions in strings. I think this would be fantastic. why not simpy foo\E{i}bar ? What if i is a string? You'd

Re: [Haskell-cafe] Stack Overflow, tail recursion and CPS

2009-01-14 Thread Neil Mitchell
Hi I have changed the insertion algo to use foldl to make it tail-recursive but still get a stack overflow as the insert remains lazy. Try foldl' and insertWith' - that should work. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] unfoldr [ANN: HLint 1.2]

2009-01-13 Thread Neil Mitchell
Hi convert b 0 = [] convert b n = n `mod` b : convert b (n `div` b) convert b = unfoldr (\n - if n 0 then Just (n `mod` b, n `div` b) else Nothing) To my untrained eyes the second looks more complex... It can't be implemented in the HLint list recursion functions I've got at the moment

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Neil Mitchell
Hi Does GHC specialize map? If it doesn't, then hand crafted version could be faster. GHC doesn't specialize map, and a hand-crafted one could be faster - but you then wouldn't get foldr/build fusion. In general HLint tries to make the code prettier, but sometimes you will need to deviate

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-12 Thread Neil Mitchell
Hi No because the current definition are recursive and ghc cannot inline recursive functions. map :: (a - b) - [a] - [b] map f = go where go [] = [] go (x:xs) = f x : go xs Then the map can be inlined at the call site and the 'f' inlined into the body of 'go'. Maybe HLint

[Haskell] ANN: HLint 1.2

2009-01-11 Thread Neil Mitchell
Hi, I am pleased to announce HLint version 1.2. HLint is a lint-like tool for Haskell that detects and suggests improvements for your code. HLint is compatible with most GHC extensions, and supports a wide variety of suggestions, and can be extended with additional user suggestions. To install:

[Haskell-cafe] ANN: HLint 1.2

2009-01-11 Thread Neil Mitchell
Hi, I am pleased to announce HLint version 1.2. HLint is a lint-like tool for Haskell that detects and suggests improvements for your code. HLint is compatible with most GHC extensions, and supports a wide variety of suggestions, and can be extended with additional user suggestions. To install:

Re: [Haskell-cafe] Maybe a compiler bug?

2009-01-06 Thread Neil Mitchell
Hi Murray, The issue here is not whether or not the code is pretty or elegant, but whether or not I get correct execution of what I have, which is a correct statement of what I want (even if not the prettiest or most lint free), and I don't. Sorry, I was merely responding to someone else

Re: [Haskell-cafe] intercalate and (byte)strings

2008-12-23 Thread Neil Mitchell
Hi wman, -- B == Data.ByteString ; L == Data.ByteString.Lazy contents' = B.intercalate B.empty $ L.toChunks contents with a previously unencountered function intercalate. A quick google query later i knew that it's just intersperse concat nicely bundled and started wondering why anybody

[Haskell-cafe] Re: [Haskell] ANN: HLint 1.0

2008-12-22 Thread Neil Mitchell
Hi Lennart, It would be nice if HLint didn't suggest things that it will object to in the next round. Like LLVM/Core/CodeGen.hs:176:1: Eta reduce Found: applyArgs f g = apArgs 0 f g Why not: applyArgs f = apArgs 0 f The idea is to specify things one step at a time, so the user learns

[Haskell] ANN: Hoogle with more libraries

2008-12-21 Thread Neil Mitchell
Hi, I am pleased to annouce that the Hoogle on http://haskell.org/hoogle will now search lots of the libraries present on hackage. For example, to search for the parse function in tagsoup, try: parse +tagsoup (http://haskell.org/hoogle/?hoogle=parse+%2Btagsoup) By default Hoogle will still

[Haskell-cafe] Re: [Haskell] ANN: Hoogle with more libraries

2008-12-21 Thread Neil Mitchell
Hi Bob, 1. Searching using a package name that isn't all lower case results in nothing (e.g. (a - b) - f a - f b +InfixApplicative gives no results, while (a - b) - f a - f b +infixapplicative gives 2). Yes, if you do +InfixApplicative it assumes you mean only in the module InfixApplicative,

[Haskell] ANN: HLint 1.0

2008-12-20 Thread Neil Mitchell
Hi, I am pleased to announce HLint, a tool for making suggestions to improve your Haskell code. Previously this tool was called Dr Haskell and depended on a working installation of Yhc - both of those have now changed. HLint requires GHC 6.10*, and to install simply type: cabal update cabal

[Haskell-cafe] Re: [Haskell] ANN: HLint 1.0

2008-12-20 Thread Neil Mitchell
Hi I noticed that you convert point-wise into point-free. Perhaps you could add some point-free transformations to remove redundancy in certain cases. Is that a goal of the library? It does some transformations of th at nature, but the idea isn't to remove redundancy, its to make the code

Re: [Haskell-cafe] Re: Time for a new logo?

2008-12-18 Thread Neil Mitchell
Hi Might be interesting to try angling the ends of the stems to look something more like the guillemot in [1]. I might try this in Gimp but I'm no designer :P If you're on Linux or similar, I recommend Inkscape for this kind of thing. If you're on Windows, Inkscape also works well for most

Re: Type signature inside an instance declaration

2008-12-16 Thread Neil Mitchell
Hi You want to use `asTypeOf`, with a lazy pattern to name a value of type 'a'. pr xs = [ ++ pr (undefined `asTypeOf` x) ++ ] where (x:_) = xs I prefer: pr xs = [ ++ pr (undefined `asTypeOf` head x) ++ ] Or even more simply: pr xs = [ ++ pr (head x) ++ ] I do believe there

Re: [Haskell] Missing Documentation

2008-12-16 Thread Neil Mitchell
Hi Ron This may very well be a FAQ, but I tried to search the archives and could not find a post... Anyway, some documentation seems to be missing, which was there before I thought. For example: http://www.haskell.org/ghc/docs/latest/html/libraries/haskell98/Random.html That's a bug, I've

[Haskell-cafe] Re: [Haskell] Missing Documentation

2008-12-16 Thread Neil Mitchell
Hi Ron This may very well be a FAQ, but I tried to search the archives and could not find a post... Anyway, some documentation seems to be missing, which was there before I thought. For example: http://www.haskell.org/ghc/docs/latest/html/libraries/haskell98/Random.html That's a bug, I've

Re: [Haskell-cafe] Re: [Haskell] Missing Documentation

2008-12-16 Thread Neil Mitchell
Hi Ron, Thanks... I have been 'away' from Haskell for a while and it is taking me a bit to get re-synced! Anyway, before posting here I also sent an email to Simon Marlow, and he let me know that this bug (or one very similar) was reported for Char in:

Re: length of module name affecting performance??

2008-12-15 Thread Neil Mitchell
Hi I'm using GHC 6.10.1 on OS X. Any ideas on what may be going on? Wow. Awesome bug! Got lots of discussion at Galois :) I can confirm a difference in running time, we also tested with 6.8.x and 6.10, with similar results. Is -O2 implying -fvia-C? If so, could it be the evil mangler? Is

Re: [Haskell-cafe] Data.List.Split

2008-12-15 Thread Neil Mitchell
Hi I should have said that, on the other hand, with stream fusion enabled, (concat . map) outperforms (concatMap) :) That can only be a bug in stream fusion - concatMap should always be prefered! Thanks Neil ___ Haskell-Cafe mailing list

<    1   2   3   4   5   6   7   8   9   10   >