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 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] Is it possible to represent such polymorphism?

2011-10-02 Thread Victor Gorokgov
02.10.2011 19:55, David Barbour пишет: Use TypeFamilies. {-# LANGUAGE TypeFamilies #} ... type family FType a :: * type instance FType Char = Float type instance FType Double = Int class ExampleClass a where f :: a - FType a Better to include type in class. class ExampleClass a where type

Re: [Haskell-cafe] Data import from octave / text file

2011-06-15 Thread Victor Gorokgov
read :: String - [[Double]] can't read this format. It expects [[0,30,9],[0.1,30,9],...] use this code let m = map f text :: [[Double]] f a = map g $ lines a g a = map read $ words a 15.06.2011 15:13, kaffeepause73 пишет: Dear all, I want to read numeric data in vector / matrix