Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis
I just start ghci from shell and do nothing else. In fact, i really donot know `Monad ((-) a) ` . Would you mind expplain it ? Yusaku Hashimoto wrote: Did you import the module includes the instance of Monad ((-) e) somewhere in your code loaded in ghci? I tried this on a fresh ghci

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis
Why do you bother with the interior definition of f in there? Because i want to try a C code style not layout style without `do` syntax sugar . Yusaku Hashimoto wrote: fac n = let {  f = foldr (*) 1 [1..n] } in f Why do you bother with the interior definition of f in there? fac =

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Ivan Lazar Miljenovic
zaxis z_a...@163.com writes: Why do you bother with the interior definition of f in there? Because i want to try a C code style not layout style without `do` syntax sugar . Haskell /= C, so stop trying to code as if it is. If you like C so much, then use C. -- Ivan Lazar Miljenovic

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis
Of course, you are wrong ! C is VERY important for almost every programmer in the world! Why cannot C programmer use haskell ? And Why does haskell support C code style ? Ivan Miljenovic wrote: zaxis z_a...@163.com writes: Why do you bother with the interior definition of f in there?

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Dietrich Epp
I think Miljenovic was asking about this (I removed explicit braces): fac n = let f = foldr (*) 1 [1..n] in f Which is strictly equivalent to: fac n = foldr (*) 1 [1..n] Translated into C, this is kind of like doing this: int add(int x, int y) { int sum = x + y;

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Yusaku Hashimoto
Hmm, When a ghci was started, there should be the only loaded module (Prelude.) And in both 6.10 and 6.12, such instance is not defined or exported in its Prelude. So please try `ghci -ignore-dot-ghci`. It invokes ghci without reading ~/.ghci and ./.ghci. And `((-) a)` is known as the Reader

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis
I just mean syntax. For example. the following code snippet is C-style. In vim, i can use `shift+%` to jump between `{' and `}', and so on. hitSSQ hitNum = do { nums - fmap str_ints_pick $ readFile ssqNum.txt; forM_ nums (\n - do { let { hitB = if (n!!6 == hitNum!!6) then 1

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis
thanks for your answer! However, i still feel the following code snippets have different code style. 1. C-style winSSQ count noRed noBlue = do { let {yesRed=[1..33] \\ noRed; yesBlue=[1..16] \\ noBlue}; ps - picoSec; setStdGen (mkStdGen $ fromInteger ps); result - pick_ssq_nums

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis
Both 6.10 and 6.12 use same .ghci ! %cat ~/.ghci :cd /media/G/www/qachina/db/doc/money :l Money %cat Money.hs|grep import import System( getArgs ) import System.Random import System.IO import System.Time import Text.Printf (printf) import Text.Regex import Data.List import Data.Time.Calendar

[Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread zaxis
In 6.12.1 under archlinux let f x y z = x + y + z :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f :: (Num a) = a - ((a - a) - a - b) - a - b ((=) . f) 1 (\f x - f x) 2 5 In 6.10.4_1 under freebsd let f x y z = x + y + z *Money :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f ::

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 8:20 PM, zaxis z_a...@163.com wrote: In 6.12.1 under archlinux let f x y z = x + y + z :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f :: (Num a) = a - ((a - a) - a - b) - a - b ((=) . f) 1 (\f x - f x) 2 5 In 6.10.4_1 under freebsd let f x y z = x + y + z

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Yusaku Hashimoto
Did you import the module includes the instance of Monad ((-) e) somewhere in your code loaded in ghci? I tried this on a fresh ghci 6.12, but I got No instance error. -nwn On Sat, Mar 27, 2010 at 9:20 AM, zaxis z_a...@163.com wrote: In 6.12.1 under archlinux let f x y z = x + y + z :t f f

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Ivan Lazar Miljenovic
zaxis z_a...@163.com writes: In 6.10.4_1 under freebsd let f x y z = x + y + z *Money :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a - b ((=) . f) 1 (\f x - f x) 2 interactive:1:1: No instance for (Monad ((-) a))

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: zaxis z_a...@163.com writes: In 6.10.4_1 under freebsd let f x y z = x + y + z *Money :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f  :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a - b

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Ivan Lazar Miljenovic
David Menendez d...@zednenem.com writes: On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Some definitions and exports got changed, so in 6.12 the (- a) Monad instance is exported whereas in 6.10 it isn't. What? From where? I thought the whole reason

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Yusaku Hashimoto
fac n = let {  f = foldr (*) 1 [1..n] } in f Why do you bother with the interior definition of f in there? fac = product . enumFromTo 1 let fac = do is_zero - (==0); if is_zero then return 1 else liftM2 (*) id (fac . pred) -nwn On Sat, Mar 27, 2010 at 9:59 AM, Ivan Lazar Miljenovic

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 9:13 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: David Menendez d...@zednenem.com writes: On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Some definitions and exports got changed, so in 6.12 the (- a) Monad