[Haskell-cafe] Re: how to apply a function which returns IO() to a list?

2006-06-14 Thread Max Vasin
> "developer" == developer <[EMAIL PROTECTED]> writes: developer> Hi, I have this function which write a file: developer> writeHtml b x y = do writeFile (b ++ ".html") (htmlCode b x developer> y) developer> i need to apply to each member of a given list: developer> the way i always try to

[Haskell-cafe] Re: Closure trace?

2006-06-14 Thread Simon Marlow
Michael Marte wrote: frequently we are seeing messages like "List.head: empty list" or "Maybe.fromJust: Nothing". It is clear what happened and where the messages were triggered yet the real cause is usually VERY hard to find unless the program is small and simple. I came to the conclusion tha

Re: [Haskell-cafe] Teaching Haskell -- any advice?

2006-06-14 Thread Thomas Sutton
On 14/06/2006, at 8:49 PM, Thomas Sutton wrote: On 14/06/2006, at 8:09 PM, David House wrote: Hi all, Next year I will have the opportunity to teach Haskell at my school! I am very excited about this and hope to offer something beyond the VB6 and Pascal that is currently available with the

Re: [Haskell-cafe] Closure trace?

2006-06-14 Thread Esa Ilari Vuokko
Hi Michael, On 6/14/06, Michael Marte <[EMAIL PROTECTED]> wrote: I wonder whether it is possible to print a "closure trace" similar to a stack trace in procedural programming. Say we have two modules A and B: I wrote small (external) utility that does something like that for ghc-built binaries

[Haskell-cafe] DBDirect trouble

2006-06-14 Thread Ferenc Wagner
Hi! Let me repeat my question from IRC here, too... I installed HaskellDB and all the necessary stuff (I hope) as local (not system-wide) packages: $ ghc-pkg list /usr/lib/ghc-6.4.1/package.conf: rts-1.0, base-1.0, haskell98-1.0, template-haskell-1.0, unix-1.0, Cabal-1.0, parsec-1.0, hask

Re: [Haskell-cafe] Teaching Haskell -- any advice?

2006-06-14 Thread Thomas Sutton
On 14/06/2006, at 8:09 PM, David House wrote: Hi all, Next year I will have the opportunity to teach Haskell at my school! I am very excited about this and hope to offer something beyond the VB6 and Pascal that is currently available with the school's Computing course. A high school, or a univer

Re: [Haskell-cafe] Closure trace?

2006-06-14 Thread Ketil Malde
Bulat Ziganshin <[EMAIL PROTECTED]> writes: > I'm not belittling the underlying problem, which is real. But there do > seem to be many possible design choices without an obvious optimium. If > someone can boil out a principled and simple solution, it'd be a good > contribution. You can also use

[Haskell-cafe] Teaching Haskell -- any advice?

2006-06-14 Thread David House
Hi all, Next year I will have the opportunity to teach Haskell at my school! I am very excited about this and hope to offer something beyond the VB6 and Pascal that is currently available with the school's Computing course. The time slots will be very tight -- one 25 minute session a week. Howev

Re: [Haskell-cafe] how to apply a function which returns IO() to a list?

2006-06-14 Thread Stefan Holdermans
Nuno, Oops... Of course I meant mapM_ :: (a -> IO b) -> [a] -> IO () instead of mapM_ :: (a -> IO b) -> [a] -> m () Regards, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] how to apply a function which returns IO() to a list?

2006-06-14 Thread Stefan Holdermans
Nuno, I have this function which write a file: writeHtml b x y = do writeFile (b ++ ".html") (htmlCode b x y) i need to apply to each member of a given list: Have a look at the mapM and mapM_ functions from the Prelude. Instantiated to IO, these have the following

Re: [Haskell-cafe] how to apply a function which returns IO() to a list?

2006-06-14 Thread Neil Mitchell
Hi, I think the kind of structure you are after is something like: writeList [] = return () writeList (x:xs) = do writeHtml x writeList xs Which is already defined for you, using sequence_ Thanks Neil ___ Haskell-Cafe

[Haskell-cafe] how to apply a function which returns IO() to a list?

2006-06-14 Thread developer
Hi, I have this function which write a file: writeHtml b x y = do writeFile (b ++ ".html") (htmlCode b x y) i need to apply to each member of a given list: the way i always try to codify functions in haskell is allways the same, the most primitive one and i think i cant

Re: [Haskell-cafe] Closure trace?

2006-06-14 Thread Bulat Ziganshin
Hello Michael, Wednesday, June 14, 2006, 1:19:03 PM, you wrote: > frequently we are seeing messages like "List.head: empty list" or > "Maybe.fromJust: Nothing". It is clear what happened and where the one time i complained the close problem SPJ answered me (see ghc-users mail-list at 23 may 2005

Re: [Haskell-cafe] Closure trace?

2006-06-14 Thread Neil Mitchell
Hi Michael, I have defined fromJustNote and headNote, which take an extra parameter, for example: fromJustNote msg (Just x) = x fromJustNote msg Nothing = error $ "fromJustNote failed, " ++ msg I also have lookupJust which does a lookup and a fromJust, since this is a common pattern in my progr

[Haskell-cafe] Closure trace?

2006-06-14 Thread Michael Marte
Hello *, frequently we are seeing messages like "List.head: empty list" or "Maybe.fromJust: Nothing". It is clear what happened and where the messages were triggered yet the real cause is usually VERY hard to find unless the program is small and simple. I came to the conclusion that functions