Thanks for the SO link, change the Num a constraint to Real a and using
realToFrac then it just works.
On Fri, Jul 1, 2011 at 2:11 PM, Jack Henahan wrote:
> Additionally, this SO question[0] is nearly identical, and provides a
> little more elaboration.
>
> [0]:
> http://stackoverflow.com/questi
Plain old lazy lists do not allow me to combine multiple concurrent
computations, e.g. I cannot define average from sum and length.
2011/7/1 Heinrich Apfelmus :
> Eugene Kirpichov wrote:
>>
>> I'm rewriting timeplot to avoid holding the whole input in memory, and
>> naturally a problem arises:
>>
Eugene Kirpichov wrote:
I'm rewriting timeplot to avoid holding the whole input in memory, and
naturally a problem arises:
How to represent large but finite streams and functions that process
them, returning other streams or some kinds of aggregate values?
Examples:
* Adjacent differences of a
At Fri, 1 Jul 2011 09:39:32 +0400,
Eugene Kirpichov wrote:
>
> Hi,
>
> I'm rewriting timeplot to avoid holding the whole input in memory, and
> naturally a problem arises:
>
> How to represent large but finite streams and functions that process
> them, returning other streams or some kinds of ag
The problem is that you need to convert (length xs) to a Num, then
return a Fractional.
On Fri, Jul 1, 2011 at 2:07 PM, Nathan Howell wrote:
> (/) operates on a Fractional instance... but length returns an Int, which is
> not a Fractional.
> You can convert the Int to a Fractional instance:
> mea
Additionally, this SO question[0] is nearly identical, and provides a little
more elaboration.
[0]:http://stackoverflow.com/questions/2376981/haskell-types-frustrating-a-simple-average-function
On Jul 1, 2011, at 2:07 AM, Ruohao Li wrote:
> For mean xs = sum xs / length xs, I got the following:
For mean xs = sum xs / fromIntegral (length xs), I got the following:
test.hs:8:10:
Could not deduce (Fractional a)
from the context (Num a, Fractional b)
arising from a use of `/' at test.hs:8:10-42
Possible fix:
add (Fractional a) to the context of the type signature fo
(/) operates on a Fractional instance... but length returns an Int, which is
not a Fractional.
You can convert the Int to a Fractional instance:
mean xs = sum xs / fromIntegral (length xs)
or try an integer division:
mean xs = sum xs `div` length xs
-n
On Thu, Jun 30, 2011 at 10:55 PM, Ruohao L
For mean xs = sum xs / length xs, I got the following:
test.hs:8:10:
No instance for (Fractional Int)
arising from a use of `/' at test.hs:8:10-27
Possible fix: add an instance declaration for (Fractional Int)
In the expression: sum xs / length xs
In the definition of `mean':
What compiler errors are you getting?
-deech
On Fri, Jul 1, 2011 at 12:55 AM, Ruohao Li wrote:
> Hi guys,
> I just started learning some Haskell. I want to implement a mean function to
> compute the mean of a list. The signature of the function is:
> mean :: (Num a, Fractional b) => [a] -> b
> Bu
Hi guys,
I just started learning some Haskell. I want to implement a mean function to
compute the mean of a list. The signature of the function is:
mean :: (Num a, Fractional b) => [a] -> b
But when I implement this simple function, the compiler keep whining at me
on type errors. I know this is wr
Hi,
I'm rewriting timeplot to avoid holding the whole input in memory, and
naturally a problem arises:
How to represent large but finite streams and functions that process
them, returning other streams or some kinds of aggregate values?
Examples:
* Adjacent differences of a stream of numbers
* G
On 1 July 2011 11:35, Brent Yorgey wrote:
> On Fri, Jul 01, 2011 at 09:05:05AM +1000, Ivan Lazar Miljenovic wrote:
>> On 1 July 2011 08:58, Joshua Ball wrote:
>> > GHCi seems to be clever about some things:
>> >
>> > If I try to print the empty list in ghci, I encounter no problems:
>> >
>> > Pre
On Fri, Jul 01, 2011 at 09:05:05AM +1000, Ivan Lazar Miljenovic wrote:
> On 1 July 2011 08:58, Joshua Ball wrote:
> > GHCi seems to be clever about some things:
> >
> > If I try to print the empty list in ghci, I encounter no problems:
> >
> > Prelude> []
> > []
> > Prelude> show []
> > "[]"
> > P
On 06/30/2011 11:46 PM, Holger Siegel wrote:
> Am 30.06.2011 um 22:57 schrieb Philipp Schneider:
>
>> On 06/30/2011 09:49 PM, Holger Siegel wrote:
>>> (...) But that won't work: After you have evaluated an entry of the
>>> environment, you store the resulting value but you throw away its updated
On 1 July 2011 08:58, Joshua Ball wrote:
> GHCi seems to be clever about some things:
>
> If I try to print the empty list in ghci, I encounter no problems:
>
> Prelude> []
> []
> Prelude> show []
> "[]"
> Prelude> print []
> []
>
> Even though the type of the list is clearly unknown, it must be
>
On Thu, Jun 30, 2011 at 18:58, Joshua Ball wrote:
> GHCi seems to be clever about some things:
GHCi uses extended defaulting rules unless told otherwise, so in the
absence of anything else it uses () as the type. You can enable this
in GHC as well, with -XExtendedDefaultRules. See
http://www.ha
GHCi seems to be clever about some things:
If I try to print the empty list in ghci, I encounter no problems:
Prelude> []
[]
Prelude> show []
"[]"
Prelude> print []
[]
Even though the type of the list is clearly unknown, it must be
picking SOME type. (why does it print [] instead of "")?
If I w
Am 30.06.2011 um 22:57 schrieb Philipp Schneider:
> On 06/30/2011 09:49 PM, Holger Siegel wrote:
>> (...) But that won't work: After you have evaluated an entry of the
>> environment, you store the resulting value but you throw away its updated
>> environment. That means, you lose the results o
On 06/30/2011 09:49 PM, Holger Siegel wrote:
> Am 30.06.2011 um 20:23 schrieb Philipp Schneider:
>
>> On 06/30/2011 02:36 PM, Holger Siegel wrote:
>>> Am 29.06.2011 um 23:50 schrieb Philipp Schneider:
>>>
Hi cafe,
in my program i use a monad of the following type
newtype M
On Thu, Jun 30, 2011 at 12:55 PM, Thomas DuBuisson <
thomas.dubuis...@gmail.com> wrote:
> WHAT: A Haskell Hackathon
>
> WHEN:
> July 22-24 (Friday, Saturday, Sunday)
> 10:00 AM to 5:30 PM
>
> WHERE:
> Forth Avenue Building (FAB, 1900 SW 4th Ave) Room 10
> Portland, Oregon 97201
> ...
> Registratio
WHAT: A Haskell Hackathon
WHEN:
July 22-24 (Friday, Saturday, Sunday)
10:00 AM to 5:30 PM
WHERE:
Forth Avenue Building (FAB, 1900 SW 4th Ave) Room 10
Portland, Oregon 97201
WHERE, take 2:
FAB10 is a small auditorium just inside the west most Harrison Street entrance.
URL: http://haskell.org/has
Am 30.06.2011 um 20:23 schrieb Philipp Schneider:
> On 06/30/2011 02:36 PM, Holger Siegel wrote:
>> Am 29.06.2011 um 23:50 schrieb Philipp Schneider:
>>
>>> Hi cafe,
>>>
>>> in my program i use a monad of the following type
>>>
>>> newtype M a = M (State -> (a, State))
>>>
>>> i use the monad
Hi all,
I'd like to announce the first release of mime-mail-ses[1]. This
provides easy integration between the mime-mail package[2] and
Amazon's Simple Email Service. This package was written for the
Haskellers website[3], purely because I despise setting up mail
servers.
There aren't many more f
On 06/30/2011 08:25 PM, Philipp Schneider wrote:
> On 06/30/2011 02:36 PM, Holger Siegel wrote:
>> Am 29.06.2011 um 23:50 schrieb Philipp Schneider:
>>
>>> Hi cafe,
>>>
>>> in my program i use a monad of the following type
>>>
>>> newtype M a = M (State -> (a, State))
>>>
>>> i use the monad in two
吴兴博 wrote:
> it seems that cabal install different into different folders. if two
> package contains same module name, can they all exist? since cabal
> have no "remvoe" or "uninstall". how can I hide some packages?
Alternatively for small programs for which you don't use a Cabal file
you can
On 06/30/2011 02:36 PM, Holger Siegel wrote:
> Am 29.06.2011 um 23:50 schrieb Philipp Schneider:
>
>> Hi cafe,
>>
>> in my program i use a monad of the following type
>>
>> newtype M a = M (State -> (a, State))
>>
>> i use the monad in two different ways. The type variable "a" can be a
>> pair as i
At Thu, 30 Jun 2011 23:53:02 +1000,
John Ky wrote:
>
> But all I've done is:
>
> enum |$ inumReverseLines .| iter
>
> inumReverseLines = mkInum $ do
> line <- lineI
> return (L.reverse (L.concat [line, C.pack "\n"]))
mkInum repeatedly invokes its iter argument so as to ke
On Thu, Jun 30, 2011 at 09:53, John Ky wrote:
> enum |$ inumReverseLines .| iter
> inumReverseLines = mkInum $ do
> line <- lineI
> return (L.reverse (L.concat [line, C.pack "\n"]))
>
> No attempt was made to reverse more than one line - at least as far as I can
> see. What have I done wrong
Hi Hakell Cafe,
I'm struggling to understand my unambitious IterIO code that somehow manages
to work.
Basically I run an echo server that is supposed to read from a socket line
by line and write back to the socket with all the characters in the line
reversed:
import Control.Exception
import Cont
"An environment contains local variable bindings, so no subcomputation will
ever need to return its environment.
" - That is not true. A subcomputation can possible modify an environment
except the language forbids such a case.
On 06/30/2011 02:36 PM, Holger Siegel wrote:
> Am 29.06.2011 um 2
Am 29.06.2011 um 23:50 schrieb Philipp Schneider:
> Hi cafe,
>
> in my program i use a monad of the following type
>
> newtype M a = M (State -> (a, State))
>
> i use the monad in two different ways. The type variable "a" can be a
> pair as in
>
> interp :: Term -> Environment -> M (Value,Env
吴兴博 wrote:
it seems that cabal install different into different folders.
if two package contains same module name, can they all exist?
since cabal have no "remvoe" or "uninstall". how can I hide some packages?
The ghc-pkg program organizes GHC's package database. You want to run
the command
On 30 June 2011 17:40, 吴兴博 wrote:
> it seems that cabal install different into different folders.
> if two package contains same module name, can they all exist?
> since cabal have no "remvoe" or "uninstall". how can I hide some packages?
ghc-pkg hide foo-1.2.3
This will work for using them in g
it seems that cabal install different into different folders.
if two package contains same module name, can they all exist?
since cabal have no "remvoe" or "uninstall". how can I hide some packages?
Cheers!
吴兴博 Wu Xingbo
___
H
35 matches
Mail list logo