[Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Heinrich Hördegen
Dear all, I have a question about evaluation with respect to types and currying. Consider this programm: import Debug.Trace -- add :: Integer - Integer - Integer add :: Int - Int - Int add x y = x + y f a b c = trace b (add x c) where x = trace a (add a b) main :: IO () main = do print

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread MigMit
Different kinds of optimization. I expect you'd have different results even if you use one type, but different -O flags. On 18 Feb 2012, at 13:28, Heinrich Hördegen wrote: Dear all, I have a question about evaluation with respect to types and currying. Consider this programm: import

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Heinrich Hördegen
Hi, this is true. The optimization only works with -O2. I'd like to have more details about what's going on. How can I make sure, that this optimization triggers? Heinrich On 18.02.2012 11:10, MigMit wrote: Different kinds of optimization. I expect you'd have different results even if

Re: [Haskell-cafe] Best FRP package for newbie

2012-02-18 Thread Adam Duracz
Hi Arnaud, While not necessarily in line with the state of the art of FRP libraries, I can warmly recommend going through the parts of Paul Hudak's Haskell School Of Expression that cover the Functional Animation Library (FAL, basically a light version of Fran). The book introduces FRP

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Holger Siegel
Am 18.02.2012 um 11:56 schrieb Heinrich Hördegen: Hi, this is true. The optimization only works with -O2. I'd like to have more details about what's going on. How can I make sure, that this optimization triggers? You cannot. Common subexpression elimination is done by GHC very

Re: [Haskell-cafe] Best FRP package for newbie

2012-02-18 Thread edgar klerks
As beginner I really liked reactive-banana. I used it in a inhouse project for the graphical user interface (wx) and I found it easier to use than the imperative approach. Unfortunately the reactive-banana-wx package seems to be broken on 7.2. On 2/18/12, Adam Duracz a...@duracz.net wrote: Hi

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Victor Gorokgov
+ on Int is extremely cheap. It is always faster to add again rather than store the value. But Integer is a different story. Addition time on this type can grow to several minutes. 18.02.2012 13:28, Heinrich Hördegen пишет: Dear all, I have a question about evaluation with respect to types

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Heinrich Hördegen
In case of +, the reason might be that it's cheap, but the function add could do something else than + (It was just a small example). Ok, thank you for your useful comments. I will read about cse. Heinrich On 18.02.2012 13:42, Victor Gorokgov wrote: + on Int is extremely cheap. It is always

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Roman Cheplyaka
* Holger Siegel holgersiege...@yahoo.de [2012-02-18 12:52:08+0100] You cannot. Common subexpression elimination is done by GHC very conservatively, because it can not only affect impure programs: it can also affects strictness/lazyness and worsen memory usage of pure code. Like the HaskellWiki

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Holger Siegel
Am 18.02.2012 um 14:38 schrieb Roman Cheplyaka: * Holger Siegel holgersiege...@yahoo.de [2012-02-18 12:52:08+0100] You cannot. Common subexpression elimination is done by GHC very conservatively, because it can not only affect impure programs: it can also affects strictness/lazyness

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Victor Gorokgov
example = a + b + a + b exampleCSE = x + x where x = a + b With CSE we are introducing new thunk: x. 18.02.2012 17:38, Roman Cheplyaka пишет: * Holger Siegelholgersiege...@yahoo.de [2012-02-18 12:52:08+0100] You cannot. Common subexpression elimination is done by GHC very conservatively,

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread MigMit
I'm not sure you can. Why do you need it? Отправлено с iPad 18.02.2012, в 14:56, Heinrich Hördegen hoerde...@funktional.info написал(а): Hi, this is true. The optimization only works with -O2. I'd like to have more details about what's going on. How can I make sure, that this optimization

[Haskell-cafe] Functor in terms of Arrow

2012-02-18 Thread Tom Schouten
Dear HC, Does AFunctor below have a standard name? It's a generalization of the Functor class in terms of Arrow instead of (-): fmap :: Functor f = (i - o) - f i - f o afmap :: Arrow a, AFunctor f = a i o- a (f i) (f o) It pops up in less general form (AFunctor =

Re: [Haskell-cafe] Best FRP package for newbie

2012-02-18 Thread Arnaud Bailly
Thanks to all for your kind answers. I already installed reactive-banana and skimmed through the doc which is quite good and extensive: at least this is a good start. Should the need arise, I will not hesitate to tap into the knowledge and wisdom of the community ! Regards, Arnaud

Re: [Haskell-cafe] types and number of evaluation steps

2012-02-18 Thread Roman Cheplyaka
It doesn't matter. Laziness would be affected if, for instance, something is not evaluated without CSE and is evaluated with it. In your example either all or none of 'a' and 'b' get evaluated, depending on whether the top-level expression is evaluated. * Victor Gorokgov m...@rkit.pp.ru

Re: [Haskell-cafe] empty fields are dropped in bytestring csv

2012-02-18 Thread Tom Doris
Hacky patch to fix this for future reference, against bytestring-csv-0.1.2, cost center annotations used to anecdotally verify that the change doesn't significantly impact performance, (interestingly the Alex lexer in bytestring-csv appears to allocate 1.5GB while lexing a 1.6MB csv file!?)

Re: [Haskell-cafe] Functor in terms of Arrow

2012-02-18 Thread Peter Gammie
Tom, On 19/02/2012, at 3:21 AM, Tom Schouten wrote: Does AFunctor below have a standard name? It's a generalization of the Functor class in terms of Arrow instead of (-): fmap :: Functor f = (i - o) - f i - f o afmap :: Arrow a, AFunctor f = a i o- a (f i) (f o)

[Haskell-cafe] hackage down

2012-02-18 Thread Ozgur Akgun
Hackage seems to be down: http://www.downforeveryoneorjustme.com/http://hackage.haskell.org Best, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe