On Sat, 2005-07-09 at 13:12 +0400, Bulat Ziganshin wrote:
> Hello Dinh,
>
> Friday, July 08, 2005, 9:12:22 PM, you wrote:
>
> DTTA> Another question, it's said in the book that using cyclic structure
> (like
> DTTA> ones = 1:ones) , the list would be represented by a fixed amount of
> memory
This is still an ad-hoc solution, cause you lose
the `most-specific' instance property. You really have to
impose a `fixed' ordering in which instance-improvement rules
fire.
Recap:
The combination of overlapping instances
and type improvement leads to a `non-confluent' system, i.e.
there're to
Daniel Brown wrote:
>class Baz a b | a -> b
>instance Baz (a -> b) (a -> [b])
>instance Baz a a
> ...but Baz fails with this error...
>
> When confronted with overlapping instances, the compiler chooses the
> most specific one (if it is unique), e.g. `Baz (a -> b) (a -> [b])` is
> mor
Dinh Tien Tuan Anh wrote:
> > Yes, it is certainly not Hugs which prevents from realtime interaction but
> > it is the terminal you are using. If the terminal lets you delete the
> > characters on the current line it has to keep them until you complete it
> > with ENTER. Piping from and to other
Thanks for your reply,
i just simply removed the first line and it works, but i dont understand
why 1/x is not Float.
It depends on the type of 'x'. If 'x' is a Float, (1/x) will be a
Float. If 'x' is a Double, (1/x) will be a Double. If 'x' is an
Integer (1/x) will not typecheck becaus
You are trying to divide by an Integer and get a Float. Haskell doesn't
do automatic numeric conversion, so you have to do the casts manually.
Prelude> let sumHam n = sum [ 1 / (fromIntegral x) | x <- [1..n] ]
Prelude> sumHam 5
2.283
Dinh Tien Tuan Anh wrote:
could anyone tell
Thanks for your reply,
i just simply removed the first line and it works, but i dont understand why
1/x is not Float.
Try this:
sumHam :: Integer -> Float
sumHam n = sum [1.0/(fromIntegral x) | x<-[-1..n]]
-- Andy
_
Use MSN
On 11 Jul 2005, at 17:37, Dinh Tien Tuan Anh wrote:
sumHam :: Integer -> Float
sumHam n = sum [1/x | x<-[1..n]]
Try this:
sumHam :: Integer -> Float
sumHam n = sum [1.0/(fromIntegral x) | x<-[-1..n]]
-- Andy
___
H
could anyone tell me what i did wrong with this please
sumHam :: Integer -> Float
sumHam n = sum [1/x | x<-[1..n]]
Error: type error in explicitly typed binding
Term: sumHam
Type: Integer -> Integer
Does not match : Integer -> Float
it only w
You're right, i've been using shell in Emacs to run Hugs, but when back to
normal terminal, it works.
Just for curiousity, why does it happen ?
Thank you very much
Cheers
Yes, it is certainly not Hugs which prevents from realtime interaction but
it is the terminal you are using. If the term
On Mon, 11 Jul 2005, Dinh Tien Tuan Anh wrote:
> Hi,
> im using Hugs 98 and learing how to use interactive Haskell.
> As read in the book:
>
> capitalise :: [Char] -> [Char]
> capitalise = takeWhile(/='.') . map toUpper
>
>
> interact capitalise
>
> its said the program is FULLY
Hi,
im using Hugs 98 and learing how to use interactive Haskell.
As read in the book:
capitalise :: [Char] -> [Char]
capitalise = takeWhile(/='.') . map toUpper
interact capitalise
its said the program is FULLY INTERACTIVE, i.e: as soon as 'h' typed on the
keyboard, an 'H' appe
Isaac Jones writes:
> ./setup configure --user #if it depends on user-local packages
> ./setup build
> ./setup install --user
> Perhaps install --user should be the default if you
> configure --user.
Yes, I think that would be more intuitive. It would also be
nice to be able to configure Ca
Hi Isaac,
Is there a way to specify a particular package.conf for use when
installing and registering packages with Cabal? I'm trying to
Cabal-ize WASH which has a number of packages which depend on each
other. The problem is that in order to build the next package, the
previous one has to be inst
14 matches
Mail list logo