zaxis <z_a...@163.com> writes:
> However, i donot know how to write pure function using C style.
> func1 a = {
>   -- ...;
>    a * 2;
>   -- ...;
> }

You mean imperatively?  Short answer: you can't and you shouldn't.

Slightly longer answer: you can possibly fudge something together using
the Identity monad from mtl, but that will involve wrapping/unwrapping
everywhere.

Learn to think about how to chain/group functions together to form more
of a "pipeline" rather than a sequence of statements.  Haskell =/= C.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to