Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-17 Thread Peter Lund
On Sun, 2007-12-16 at 15:21 -0800, Don Stewart wrote: An updated bytestring library is at : http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-0.9.0.2 Enjoy! :) Thanks! -Peter ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: Monads that are Comonads and the role of Adjunction

2007-12-17 Thread Yitzchak Gale
Derek Elkins wrote: There is another very closely related adjunction that is less often mentioned. ((-)-C)^op -| (-)-C or a - b - C ~ b - a - C This gives rise to the monad, M a = (a - C) - C this is also exactly the comonad it gives rise to (in the op category which ends up being the

[Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
I'm trying to teach myself HaskellI've spent a few hours going through a few tutorialsand I sort of get the basics... My interest in Haskell is specifically around the strength of the type system. After many years of OOP though my brain is wired up to construct software in that

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Thomas Davie
On 17 Dec 2007, at 10:46, Nicholls, Mark wrote: I can obviously at a later date add a new class Triangle, and not have to touch any of the above code…. Yes, and you can indeed do a similar thing in Haskell. The natural thing to do here would be to define a type Shape... data Shape =

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Ketil Malde
Nicholls, Mark [EMAIL PROTECTED] writes: After many years of OOP though my brain is wired up to construct software in that ?pattern??.a problem for me at the moment is I cannot see how to construct programs in an OO style in Haskell?.I know this is probably not the way to approach it?but I

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
OK I'll have to digest this and mess about a bitbut can I make an observation at this point If I define Shape like data Shape = Circle Int | Rectangle Int Int | Square Int Isn't this now closed...i.e. the statement is effectively defining that shape is this

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Thomas Davie
On 17 Dec 2007, at 11:14, Nicholls, Mark wrote: OK I'll have to digest this and mess about a bitbut can I make an observation at this point If I define Shape like data Shape = Circle Int | Rectangle Int Int | Square Int Isn't this now closed...i.e. the

[Haskell-cafe] Re: array documentation is missing

2007-12-17 Thread ChrisK
I have received patches which will help Cabal make ghc-6.6 and gc-6.8 friendly regex-tdfa. The problem below is from a change in STUArray from 3 to 4 parameters going from 6.6 to 6.8. I think adding another '_' to each pattern match makes it work for 6.8. Once I get these patches working

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
Ooo The constructor of a newtype must have exactly one field but `R' has two In the newtype declaration for `Rectangle' It doesn't like newtype Rectangle = R Int Int -Original Message- From: Thomas Davie [mailto:[EMAIL PROTECTED] Sent: 17 December 2007 11:04 To: Nicholls, Mark Cc:

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Stuart Cook
On Dec 17, 2007 10:47 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: The constructor of a newtype must have exactly one field but `R' has two In the newtype declaration for `Rectangle' It doesn't like newtype Rectangle = R Int Int A newtype can only have one constructor, with one argument,

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Jed Brown
On 17 Dec 2007, [EMAIL PROTECTED] wrote: Ooo The constructor of a newtype must have exactly one field but `R' has two In the newtype declaration for `Rectangle' It doesn't like newtype Rectangle = R Int Int You want data Rectangle = R Int Int A newtype declaration will be completely

Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte

2007-12-17 Thread Roberto Zunino
Dominic Steinitz wrote: Roberto Zunino wrote: This is the point: eta does not hold if seq exists. undefined `seq` 1 == undefined (\x - undefined x) `seq` 1 == 1 Ok I've never used seq and I've never used unsavePerformIO. Provided my program doesn't contain these then can I assume that eta

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
Ok... Thanks I need to revisit data and newtype to work out what the difference is I think. -Original Message- From: Jed Brown [mailto:[EMAIL PROTECTED] On Behalf Of Jed Brown Sent: 17 December 2007 12:04 To: Nicholls, Mark Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] OOP'er

[Haskell-cafe] Re: announcing darcs 2.0.0pre2

2007-12-17 Thread Simon Marlow
David Roundy wrote: I am pleased to announce the availability of the second prerelease of darcs two, darcs 2.0.0pre2. Thanks! Continuing my performance tests, I tried unpulling and re-pulling a bunch of patches in a GHC tree. I'm unpulling about 400 patches using --from-tag, and then

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Thomas Davie
On 17 Dec 2007, at 12:22, Nicholls, Mark wrote: Ok... Thanks I need to revisit data and newtype to work out what the difference is I think. Beware in doing so -- type, and newtype are not the same either. type creates a type synonim. That is, if I were to declare type Jam = Int then

[Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread apfelmus
Nicholls, Mark wrote: data Shape = Circle Int | Rectangle Int Int | Square Int Isn't this now closed...i.e. the statement is effectively defining that shape is this and only ever thisi.e. can I in another module add new types of Shape? Yes, but in most cases,

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
No that's fineits all as clear as mud!..but that's not your fault. To recap... type introduces a synonym for another type, no new type is createdit's for readabilities sake. Newtype introduces an isomorphic copy of an existing type...but doesn't copy it's type class

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Henning Thielemann
On Mon, 17 Dec 2007, Nicholls, Mark wrote: After many years of OOP though my brain is wired up to construct software in that 'pattern'a problem for me at the moment is I cannot see how to construct programs in an OO style in HaskellI know this is probably not the way to approach

RE: [Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
Not really with this... The open case (as in OO) seems to be more like the Haskell class construct, i.e. if new types declare themselves to be members of a class then they must satisfy certain constaintsI can then specify equals with the class and leave the onus on the implementor to

RE: [Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicholls, Mark The open case (as in OO) seems to be more like the Haskell class construct, i.e. if new types declare themselves to be members of a class then they must satisfy certain constaintsI can then specify equals

Re: [Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Sebastian Sylvan
On Dec 17, 2007 1:18 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: Not really with this... The open case (as in OO) seems to be more like the Haskell class construct, i.e. if new types declare themselves to be members of a class then they must satisfy certain constaintsI can then specify

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
Ahhh I'll give it a read. thanks -Original Message- From: Henning Thielemann [mailto:[EMAIL PROTECTED] Sent: 17 December 2007 13:05 To: Nicholls, Mark Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions. On Mon, 17 Dec 2007,

[Haskell-cafe] data vs newtype (was: OOP'er with (hopefully) trivial questions)

2007-12-17 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicholls, Mark To recap... type introduces a synonym for another type, no new type is createdit's for readabilities sake. Newtype introduces an isomorphic copy of an existing type...but doesn't copy it's type class

[Haskell-cafe] RE: data vs newtype (was: OOP'er with (hopefully) trivial questions)

2007-12-17 Thread Bayley, Alistair
From: Bayley, Alistair newtype A a = A a and data A a = A a Sorry, that should read: newtype A = A a data A = A a * Confidentiality Note: The information contained in this message, and any attachments, may contain

RE: [Haskell-cafe] RE: data vs newtype (was: OOP'er with (hopefully)trivial questions)

2007-12-17 Thread Bayley, Alistair
From: Bayley, Alistair Sorry, that should read: newtype A = A a data A = A a Ignore that; I was right first time. Sorry 'bout the spam, and the lack of brain. * Confidentiality Note: The information contained in this

Re: [Haskell-cafe] Re: Monads that are Comonads and the role of Adjunction

2007-12-17 Thread David Menendez
On Dec 17, 2007 4:34 AM, Yitzchak Gale [EMAIL PROTECTED] wrote: Derek Elkins wrote: There is another very closely related adjunction that is less often mentioned. ((-)-C)^op -| (-)-C or a - b - C ~ b - a - C This gives rise to the monad, M a = (a - C) - C this is also exactly

Re: [Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-17 Thread Paul Hudak
Certainly looks like a typo to me! Peter Verswyvelen wrote: While studying the vector space class in AFRP, I encountered the following strange code: class Floating a = VectorSpace v a | v - a where ... v1 ^-^ v2 = v1 ^+^ v1 -- (negateVector v2) I have no idea why the (negateVector v2)

Re: [Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread David Menendez
On Dec 17, 2007 8:18 AM, Nicholls, Mark [EMAIL PROTECTED] wrote: The approach is deliberate...but I accept may be harder than it needs to be...I'm interested in Haskell because of the alleged power/formality of it's type system against the relatively weakness of OO ones...the irony at the

[Haskell-cafe] Problem with a Win32 API

2007-12-17 Thread Eric
Dear all, When I run the program below a window appears for a split second, then disappears and the program exits. Can you help me figure out what's going wrong? *** import Graphics.Win32.Misc import Graphics.Win32.GDI.Types import Graphics.Win32.Window import System.Win32.DLL import

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Brent Yorgey
On Dec 17, 2007 8:04 AM, Nicholls, Mark [EMAIL PROTECTED] wrote: No that's fineits all as clear as mud!..but that's not your fault. To recap... type introduces a synonym for another type, no new type is createdit's for readabilities sake. Newtype introduces an isomorphic copy

Re: [Haskell-cafe] data vs newtype (was: OOP'er with (hopefully) trivial questions)

2007-12-17 Thread David Menendez
On Dec 17, 2007 8:51 AM, Bayley, Alistair [EMAIL PROTECTED] wrote: As an aside, I was wondering exactly what the differences are between newtype and data i.e. between newtype A a = A a and data A a = A a According to: http://www.haskell.org/onlinereport/decls.html#sect4.2.3

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
No neither do II think we can drop that bitI think I got confused about it for a second.not unsurprisingly. From: Brent Yorgey [mailto:[EMAIL PROTECTED] Sent: 17 December 2007 15:38 To: Nicholls, Mark Cc: Thomas Davie; Haskell Cafe Subject: Re:

Re: [Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-17 Thread Henrik Nilsson
Hi Peter, Oops! Yes, as Paul says, clearly an error. My best guess is that it was commented out at some point for testing something, and then forgotten! The error does not occur in my local copy of the code, so a version skew problem to boot, I'm afraid. Best, /Henrik -- Henrik Nilsson

RE: [Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-17 Thread Peter Verswyvelen
Maybe you could place Yampa in a Darcs depot? I will have some time now to study Yampa and apps again. To train myself, I would try to make a simple bouncing ball, then a Pong like game, and then I would like to convert the C++ minigames I made for my students. These might serve as simple

Re[2]: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Bulat Ziganshin
Hello Mark, Monday, December 17, 2007, 4:47:50 PM, you wrote: I'll give it a read. http://www.haskell.org/haskellwiki/OOP_vs_type_classes i recommend you to read two papers mentioned in References section there. at least i'm one of this page authors and i don't think that i had very good

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Wolfgang Jeltsch
Am Montag, 17. Dezember 2007 13:04 schrieb Jed Brown: […] When your type only has one constructor, newtype is preferred over data, but they are semantically equivalent. They are *not* semantically equivalent, as has already been said more or less. data adds an extra level of indirection.

Re: [Haskell-cafe] #haskell works

2007-12-17 Thread Andrew Coppin
Roman Leshchinskiy wrote: Andrew Coppin wrote: Then Mr C++ looked at it and said OMG! You don't *never* use strlen() inside a loop! and the second version was writting: Nice. I especially like the way it'll segfault if there is a blank at the end of the file. That's why I love C so much.

RE: Re[2]: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Nicholls, Mark
My Haskell is not up to understanding themI'm still writing hello world programswhat I read, gave me a good initial hint as to whats going on...I just need to get my Haskell going before I can jump in the deep end. -Original Message- From: Bulat Ziganshin [mailto:[EMAIL

Re: [Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-17 Thread Joel Reymont
On Dec 17, 2007, at 4:30 PM, Peter Verswyvelen wrote: Maybe you could place Yampa in a Darcs depot? darcs get http://wagerlabs.com/yampa I think we should move it to Google Code, though. -- http://wagerlabs.com ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-17 Thread Don Stewart
joelr1: On Dec 17, 2007, at 4:30 PM, Peter Verswyvelen wrote: Maybe you could place Yampa in a Darcs depot? darcs get http://wagerlabs.com/yampa I think we should move it to Google Code, though. How about code.haskell.org ? Get yr accounts here,

RE: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Peter Verswyvelen
Very interesting, I did not know that! I thought newtype was an optimization of data, and that newtype was bad terminology. But if newtype is just a wrapper around a type, then the name is choosen well. I'm a bit confused why then one needs a data-constructor-like tag to construct a newtype

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Ketil Malde
Thomas Davie [EMAIL PROTECTED] writes: Yes, and you can indeed do a similar thing in Haskell. The natural thing to do here would be to define a type Shape... data Shape = Circle Int | Rectangle Int Int | Square Int If however, you *really* want to keep your shapes

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Jules Bean
Peter Verswyvelen wrote: Very interesting, I did not know that! I thought newtype was an optimization of data, and that newtype was bad terminology. But if newtype is just a wrapper around a type, then the name is choosen well. I'm a bit confused why then one needs a data-constructor-like

[Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Peter Hercek
Thomas Davie wrote: Take a look at the Typable class. Although, pretty much any code that you can compile can be loaded into ghci without modification, and that's by far the easier way of finding the types of things. Is there a way to make ghci to know also the symbols which are not

[Haskell-cafe] list utilities -- shouldn't these be in the hierarchical libs somewhere?

2007-12-17 Thread Thomas Hartman
I found http://haskell.cs.yale.edu/haskell-report/List.html had many useful one off type list functions such as subsequences and permutations which are nowhere to be found in hoogle, Data.List, or the haskell hierarchical libs Shouldn't these be included somewhere? thomas. --- This

Re: [Haskell-cafe] data vs newtype (was: OOP'er with (hopefully) trivial questions)

2007-12-17 Thread Derek Elkins
On Mon, 2007-12-17 at 13:51 +, Bayley, Alistair wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicholls, Mark To recap... type introduces a synonym for another type, no new type is createdit's for readabilities sake. Newtype introduces an

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Evan Laforge
A newtype can only have one constructor, with one argument, and is essentially a wrapper for that argument type. In the general case, you want to use data instead of newtype: data Rectangle = R Int Int I'm sure there's a trivial explanation for this, but here's something that I've always

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Evan Laforge
I'm sure there's a trivial explanation for this, but here's something that I've always kind of wondered about: Given a single constructor type like data X = X A B C can't that be transformed into newtype X = X (A, B, C)? There must be some difference, because if there weren't we could

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Tim Chevalier
On 12/17/07, Evan Laforge [EMAIL PROTECTED] wrote: I'm sure there's a trivial explanation for this, but here's something that I've always kind of wondered about: Given a single constructor type like data X = X A B C can't that be transformed into newtype X = X (A, B, C)? There must be some

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Tim Chevalier
On 12/17/07, Evan Laforge [EMAIL PROTECTED] wrote: Oops, nevermind, I just saw the other thread and link to http://www.haskell.org/haskellwiki/Newtype. Ok, so that seems like a pretty subtle diffenence... I'm assuming the rationale behind differentiating between a single constructor data and

Re: [Haskell-cafe] Re: Monads that are Comonads and the role of Adjunction

2007-12-17 Thread Derek Elkins
On Mon, 2007-12-17 at 09:58 -0500, David Menendez wrote: On Dec 17, 2007 4:34 AM, Yitzchak Gale [EMAIL PROTECTED] wrote: Derek Elkins wrote: There is another very closely related adjunction that is less often mentioned. ((-)-C)^op -|

Re: [Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Luke Palmer
There was a thread about this recently. In any case, if you load the code interpreted (which happens if there is no .o or .hi file of the module lying around), then you can look inside all you want. But if it loads compiled, then you only have access to the exported symbols. The reason is

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Wolfgang Jeltsch
Am Montag, 17. Dezember 2007 19:26 schrieb Tim Chevalier: On 12/17/07, Evan Laforge [EMAIL PROTECTED] wrote: I'm sure there's a trivial explanation for this, but here's something that I've always kind of wondered about: Given a single constructor type like data X = X A B C can't that be

[Haskell-cafe] gtk2hs treeview problem (Windows)

2007-12-17 Thread Jian Fan
I installed ghc 6.6.1 and 0.9.12.1. I'm trying to use the tree view widget. To enable search in treeview, I added following 2 lines: New.treeViewAppendColumn view col3 -- my addition New.treeViewSetEnableSearch view True New.treeViewSetSearchColumn view 0 in demo/treeList/TreeDemo.hs

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Tim Chevalier
On 12/17/07, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: This is not a generalization of what you talked about. Why should the tuple type be unboxed? Tuple types are boxed, meaning there is a difference between _|_ and (_|_,…,_|_). If you write newtype X = X (A, B, C) then X doesn't

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Miguel Mitrofanov
There's a third way, too, and I haven't seen anybody mention it yet I've noticed it, but there are some problems with this representation, so I decided not to mention it. It's OK as far as we don't want functions working on two areas - I don't see, how we can implement, say, intersect ::

[Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Andre Nathan
Hello (Newbie question ahead :) I'm trying to write a program which will build a tree (here represented as a Map) of unix processes. The tree should be built by reading the process information stored in /proc/PID/status. There is also another Map which will be used for faster insertions on the

Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte

2007-12-17 Thread Corey O'Connor
Excellent! This has all been very helpful. Thanks a lot everybody! :-) -Corey On 12/14/07, Benja Fallenstein [EMAIL PROTECTED] wrote: Hi Corey, On Dec 14, 2007 8:44 PM, Corey O'Connor [EMAIL PROTECTED] wrote: The reason I find all this odd is because I'm not sure how the type class Functor

[Haskell-cafe] Re: OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Peter Hercek
Luke Palmer wrote: There was a thread about this recently. In any case, if you load the code interpreted (which happens if there is no .o or .hi file of the module lying around), then you can look inside all you want. But if it loads compiled, then you only have access to the exported symbols.

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Evan Laforge
I interpreted Evan's question as why can't you have newtypes with multiple fields? -- i.e., newtype X = X A B C -- and that's the question I was answering. But maybe I misunderstood. Well, the question was both, and strictness answers both. Thanks for the clarification. I should have

[Haskell-cafe] Re: Is StateT what I need?

2007-12-17 Thread ChrisK
Andre Nathan wrote: Hello (Newbie question ahead : I tried this for insertProc, but it obviously doesn't work... what would be the correct way to do this? insertProc :: Pid - StateT PsMap IO PsInfo insertProc pid = do proc - procInfo pid -- XXX this is obviously wrong... psMap - get

[Haskell-cafe] Compiling GLFW / SOE on Windows

2007-12-17 Thread Peter Verswyvelen
Hi, This might be a tip for people trying to compile the GLFW package bundled with SOE on Windows. I had to because I slightly modified the GLFW source code. The SOE readme.txt says: For Win32 users, you'll need MinGW environment to compile GLFW. If make win32-mgw is unable to execute

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Brandon S. Allbery KF8NH
On Dec 17, 2007, at 14:33 , Andre Nathan wrote: insertProc :: Pid - StateT PsMap IO PsInfo insertProc pid = do proc - procInfo pid -- XXX this is obviously wrong... proc - lift $ procInfo pid psMap - get put (Map.insert pid proc psMap) modify (Map.insert pid proc) -- same as

RE: [Haskell-cafe] Compiling GLFW / SOE on Windows

2007-12-17 Thread Peter Verswyvelen
Ø However, the readme.html file has the following note: That should have been “the GLFW readme.html file”… PS: Why do I always see these errors *after* I already posted to the forum? ;) This is actually one advantage of web-based forums, you can always edit the original message J

Re: [Haskell-cafe] Re: Is StateT what I need?

2007-12-17 Thread Wolfgang Jeltsch
Am Montag, 17. Dezember 2007 21:06 schrieb ChrisK: Andre Nathan wrote: Hello (Newbie question ahead : I tried this for insertProc, but it obviously doesn't work... what would be the correct way to do this? insertProc :: Pid - StateT PsMap IO PsInfo insertProc pid = do proc -

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Brent Yorgey
This is what I have so far: type Pid = FilePath type Uid = String type PsData = Map String Uid type PsChildren = Map Pid PsInfo data PsInfo = PsInfo PsData PsChildren type PsMap = Map Pid PsInfo type PsTree = Map Pid PsInfo parent :: PsData - Pid parent psData =

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Brandon S. Allbery KF8NH
On Dec 17, 2007, at 15:41 , Brent Yorgey wrote: Yes, and in fact, you don't even need foldM. The only thing that actually uses IO is the readFile, so ideally Actually, a quick check indicates that the regex functions used in getProcInfo are in IO as well (?!). -- brandon s. allbery

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Robin Green
On Mon, 17 Dec 2007 16:04:24 -0500 Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Dec 17, 2007, at 15:41 , Brent Yorgey wrote: Yes, and in fact, you don't even need foldM. The only thing that actually uses IO is the readFile, so ideally Actually, a quick check indicates that

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Judah Jacobson
On Dec 17, 2007 1:04 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Dec 17, 2007, at 15:41 , Brent Yorgey wrote: Yes, and in fact, you don't even need foldM. The only thing that actually uses IO is the readFile, so ideally Actually, a quick check indicates that the regex

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Derek Elkins
On Mon, 2007-12-17 at 22:12 +0300, Miguel Mitrofanov wrote: There's a third way, too, and I haven't seen anybody mention it yet I've noticed it, but there are some problems with this representation, so I decided not to mention it. It's OK as far as we don't want functions working on two

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Andre Nathan
On Mon, 2007-12-17 at 17:33 -0200, Andre Nathan wrote: Hello (Newbie question ahead :) Thanks everyone for the great suggestions. The code is much cleaner now (not to mention it works :) This is the first non-tutorial program I'm writing and all this monad stuff is easier than I thought it

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Ketil Malde
Miguel Mitrofanov [EMAIL PROTECTED] writes: I've noticed it, but there are some problems with this representation, so I decided not to mention it. It's OK as far as we don't want functions working on two areas - I don't see, how we can implement, say, intersect :: Shape - Shape - Bool in this

[Haskell-cafe] Anyone mind proofing a short monad transformers explanation?

2007-12-17 Thread Jack Kelly
I sent this to a friend who asked me about monad transformers and he reckons it should be saved somewhere. If anyone feels up to giving it a quick fact-check, that'd be great. I'm not sure what to do with it, though. It doesn't seem to be made of the right stuff for a tutorial but I'm not sure

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Derek Elkins
On Mon, 2007-12-17 at 21:22 -0200, Andre Nathan wrote: On Mon, 2007-12-17 at 17:33 -0200, Andre Nathan wrote: Hello (Newbie question ahead :) Thanks everyone for the great suggestions. The code is much cleaner now (not to mention it works :) This is the first non-tutorial program I'm

Re: [Haskell-cafe] Re: announcing darcs 2.0.0pre2

2007-12-17 Thread David Roundy
Thanks for the timings. Alas, I'm leaving in the morning for vacation, so I'm not sure when I'll have time to profile these operations. And I'm still puzzling over how to speed up darcs get (i.e. the long discussion of http pipelining, which will not, of course, do anything to help the poor

Re: [Haskell-cafe] Anyone mind proofing a short monad transformers explanation?

2007-12-17 Thread Ryan Ingram
On 12/17/07, Jack Kelly [EMAIL PROTECTED] wrote: liftIO $ hPutStrLn h You lose liftIO $ hFlush h IO is once again special. For other inner monads, the lift function does the same thing. Note also that IO has no transformer and must therefore always be the innermost monad. Actually, this

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Andre Nathan
On Mon, 2007-12-17 at 17:56 -0600, Derek Elkins wrote: Have you read Wadler's papers? Yeah, I read the two you mentioned. While I can't say I've already understood 100% of them, I completely agree with you in that they're the best texts on monads, from what I've seen (maybe because they explain

Re: [Haskell-cafe] data vs newtype (was: OOP'er with (hopefully) trivial questions)

2007-12-17 Thread Jonathan Cast
On 17 Dec 2007, at 7:39 AM, David Menendez wrote: On Dec 17, 2007 8:51 AM, Bayley, Alistair [EMAIL PROTECTED] wrote: As an aside, I was wondering exactly what the differences are between newtype and data i.e. between newtype A a = A a and data A a = A a According to:

[Haskell-cafe] New to Haskell

2007-12-17 Thread Cristian Baboi
A few days ago, for various reasons, I've started to look at Haskell. At first I was quite impressed, after reading some FAQ, and some tutorials. Evrything was nice and easy ... until I've started writing some code on my own. What I should have been told about upfront: - the syntax for an