Re: [Haskell-cafe] view patterns

2008-11-04 Thread Bulat Ziganshin
Hello Cetin, Wednesday, November 5, 2008, 8:34:14 AM, you wrote: > let emp (has -> True) = False; emp (has -> False) = True >     Warning: Pattern match(es) are overlapped proibably it's because GHC can't check view patterns for overlaps? -- Best regards, Bulatm

Re: [Haskell-cafe] Re: Automatic parallelism in Haskell, similar to "make -j4"?

2008-11-04 Thread Bulat Ziganshin
Hello Chad, Wednesday, November 5, 2008, 6:34:01 AM, you wrote: > ghc --make -j4 Foo.hs afair, it was implemented and not shown speed improvements. ask Simon -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Caf

Re: [Haskell-cafe] pure programs

2008-11-04 Thread Bulat Ziganshin
Hello Jason, Wednesday, November 5, 2008, 3:12:29 AM, you wrote: > Many useful programs that I would like to write in Haskell > don't fall into this category -- for example, network servers > -- but a lot of their components do. Can these components can > be Haskell functions without IO i

[Haskell-cafe] view patterns

2008-11-04 Thread Cetin Sert
let has [] = False; has _ = True -- this one is ok let empty list = case has list of True -> False; False -> True -- the following is problematic let emp (has -> True) = False; emp (has -> False) = True :1:4: Warning: Pattern match(es) are overlapped In the definition of `emp':

Re: [Haskell-cafe] Re: Automatic parallelism in Haskell, similar to "make -j4"?

2008-11-04 Thread Alexander Dunlap
On Tue, Nov 4, 2008 at 7:34 PM, Chad Scherrer <[EMAIL PROTECTED]> wrote: > T Willingham gmail.com> writes: >> I am thinking of our troglodytic friend 'make', which will run (for >> example) 4 parallel jobs when given the option "make -j4". Even >> 'rake', the ruby version of make, now has a branc

[Haskell-cafe] Re: Automatic parallelism in Haskell, similar to "make -j4"?

2008-11-04 Thread Chad Scherrer
T Willingham gmail.com> writes: > I am thinking of our troglodytic friend 'make', which will run (for > example) 4 parallel jobs when given the option "make -j4". Even > 'rake', the ruby version of make, now has a branch (called drake) > which does the parallel -j option. >From the replies I've

Re: [Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread ajb
G'day all. Quoting Achim Schneider <[EMAIL PROTECTED]>: Considering that he's talking about a mud, I figure the grammar is a quite straightforward command = l[eft] | r[ight] | ... | t[ake] | c[ast] That is, I'd be very surprised if you even need more than two or three characters lookahead,

Re: [Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread ajb
G'day all. Quoting Achim Schneider <[EMAIL PROTECTED]>: Considering that he's talking about a mud, I figure the grammar is a quite straightforward command = l[eft] | r[ight] | ... | t[ake] | c[ast] That is, I'd be very surprised if you even need more than two or three characters lookahead,

Re: [Haskell-cafe] HXT/Practical/Weather.hs difficulties

2008-11-04 Thread Brian Troutwine
Oh my, how silly of me. The page has moved to http://www.weather.gov/xml/current_obs/KAGC.xml ! Firefox simply follows the redirect. Thanks for the putStrLn suggestion, George. On Tue, Nov 4, 2008 at 5:28 PM, George Pollard <[EMAIL PROTECTED]> wrote: > On Tue, 2008-11-04 at 17:04 -0800, Brian Tro

[Haskell-cafe] HXT/Practical/Weather.hs difficulties

2008-11-04 Thread Brian Troutwine
Hello all, I'm working through the practical HXT examples and have gotten stumped with the weather example[1]. I'm using GHC 6.8.3 and HXT 8.1.0. I compile the example like so... > [EMAIL PROTECTED]:~ > $ ghc --make weather.hs > [1 of 1] Compiling Main ( weather.hs, weather.o ) > Link

Re: [Haskell-cafe] pure programs

2008-11-04 Thread Brandon S. Allbery KF8NH
On 2008 Nov 4, at 19:12, Jason Dusek wrote: Many useful programs that I would like to write in Haskell don't fall into this category -- for example, network servers -- but a lot of their components do. Can these components can be Haskell functions without IO in their signatures? I'm workin

Re: [Haskell-cafe] pure programs

2008-11-04 Thread Jamie Brandon
You're essentially describing functional reactive programming. You end up with the system being described as pure, reactive values and plugging IO based streams in at the edges. Have a look at the wiki description (http://www.haskell.org/haskellwiki/Functional_Reactive_Programming) and especially

[Haskell-cafe] pure programs

2008-11-04 Thread Jason Dusek
Informally, a "pure program" an executable such that the stream of bytes entering it totally determines the stream of bytes leaving it. Many useful programs that I would like to write in Haskell don't fall into this category -- for example, network servers -- but a lot of their compone

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-04 Thread Lennart Augustsson
Nonsense, isum is strict in s. If s is bottom, isum will always return bottom. This is the definition of being strict. -- Lennart On Mon, Nov 3, 2008 at 10:35 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > frantisek.kocun: >>yet I need to add a $! to the recursive call of isum to get a truly

Re: [Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Bas van Dijk
On Wed, Nov 5, 2008 at 12:43 AM, Bas van Dijk <[EMAIL PROTECTED]> wrote: > 2008/11/5 Daryoush Mehrtash <[EMAIL PROTECTED]>: >> Are there cases (function or list) where the result of foldl (or foldr)would >> be different that foldl' (or foldr')? > > Maybe this wiki article I wrote some time ago will

Re: [Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Bas van Dijk
2008/11/5 Daryoush Mehrtash <[EMAIL PROTECTED]>: > Are there cases (function or list) where the result of foldl (or foldr)would > be different that foldl' (or foldr')? Maybe this wiki article I wrote some time ago will answer your question: http://haskell.org/haskellwiki/Foldr_Foldl_Foldl' regar

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-04 Thread Derek Elkins
On Tue, 2008-11-04 at 12:18 +0100, Patai Gergely wrote: > Thanks everyone for the answers. I understood the underlying mechanism, > and I did see that turning on optimisation helps, as I said in the > comments. I just wasn't aware that this analysis is not turned on by > default, my bad for not rea

Re: [Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread Derek Elkins
On Tue, 2008-11-04 at 10:02 -0800, Dan Piponi wrote: > On Tue, Nov 4, 2008 at 9:26 AM, Achim Schneider <[EMAIL PROTECTED]> wrote: > > Martijn van Steenbergen <[EMAIL PROTECTED]> wrote: > > For anything remotely connected to parsing, always use parsec. > > > > I'd not be surprised if the beast is to

Re: [Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Daniel Fischer
Am Mittwoch, 5. November 2008 00:08 schrieb Daryoush Mehrtash: > Are there cases (function or list) where the result of foldl (or > foldr)would be different that foldl' (or foldr')? > > thanks, > > daryoush Simple example: import Data.List weird :: Int -> Int -> Int weird _ 0 = 0 weird x y = x*y

Re: [Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Derek Elkins
On Tue, 2008-11-04 at 15:08 -0800, Daryoush Mehrtash wrote: > > Are there cases (function or list) where the result of foldl (or > foldr)would be different that foldl' (or foldr')? There is no foldr'. And yes, foldl and foldl' are different functions and thus return different results on some inp

[Haskell-cafe] Re: foldl vs foldl'

2008-11-04 Thread Achim Schneider
"Daryoush Mehrtash" <[EMAIL PROTECTED]> wrote: > Are there cases (function or list) where the result of foldl (or > foldr)would be different that foldl' (or foldr')? > Yes, in two cases folds can differ: a) You've got an infinite list, in which case you don't want to go to the end of it before s

[Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Daryoush Mehrtash
Are there cases (function or list) where the result of foldl (or foldr)would be different that foldl' (or foldr')? thanks, daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Efficient parallel regular expressions

2008-11-04 Thread Martin DeMello
On Tue, Nov 4, 2008 at 9:05 AM, Martijn van Steenbergen <[EMAIL PROTECTED]> wrote: > > For my mud client Yogurt (see hackage) I'm currently working on > improving the efficiency of the hooks. Right now several hooks, each > consisting of a regex and an action can be active at the same time. > Every

Re: [Haskell-cafe] HDBC Oracle bindings(?/!)

2008-11-04 Thread Thiago Arrais
John, On Thu, Oct 30, 2008 at 2:48 PM, John Goerzen <[EMAIL PROTECTED]> wrote: > I would certainly happily reference anyone's native Oracle HDBC > backend too, though! You may want to reference mine, given that there aren't any others currently. Just be aware that it really isn't ready for mass c

Re: [Haskell-cafe] HDBC Oracle bindings(?/!)

2008-11-04 Thread Thiago Arrais
On Thu, Oct 30, 2008 at 11:53 AM, Daniil Elovkov <[EMAIL PROTECTED]> wrote: > Yes, HSQL supports Oracle natively, through OCI. hsql-oracle isn't on > hackage, only in the repository. That's exactly what I was looking for, but for HDBC instead. Since OCI bindings for HDBC don't seem to exist, I gue

Re: [Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread pierre
On Tue, Nov 04, 2008 at 08:34:37PM +0100, Achim Schneider wrote: > > Parsec is a thousand times more efficient for such things than regular > expressions, and you can just lazily parse all the input into a list > of data constructors and happily fold it into your state... I would recommend you to

[Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread ChrisK
The regex-tdfa package (and regex-posix) implement subexpressions capture. So if you want to match alpha beta and gamma in parallel you could write "(alpha)|(beta)|(gamma)" and check which subexpression has the non-empty match. This becomes slightly complicated if there are parenthesis and capt

[Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread Achim Schneider
"Dan Piponi" <[EMAIL PROTECTED]> wrote: > On Tue, Nov 4, 2008 at 9:26 AM, Achim Schneider <[EMAIL PROTECTED]> > wrote: > > Martijn van Steenbergen <[EMAIL PROTECTED]> wrote: > > For anything remotely connected to parsing, always use parsec. > > > > I'd not be surprised if the beast is touring comp

Re: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-11-04 Thread Sebastian Sylvan
On Mon, Nov 3, 2008 at 3:45 PM, Svein Ove Aas <[EMAIL PROTECTED]> wrote: > On Mon, Nov 3, 2008 at 11:31 AM, Tobias Bexelius > <[EMAIL PROTECTED]> wrote: > > Before Direct3D 10, its too costly to read back the updated vertex data > > in every frame, which force you to make this kind of operations o

Re: [Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread Dan Piponi
On Tue, Nov 4, 2008 at 9:26 AM, Achim Schneider <[EMAIL PROTECTED]> wrote: > Martijn van Steenbergen <[EMAIL PROTECTED]> wrote: > For anything remotely connected to parsing, always use parsec. > > I'd not be surprised if the beast is touring complete in itself... Actually, this can count against y

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 a+b+c+d,

Re: [Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread Jonathan Cast
On Tue, 2008-11-04 at 18:26 +0100, Achim Schneider wrote: > Martijn van Steenbergen <[EMAIL PROTECTED]> wrote: > > > Does anyone have any experience with this? What's the best way to > > achieve this? > > > For anything remotely connected to parsing, always use parsec. > > I'd not be surprised

[Haskell-cafe] Re: Efficient parallel regular expressions

2008-11-04 Thread Achim Schneider
Martijn van Steenbergen <[EMAIL PROTECTED]> wrote: > Does anyone have any experience with this? What's the best way to > achieve this? > For anything remotely connected to parsing, always use parsec. I'd not be surprised if the beast is touring complete in itself... or can parse something that

[Haskell-cafe] Efficient parallel regular expressions

2008-11-04 Thread Martijn van Steenbergen
Hello all, For my mud client Yogurt (see hackage) I'm currently working on improving the efficiency of the hooks. Right now several hooks, each consisting of a regex and an action can be active at the same time. Every time a line of input is available (usually several times a second) I run the li

[Haskell-cafe] announce [("InfixApplicative", 1.0), ("OpenGLCheck", 1.0), ("obj", 0.1)]

2008-11-04 Thread Thomas Davie
Dear Haskellers, I've just uploaded a few packages to Hackage which I have produced while working at Anygma. I thought that people might be interested in knowing about these: obj-0.1: A library for loading and writing obj 3D models. This is still an early version and rather limited, bu

[Haskell-cafe] Re: Syntax question regarding 'import'

2008-11-04 Thread Maurí­cio
>> About this teste code: >> >> module Main (main) where { >> import Foreign hiding (unsafePerformIO,Foreign.Ptr,Data.Bits,) ; >> blo = xor 10 10 :: Int ; >> main = return () >> } >> > You're only hiding the typeclass Data.Bits, not > the function xor. To do that, you have to write > > import For

[Haskell-cafe] Re: Syntax question regarding 'import'

2008-11-04 Thread Achim Schneider
Maurcio <[EMAIL PROTECTED]> wrote: > About this teste code: > > module Main (main) where { > import Foreign hiding (unsafePerformIO,Foreign.Ptr,Data.Bits,) ; > blo = xor 10 10 :: Int ; > main = return () > } > You're only hiding the typeclass Data.Bits, not the function xor. To do that, you

Re: [Haskell-cafe] Syntax question regarding 'import'

2008-11-04 Thread Bulat Ziganshin
Hello Maurí­cio, Tuesday, November 4, 2008, 3:47:17 PM, you wrote: > Haskell syntax allows a comma at the end of names > to be imported or exported, like in the second > line. What does that mean? it simplifies editiing of lists: you can add/remove lines without changing surrounding ones: impor

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

[Haskell-cafe] Syntax question regarding 'import'

2008-11-04 Thread Maurí­cio
Hi, About this teste code: module Main (main) where { import Foreign hiding (unsafePerformIO,Foreign.Ptr,Data.Bits,) ; blo = xor 10 10 :: Int ; main = return () } Data.Bits is in the 'hiding' list. According to the syntax reference, this seems not to be allowed. GHC allows it, but do allow foll

Re: [Haskell-cafe] code generation

2008-11-04 Thread Martin Hofmann
Sorry for referring to a post, a bit ago. > http://www-users.cs.york.ac.uk/~ndm/derive/ (Deriving Generic Functions > by Example). > Thanks for the pointer, it was already on my to-read-pile :-) > I think using Template Haskell for your work would fit very nicely, so > is a good choice to learn

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-04 Thread Ketil Malde
"Patai Gergely" <[EMAIL PROTECTED]> writes: > My only problem is that if I try to write a program without > thinking about performance first and not bothering with annotations as > long as "it works", I end up with something that's practically > impossible to profile as the costs spread everywhere

[Haskell-cafe] Re: Problems with strictness analysis?

2008-11-04 Thread Dominic Steinitz
wren ng thornton freegeek.org> writes: [snick] > > isum 0 s = s > > isum n s = isum (n-1) (s+n) > > This is tail recursive, and will be optimized to an iterative loop; [snick] > > In terms of having a compiler 'smart enough', it's not clear that > functions of this sort ought to be inferre

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-04 Thread Patai Gergely
Thanks everyone for the answers. I understood the underlying mechanism, and I did see that turning on optimisation helps, as I said in the comments. I just wasn't aware that this analysis is not turned on by default, my bad for not reading the FM. So the final verdict is that type and strictness a

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-04 Thread Kim-Ee Yeoh
David Menendez-2 wrote: > >> On Mon, 3 Nov 2008, Luke Palmer wrote: >> >> I was actually being an annoying purist. "f is strict" means "f _|_ = >> _|_", so strictness is a semantic idea, not an operational one. > > I think Luke was commenting on the terminology, not the optimization. > We have

Re: [Haskell-cafe] Network.FastCGI does not emit stderr outputs to lighttpd's error.log?

2008-11-04 Thread Bjorn Bringert
On Thu, Jul 31, 2008 at 6:37 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > agentzh: >> On Thu, Jul 31, 2008 at 1:56 AM, Don Stewart <[EMAIL PROTECTED]> wrote: >> > >> > We've had no problems with this and apache at least. Is lighttpd >> > doing something funny with error logging? >> >> It seems that

Re[2]: [Haskell-cafe] a minimal Windows program in Haskell?

2008-11-04 Thread Bulat Ziganshin
Hello Nun, Monday, November 3, 2008, 11:53:08 PM, you wrote: > 2) the Win32 package in this link gives a type error during the > "setup build" phase (expecting exception and given ioerror?) but you > can compile the example against the Win32 package in ghc 6.8.3 of course - it's written against

[Haskell-cafe] Re: ANNOUNCE: Graphalyze-0.5 and SourceGraph-0.3

2008-11-04 Thread Ivan Lazar Miljenovic
Achim Schneider web.de> writes: > > > That's about what I meant with a screenshot. Linking a copy of the html > generated for e.g. the Prelude would greatly help people who are just > browsing Hackage and are trying to figure out what your package is all > about. > Well, I can't do the Prelude

Re: [Haskell-cafe] Typeable and Dynamic

2008-11-04 Thread Luke Palmer
On Mon, Nov 3, 2008 at 7:55 PM, minh thu <[EMAIL PROTECTED]> wrote: > Well, it seems you can't really write > > (fromJust . fromDynamic) someDynamic > > without giving the type of what you expect. Well not by itself. But context will usually determine the type. For example: putStrLn . fromJu

[Haskell-cafe] Re: Typeable and Dynamic

2008-11-04 Thread minh thu
2008/11/4, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > minh thu asked a tricky question, about writing > > extract :: Typeable a => TypeRep -> Dynamic -> a > > The question here is what determines the type 'a'. One answer is that > 'a' is determined from the context, e.g., >(extract tr dyn)