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
impo
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_num
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
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 Mona
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;
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 writes:
>
Why do you bother with the interior definition of f in there?
>> Beca
zaxis 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
ivan.miljeno...@g
>>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?
>>
>>
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 ghc
On Fri, Mar 26, 2010 at 9:13 PM, Ivan Lazar Miljenovic
wrote:
> David Menendez writes:
>> On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic
>> 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? Fro
>> 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
David Menendez writes:
> On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic
> 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 the Monad ((->) a) instance was
On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic
wrote:
> zaxis 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
>>> ((>>=)
zaxis 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
>
> :1:1:
> No instance for (Monad ((->) a))
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 wrote:
>
> In 6.12.1 under archlinux
>>let f x y z = x + y + z
>> :t f
> f :: (N
On Fri, Mar 26, 2010 at 8:20 PM, zaxis 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
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 ->
17 matches
Mail list logo