RE: [Haskell-cafe] Possible issue with Hoogle and Haddock?

2008-11-21 Thread Mitchell, Neil
I was noticing recently that there seems to be a problem with Hoogle and Haddock. In particular, I just hoogled bracket and got the following result: bracket :: IO a - a - IO b - a - IO c - IO c Clearly this is the wrong type, as it should be bracket :: IO a - (a - IO

RE: [Haskell-cafe] getLine and ^C on Windows

2008-11-13 Thread Mitchell, Neil
Hi I have the same experience with Windows XP and getContents, so I think it's the entire IO layer on Windows, rather than just getLine on Vista. This is being tracked here http://hackage.haskell.org/trac/ghc/ticket/2758 Thanks Neil I've had the same experience with runghc in GHC 6.10.1 on

RE: [Haskell-cafe] Searching for ADT patterns with elem and find

2008-11-12 Thread Mitchell, Neil
I guess one drawback compared to Neil's suggested use of any (and staying with a separate isTypeB) is that your solution will iterate over the entire list, regardless of an early hit. Nope, it will stop on the first one - Haskell is lazy like that :-) Thanks, Neil

RE: [Haskell-cafe] Proof that Haskell is RT

2008-11-12 Thread Mitchell, Neil
It's possible that there's some more direct approach that represents types as some kind of runtime values, but nobody (to my knowledge) has done that. It don't think its possible - I tried it and failed. Consider: show (f []) Where f has the semantics of id, but has either the return

RE: [Haskell-cafe] Searching for ADT patterns with elem and find

2008-11-12 Thread Mitchell, Neil
containsTypeB ts = not $ null [x | (B x) - ts] No need for the brackets on the left of the -: not $ null [x | B x - ts] findBs ts = [b | b@(B _) - ts] or findBs ts = [B x | (B x) - ts] both of them compile but the first is ugly and the second is inefficient (Tags a new T for

RE: [Haskell-cafe] Searching for ADT patterns with elem and find

2008-11-12 Thread Mitchell, Neil
Hi Paul, maybe False (\x - True) (find isTypeB ts) This can be more neatly expressed as: isJust (find isTypeB ts) But your entire thing can be expressed as: containsTypeB ts = any isTypeB ts I recommend reading through the Prelude interface and the List interface, it has many useful

RE: [Haskell-cafe] compilation question

2008-11-11 Thread Mitchell, Neil
Hi The one way to test this is to benchmark, everything else will just be peoples random guesses. As for my random guess, eval should be significantly faster than peval in Hugs, and probably slightly faster than peval in GHC. I don't see why you think peval is efficient - monads /= efficiency,

RE: [Haskell-cafe] generalized list comprehensions

2008-11-10 Thread Mitchell, Neil
Generalised? Heck, I don't use list comprehension at all! :-P Perhaps you should! :-) You definitely should! Take a look at the Uniplate paper for some wonderful concise uses of list comprehensions for abstract syntax tree traversals. If you use a language like F# they become even more

RE: [Haskell-cafe] pure programs

2008-11-05 Thread Mitchell, Neil
System.Info is broken. os has the wrong type. And the wrong value! I have not installed mingw32 on this machine, mingw32 isn't even an os... /me has goal of having os on Linux report wine1.1.7 Thanks Neil == Please

RE: [Haskell-cafe] Efficient parallel regular expressions

2008-11-04 Thread Mitchell, Neil
Hi Martijn, It's not that tricky if you do a regular expression state machine yourself, but that's probably a bit too much work. One way to get a speed up might be to take the regular expressions a,b,c,d and generate a regex a+b+c+d, and one a+b. You can then check any string s against

RE: [Haskell-cafe] code generation

2008-11-04 Thread Mitchell, Neil
I think using Template Haskell for your work would fit very nicely, so is a good choice to learn :-) I already got used to TH a bit, but I am not sure if it is appropriate for my purpose, or at least not completely. I want to load Haskell code into my program at runtime in an

RE: [Haskell-cafe] Poll: Do you need to be able to build darcs from source on GHC 6.6?

2008-10-29 Thread Mitchell, Neil
Duncan, I believe the major darcs issue is the changed GADT implementation between 6.6, so that neither 6.6 or 6.8 is a superset/subset of the other - leading to a situation where they have to use a common subset of both. Thanks Neil -Original Message- From: [EMAIL PROTECTED]

RE: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Mitchell, Neil
Hi, That is a fairly standard implementation of rounding for financial institutions. Consider sum . map round Over the list [3.5,2.5] With rounding to the nearest even integer for 0.5's you get 6, otherwise if you always round up you get 7. If you bias towards rounding up you get a general

[Haskell-cafe] RE: [Haskell] Current XML libraries status

2008-10-24 Thread Mitchell, Neil
Redirected to haskell-cafe, since that's where all discussions should go (haskell = announcments only) Does some one have made performance tests on the different XML libraries for Haskell? I have a 20MB xml file that I want to read. I remember from my earlier experiments (years ago)

RE: [Haskell-cafe] Fwd: enhancing type classes with properties

2008-10-22 Thread Mitchell, Neil
Hi Alberto, Take a look at ESC/Haskell and Sound Haskell, which provide mechanisms for doing some of the things you want. I don't think they integrate with type classes in the way you mention, but I think that is just a question of syntax. http://www.cl.cam.ac.uk/~nx200/ Thanks Neil

RE: [Haskell-cafe] code generation

2008-10-21 Thread Mitchell, Neil
We try to learn functional programs from examples, but our system is not yet ported to Haskell, though we are working on it. However, we thought about using TH. Do you have any pointers to papers, etc. ? You'll find our project, system and papers here:

RE: [Haskell-cafe] Re: Is there already an abstraction for this?

2008-10-20 Thread Mitchell, Neil
Hi Larry, There is already an abstraction for this, its called transform, and it resides in the Uniplate library: http://www-users.cs.york.ac.uk/~ndm/uniplate/ I have no idea what it is, or if it exists in the algebra library! Thanks Neil -Original Message- From: [EMAIL PROTECTED]

RE: [Haskell-cafe] Object-oriented programming, Haskell and existentials

2008-10-16 Thread Mitchell, Neil
Yes, hbc had existential types around 1993. I've used an encoding of existentials in O'Caml (well F#), and it works, but I find it painful. And when a very smart but non-CS person saw it his mind boggled, whereas he understood the existential version just fine. I'm a CS person, and when

RE: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Mitchell, Neil
Hi I didn't understand Monads until I read this: http://www.haskell.org/haskellwiki/Monads_as_Containers It took me quite a long time to get them too, but slowly over time it will sink in. Thanks Neil From: [EMAIL PROTECTED] [mailto:[EMAIL

RE: [Haskell-cafe] Constraints at construction

2008-10-09 Thread Mitchell, Neil
Hi Iain, The wiki page has quite a nice article: http://www.haskell.org/haskellwiki/Smart_constructors Thanks Neil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iain Barnett Sent: 09 October 2008 2:03 pm To: haskell-cafe@haskell.org Subject:

RE: [Haskell-cafe] Darcs / Git

2008-10-08 Thread Mitchell, Neil
Yes, I've used SSH key. Didn't think it would be different with a password. It really is! :-) Thanks Neil On 7 Oct 2008, at 20:19, Mitchell, Neil wrote: I use darcs on Windows every day and it works well. The only problem is that it is not very usable if you access your

RE: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-07 Thread Mitchell, Neil
Actually, I was thinking more along the lines of Data.Traversable.sequence, which has sequence :: (Traversable t, Monad m) = t (m a) - m (t a) Are you expecting c1 (:: * - * - *) to unify with [] (:: * - *)? That seems kind incorrect at the very last. Additionally, those types

RE: [Haskell-cafe] Darcs / Git

2008-10-07 Thread Mitchell, Neil
I use darcs on Windows every day and it works well. The only problem is that it is not very usable if you access your repository via SSH and the authentication is via password. Why not? It worked fine for me. It's never worked for me, I always get a frozen darcs trying to read a

RE: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-06 Thread Mitchell, Neil
Hi Try doing a Hoogle search for c1 (c2 x) - c2 (c1 x). Hoogle correctly states that Data.Traversable.sequence will do it for you. Now try doing c1 k (c2 x) - c2 (c1 k x). The 'sequence' function will also do this, but now Hoogle returns 0 results. This is puzzling, since AFAIK, the

RE: [Haskell-cafe] Hmm, what license to use?

2008-10-03 Thread Mitchell, Neil
Hi You mean shared libraries without the opportunity to inline library code? This would result in a huge performance loss, I think. Usually _mild_ performance loss, in exchange for major code-size savings, I would think. C obviously has worked quite fine under exactly this

RE: [Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-03 Thread Mitchell, Neil
Quoting Lennart Augustsson [EMAIL PROTECTED]: But I called it One. I did a similar one for Yhc, and I think I called it Box. My guess was that boxing/unboxing wasn't an overloaded enough term :-) Thanks Neil ==

RE: [Haskell-cafe] One liner?

2008-10-02 Thread Mitchell, Neil
Hi You can translate this step by step. main = do dc - getDirectoryContents ./foo/ mapM_ putStrLn dc Translating out the do notation (http://www.haskell.org/haskellwiki/Keywords#do): main = getDirectoryContents = \dc - mapM_ putStrLn dc Then we can chop out the dc argument,

RE: [Haskell-cafe] One liner?

2008-10-02 Thread Mitchell, Neil
main = do dc - getDirectoryContents ./foo/ mapM_ putStrLn dc Translating out the do notation (http://www.haskell.org/haskellwiki/Keywords#do): main = getDirectoryContents = \dc - mapM_ putStrLn dc Woops, I lost ./foo/ here, but it should be fairly easy to insert through

RE: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Mitchell, Neil
The error comes from using QuickCheck 2, which happens to also use the operator (). I can see two ways to solve the problem: (1) Add 2 after QuickCheck in the Wired.cabal file. (2) Add hiding (()) after import Test.QuickCheck in Data/Hardware/Internal.hs Emil, my

RE: [Haskell-cafe] Haskell versus F#, OCaml, et. al. ...

2008-09-30 Thread Mitchell, Neil
Hi, For libraries F# is probably superior to all, as it has libraries for virtually everything, and can interoperate seamlessly with COM and .NET. I doubt there will be any library functionality that can't be found or bought. Thanks Neil -- Hello,

RE: [Haskell-cafe] Total Functional Programming in Haskell

2008-09-30 Thread Mitchell, Neil
Hi 1) Total Functional Programming is great. But a combination of Approve and Catch gives you termination and pattern-match safety checks for Haskell, giving you all the advantages of TFP without forcing you to write total patterns etc. Plus you can use all the Haskell tools. In reality, neither

RE: [Haskell-cafe] Haskell versus F#, OCaml, et. al. ...

2008-09-30 Thread Mitchell, Neil
For libraries F# is probably superior to all, as it has libraries for virtually everything, and can interoperate seamlessly with COM and .NET. I doubt there will be any library functionality that can't be found or bought. Libraries for monad transformers I found lots of stuff

RE: [Haskell-cafe] Total Functional Programming in Haskell

2008-09-30 Thread Mitchell, Neil
Hi for little more than personal taste). In particular, I'd like to see a reasoning framework for partial functions, so you could state and prove a property like: length [1..] = _|_ In a compiler, with: default(Int) main = print $ length [1..] Results in 2147483647 I don't think

RE: [Haskell-cafe] TH error

2008-09-29 Thread Mitchell, Neil
Hi Tim, You seem to be duplicating the functionality of Data.Derive to some extent: http://www.cs.york.ac.uk/~ndm/derive/ You might find it easier to use that tool, and if it doesn't meet your needs send in a patch :-) Thanks Neil -Original Message- From: [EMAIL PROTECTED]

RE: [Haskell-cafe] Re: Haddock + Hoogle == Javadoc on steroids

2008-09-29 Thread Mitchell, Neil
Hi Simon, http://joyful.com/repos/darcs-sm/api-doc is a mashup of haddock, hoogle and hscolour (and darcsweb, darcs-graph - see http://joyful.com/repos). I can see the Haddock information, but not the Hoogle/HsColour mashup. I'm using Firefox 3. Am I missing something? How do you get

[Haskell-cafe] Code.haskell.org down

2008-09-29 Thread Mitchell, Neil
Hi, For me, it seems that code.haskell.org is down. Is this the case for other people as well? It seems code.haskell.org regularly looses connectivity for me :-( Thanks Neil == Please access the attached hyperlink

RE: [Haskell-cafe] Code.haskell.org down

2008-09-29 Thread Mitchell, Neil
Hi http://downforeveryoneorjustme.com/code.haskell.org sez: It's just you. code.haskell.org is up. Now its up for me as well. It's a little annoying that code.haskell.org seems so flakey. (Seriously though, the above site is a great tool for such circumstances.) That is a great site,

RE: [Haskell-cafe] readFile and closing a file

2008-09-17 Thread Mitchell, Neil
Hi Henning, I tend to use openFile, hGetContents, hClose - your initial readFile like call should be openFile/hGetContents, which gives you a lazy stream, and on a parse error call hClose. Thanks Neil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of

RE: [Haskell-cafe] about openTempFile

2008-09-17 Thread Mitchell, Neil
But since GHC does not implement such a function, I was curious to know why it don't even implement a function that make sure the temporary file is removed. Because it is two lines to write, so no one has yet proposed it for the base library. Map is 2 lines, but we have that as a