Read and Write to Same File

2003-10-04 Thread kuq32tr02
I am writing a program that reads and writes to the same file. I was having some problems with it writing to the file before it read it. I solved it in the following two ways: 1. main = do text <- readFile "test" let something = somefunc text writeFile "test2" something

Re: IO behaves oddly if used nested

2003-10-04 Thread John Meacham
it might be more clear if IO had a show instance like instance (Typeable b) => Show (IO b) where show (x:: IO a) = "<< IO action producing a " ++ (show $ typeOf (undefined :: a)) ++ " >>" then print $ getChar prints << IO action producing a Char >> of course this may not be feasable for al

Re: Newbie qustion about monads

2003-10-04 Thread Juanma Barranquero
On Thu, 02 Oct 2003 14:57:22 +0200, Juanma Barranquero <[EMAIL PROTECTED]> wrote: > data Accum s a = Ac [s] a > > instance Monad (Accum s) where >return x = Ac [] x >Ac s1 x >>= f = let Ac s2 y = f x in Ac (s1++s2) y > > output :: a -> Accum a () > output x = Ac [x] () After trying

Re: IO behaves oddly if used nested

2003-10-04 Thread Derek Elkins
On Sat, 04 Oct 2003 13:13:59 +0200 "blaat blaat" <[EMAIL PROTECTED]> wrote: [moved to Haskell-Cafe] > > Neither example is odd behavior, unless > >you consider Hugs providing a perfectly reasonable instance of Show > >for IO a odd. > > True, every program behaves exactly as according to the def

Re: Haskellsupport in KDevelop

2003-10-04 Thread Ross Paterson
On Sat, Oct 04, 2003 at 07:15:32PM +0200, Peter Robinson wrote: > What's really missing is a (primitive) background parser written that reports > syntax errors. It can be written in yacc, antlr, etc., anything that produces > C/C++ code. The only parsers for Haskell I could find are written thems

Re: Why does this work - haskell mysteries?

2003-10-04 Thread Petter Egesund
Thanks, the Scheme-version made it even clearer! Cheers, Petter On Saturday 04 October 2003 13:53, you wrote: > On Sun, 5 Oct 2003 11:02:37 + > > Petter Egesund <[EMAIL PROTECTED]> wrote: > > Hi & thanks for answering. > > > > I think I got it - the chaning of the functions lies in the last

Re: Haskellsupport in KDevelop

2003-10-04 Thread Peter Robinson
On Saturday 04 October 2003 20:20, Wolfgang Jeltsch wrote: > Great! I will probably use it since I like Haskell and KDE very much. > > By the way, wasn't KDevelop only for developing in C and C++? The current stable Release 2.1.* is a C/C++ only IDE but the upcoming 3.0 will probably support: Ada

Re: Haskellsupport in KDevelop

2003-10-04 Thread Wolfgang Jeltsch
Am Samstag, 4. Oktober 2003, 19:15 schrieb Peter Robinson: > Hello, > > I've begun to write a plugin that provides basic support for Haskell in > KDevelop 3.0 alpha. (http://www.kdevelop.org). Great! I will probably use it since I like Haskell and KDE very much. By the way, wasn't KDevelop only f

Haskellsupport in KDevelop

2003-10-04 Thread Peter Robinson
Hello, I've begun to write a plugin that provides basic support for Haskell in KDevelop 3.0 alpha. (http://www.kdevelop.org). It is already included in the CVS and the latest alpha7 release. Screenshots: http://www.thaldyron.com/snap1.png http://www.thaldyron.com/snap2.png http://www.thaldyron.

Re: Why does this work - haskell mysteries?

2003-10-04 Thread Derek Elkins
On Sun, 5 Oct 2003 11:02:37 + Petter Egesund <[EMAIL PROTECTED]> wrote: > Hi & thanks for answering. > > I think I got it - the chaning of the functions lies in the last part > of > > (\w -> if v==w then n else sto w) > > I am used to higher ordered functions from Scheme, but it was the >

Re: Why does this work - haskell mysteries?

2003-10-04 Thread Petter Egesund
Hi & thanks for answering. I think I got it - the chaning of the functions lies in the last part of (\w -> if v==w then n else sto w) I am used to higher ordered functions from Scheme, but it was the delayed evaluation which played me the trick here. This function is built when updating, and

Type tree traversals [Re: Modeling multiple inheritance]

2003-10-04 Thread oleg
This message illustrates how to get the typechecker to traverse non-flat, non-linear trees of types in search of a specific type. We have thus implemented a depth-first tree lookup at the typechecking time, in the language of classes and instances. The following test is the best illustration: >