[Haskell-cafe] One question...

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Dec 9 13:39:35 EST 2006

Hello Waldemar,

Saturday, December 9, 2006, 7:57:52 PM, you wrote:

> 1. At the beginning the user should write her/his name (for instance as the
> application parameter).
> 2. Let's assume that the application has many various functions defined 
> inside, and - after printing each of the outputs - the name has to be 
> printout.

> How should I think "properly" in Haskell to get described action?

1) variables exists, but supported via additional libs instead of being
part of language definition

2) in many cases, you don't need vars because function parameters used
instead. in particular, recursion used instead of cycles (code generator
generates cycles, of course, in terms of raw cpu ocde). also, data input
operations, technically speaking, receive "continuation procedure" which
they calls with a data input as a parameter. for example, code:

  var <- getLine
  putStr var

converted internally into the following:

  getLine (\var -> putStr var)

you can find details in http://haskell.org/haskellwiki/IO_inside

really, changing one's mind to see functional ways to do something instead
of imperative ways, and realizing that full imperative power is still
available in rare cases when you need it, is main problem when learning
Haskell. i personally abandoned my first attempt to learn because i don't
understood how arbitrary imperative action can be implemented in Haskell.
but now i've written in Haskell I/O library, arrays&variables library, and
data-compression utility :)

so i suggest you to read as much Haskell code as possible to see how it can
be used (in particular, look into sources of Base and MissingH libraries,
and http://haskell.org/haskellwiki/Simple_unix_tools ), read briefly
how I/O actions work in Haskell ( http://haskell.org/haskellwiki/IO_inside ),
and may be look into sources of my utility (
http://www.haskell.org/bz/FreeArc-sources.tar.gz ) - it contains tons of
Russian comments, if you know this language this will be much more interesting

ps: if you are going from OOP world, look also at
http://haskell.org/haskellwiki/OOP_vs_type_classes :)

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list