Re: [Haskell] Probably a trivial thing for people knowing Haskell

2008-10-20 Thread Udo Stenzel
Friedrich wrote: > Taral <[EMAIL PROTECTED]> writes: > > Wow, talk about doing everything by hand. :) There are a lot of > > utility functions that make your life easier. Try this: Given a strict pair, it should work: > > import Control.Monad > > import Data.Char > > import Data.List > > import S

Re: [Haskell] Probably a trivial thing for people knowing Haskell

2008-10-20 Thread Udo Stenzel
> Friedrich wrote: > >Ok to be more concrete is the laziness "hidden" here? > > > >check_line line sum count = > >let match = matchRegex regexp line > >in case match of > > Just strs -> (sum + read (head strs) :: Integer, count + 1) > > Nothing -> (sum, co

Re: [Haskell] Re: Trying to install binary-0.4

2007-10-21 Thread Udo Stenzel
Duncan Coutts wrote: > New tarball releases of Cabal-1.2.1, bytestring-0.9, binary-0.4.1, tar > and others (zlib, bzlib, iconv) will appear on hackage in the next few > days. I just tried one of them, iconv. First it wants a recent cabal; that's fine, I installed the darcs version. Then I get th

Re: [Haskell] Re: Trying to install binary-0.4

2007-10-18 Thread Udo Stenzel
Don Stewart wrote: > If I understand correctly, the main issue for Udo is simply that the > MonadFix instance is required by his code, and isn't available in binary > 0.3 -- the version to be used on earlier GHCs. Is that right Udo? No, the issue is that nothing works. It turns out that I actuall

Re: [Haskell] Re: Trying to install binary-0.4

2007-10-14 Thread Udo Stenzel
Ian Lynagh wrote: > People interested in making it easy to use new versions of packages with > old compiler releases can make a small script that installs empty Cabal > packages called bytestring, containers, array, etc. That completely misses the fact that bytestring cannot be upgraded, no matter

Re: [Haskell] Re: Trying to install binary-0.4

2007-10-14 Thread Udo Stenzel
Bjorn Bringert wrote: > The tar package uses System.PosixCompat from the unix-compat package > to also work under non-posix systems (read Windows). This dependency > is listed in the tar.cabal file (see http://hackage.haskell.org/ > packages/archive/tar/0.1/tar.cabal). System.Posix was never r

Re: [Haskell] Re: Trying to install binary-0.4

2007-10-13 Thread Udo Stenzel
Simon Marlow wrote: > >- Provide a known good cabal. Make sure it installs on GHC 6.6 and 6.4. > > Cabal 1.2 works all the way back to GHC 6.2. The recommended way to build > new packages with an old GHC will be to upgrade Cabal first. Can it be installed by a user? Because I think my GHC 6.4

Re: [Haskell] Re: Trying to install binary-0.4

2007-10-12 Thread Udo Stenzel
Udo Stenzel wrote: > - install exactly one version of cabal, 1.1.6.2, and *remove* all > others, > - ask ghc-pkg for the description of base, then edit Data.ByteString out > of that and re-register it, I forgot, I also tried tar-1.0 on GHC 6.6, and had the same problem there.

[Haskell] Re: Trying to install binary-0.4

2007-10-11 Thread Udo Stenzel
Don Stewart wrote: > Since you're not using ghc 6.8, you should use binary 0.3 :) That was PC for "sorry, GHC 6.6 is no longer supported and don't even ask about 6.4" The other day I tried to install the tar library on a GHC 6.4. It's nearly impossible. The old base library gets in the way of i

Re: [Haskell] Fwd: Mutually dependent functions

2007-06-12 Thread Udo Stenzel
Michael Speer wrote: > test x y = ( "World" , x , x ++ " " ++ y ) > main = let ( a , b , c ) = test "Hello" a > in do > print $ ( a , b , c ) This works, but in your code you actually wrote let ( ( a, b, c ), ( d, e, f ), ( g, h, i ) ) = ( foo, bar, baz ) with the right side in

Re: [Haskell] Newbie: what are the advantages of Haskell?

2007-04-28 Thread Udo Stenzel
[EMAIL PROTECTED] wrote: > what are the advantages of haskell over semi-functional programming languages > such as Perl, Common Lisp, etc.? A fundamental building block that is superior in maintainability and reusability to objects and procedures, a type system that is actually of help and not a h

Re: [Haskell] Re: Newbie: what are the advantages of Haskell?

2007-04-28 Thread Udo Stenzel
Michael T. Richter wrote: > I wish I knew the language better so I could start working on > those libraries. Which ones? "those libraries" cannot come into existence until someone says what's actually missing. (The bulk of CPAN is crap and is certainly not worth being reimplemented.) -Udo --

Re: Re[2]: [Haskell] [Haskell - I/O] Problem with 'readFile'

2006-08-27 Thread Udo Stenzel
Bulat Ziganshin wrote: > > length mates_str `seq` return () > > it's the same. i recommend you to use: > > return $! tail mates_str > > 'tail' should be slightly faster than 'len' ...but also slightly less correct. You probably meant 'last'. (But it's still an ugly and dangerous programming

Re: [Haskell] [Haskell - I/O] Problem with 'readFile'

2006-08-27 Thread Udo Stenzel
L. J. wrote: > Hi, I use the operation 'readFile' [...] > > How can I break that semi-closed handle for to write in the > preaviously readed file? Thank you. Not at all. But you can get the same effect you get from 'readFile' if you use 'openFile' and 'hGetContents'. If you do the latter, you c

Re: [Haskell] rawSystem unpredictable with signals

2006-07-06 Thread Udo Stenzel
John Goerzen wrote: > When I hit Ctrl-C while the child process is running, sometimes: > > 1) rawSystem returns ExitSuccess > > or > > 2) rawSystem raises an IOError saying the child terminated with a > signal > > I am totally at a loss as to explain this difference in behavior. I > woul

Re: [Haskell] Re: Haskell Digest, Vol 31, Issue 15

2006-03-17 Thread Udo Stenzel
minh thu wrote: > to be clear, the data structure i'm thinking of is the "half edge" or > "winged edge" this would involve a cyclic structure, and you want to update that. I don't think there's a purely functional way to implement that, and if there is, it wouldn't allow O(1) modifications. So i

Re: [Haskell] haskell.org Public Domain

2006-01-10 Thread Udo Stenzel
Wolfgang Jeltsch wrote: > There is already one important objection written on the wiki: You cannot put > your work into the public domain in every country. So instead you license it under the conditions of "Do whatever you please with it, but don't bug me", which is what is commonly understood as

Re: [Haskell] Re: License for haskell.org content

2006-01-09 Thread Udo Stenzel
Ketil Malde wrote: > Another option is the Open Publication License, which requires > acknowledgement (but little else). ...which would mean that whenever you rearrange something inside the wiki, you'd have to drag signatures around (and god forbid you accidentally drop a single one). The only wa

Re: [Haskell] Re: Making Haskell more open

2005-11-11 Thread Udo Stenzel
Not that I have any emotional attachment to MoinMoin, which the hawiki is based on, but... Ashley Yakeley wrote: > I would much prefer to use a MediaWiki than > the existing hawiki. Particularly valuable are the elimination of > RunTogetherWordLinks and the separation of article and talk spaces

Re: [Haskell] PROPOSAL: class aliases

2005-10-15 Thread Udo Stenzel
Wolfgang Jeltsch wrote: > This does mean that you want to treat classes without methods special, > doesn't > it? Not quite, I'm actually not sure if I want this, I just noted that it was possible. :) As David Menendez pointed out, empty classes probably aren't that useless. Anyway, not treatin

Re: [Haskell] PROPOSAL: class aliases

2005-10-13 Thread Udo Stenzel
Simon Peyton-Jones wrote: > I've considered this before, but never done anything about it because > superclasses are so close. Specifically, what is the difference between > > (i) class (C a, D a) => CD a > and > (ii) class alias CD a = (C a, D a) > > Note that (i) is Haskell 98. I was about

Re: Re[2]: [Haskell] Mixing monadic and non-monadic functions

2005-09-16 Thread Udo Stenzel
Bulat Ziganshin wrote: > i strongly support this suggestion. actually, i suggest the same for > dealing with references (IORef/MVar/...), for example: > > do x <- newIORef 0 >y <- newIORef 0 >z <- newIORef 0 >z := *x + *y -- translated to { x' <- readIORef x; y' <- readIORef y; > wr

Re: [Haskell] Random matrices

2005-08-23 Thread Udo Stenzel
Scherrer, Chad wrote: > I keep getting stack overflows, so I think my code must be too lazy somewhere > (that's what that means, right?) Most often, yes. Afaict, the best way to spot these leaks is to simulate lazy evaluation in your head. After fumbling with ghc's heap profiling facilities and

Re: [Haskell] stack overflow - nonobvious thunks?

2005-07-27 Thread Udo Stenzel
Scherrer, Chad wrote: > f m x = Map.insertWith (+) x 1 m insertWith is inserting the "nonobvious thunks". Internally it applies (+) to the old value and the new one, producing a thunk. There is no place you could put a seq or something to force the result. You basically need insertWith',

Re: [Haskell] threading mutable state through callbacks

2004-10-13 Thread Udo Stenzel
Wolfgang Thaller <[EMAIL PROTECTED]> schrieb am 13.10.04 04:36:43: > 2) Evaluation order. > > That's what everyone has been fighting about. > > So what are our options? > > a) unsafePerformIO - like. > b) Some predetermined order, with semantics like mdo: c) same as b) plus unsafeInterleaveIO

Re: literate comments

2003-10-16 Thread Udo Stenzel
begin [EMAIL PROTECTED] quote: > Quoting Steffen Mazanek <[EMAIL PROTECTED]>: > > > Would it make sense, to add a xml like code environment > > as well, e.g., ...? > > It's hard to say. The problem is that some Haskell characters are also > important for XML (e.g. <, &) and so you can't just c