"Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote:
> static int old;
> int diff (int now) { /* this would be called once a second */
> int ret = now - old;
> old = now;
> return ret;
> }
>
You do it with variables, of course. This is out of some GLUT code,
using IORef's:
idle :: State -> Idl
I can think of 2 ways.
> module Main where
>
> import Control.Monad.State
First, normal way:
> diff (now, old) = (now - old, now)
diff takes now and old and returns result (now - old) and modified old (now).
For example,
diff (diff (1,0))
==> diff (1 - 0, 1)
==> diff (1, 1)
==>
Magicloud Magiclouds wrote:
> Say I have something like this in C:
> static int old;
> int diff (int now) { /* this would be called once a second */
> int ret = now - old;
> old = now;
> return ret;
> }
> Because there is no "variable" in Haskell. So how to do this in a
> FP way?
So
Hello,
I am getting familiar with FP now, and I have a "program design" kind of
question.
Say I have something like this in C:
static int old;
int diff (int now) { /* this would be called once a second */
int ret = now - old;
old = now;
return ret;
}
Because there is no "variable"
> Hmm, this gives me a new idea for a feature request - how about a function
> that evaluates to the source code line number it was called from? ;-)
Well, that wouldn't be a function, but one of the other "-hc"s (j? n?)
has srcloc_annotate which is a macro that does that. It would be nice
if ghc
Hi,
Which tools do you recommand for memory profiling haskell programs
on a *nix system.
I'm using haskell to develop a CGI program/script.
The application has to be deployed on shared hosting infrastructure.
Since I would like to be a good citizen ,
I would need to meassure the maximum amount
On Sat, 2008-06-14 at 10:26 -0400, Dimitry Golubovsky wrote:
> Hi,
>
> Is there any way to query the latest version of a particular package
> stored on Hackage, that was successfully built?
It is certainly part of the plan. There is currently no convenient way
to get at the information. I've bee
On Sat, 2008-06-14 at 18:18 +0200, Sebastiaan Visser wrote:
> Hi,
>
> I've got a question about lazy IO in Haskell. The most well known
> function to do lazy IO is the `hGetContents', which lazily reads all the
> contents from a handle and returns this as a regular [Char].
>
> The thing with hGe
On Sat, 2008-06-14 at 19:21 +0100, Sebastian Sylvan wrote:
> I think that if GTK did use this system (rather than append the module
> name to the function and export them "flatly") a lot of people would
> resort to ugly hacks like putting the import statements in a file
> somewhere and using the
Andrew Coppin <[EMAIL PROTECTED]> wrote:
> I have a small idea. I'm curios if anybody else thinks it's a good
> idea...
>
> How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a
> particular point in the program *should* be unreachable?
>
I might support this in some way or the o
On Sat, 2008-06-14 at 11:03 +0100, Claus Reinke wrote:
> > http://hackage.haskell.org/trac/hackage/ticket/227
> >
> >One problem is that not all build-tools correspond to haskell
> >packages. Some do some don't. We have a hard coded list of them
> >at the moment (which can
On Sat, 14 Jun 2008, Isaac Dupree wrote:
yeah, we could come up with a syntax. one that gives privileged meaning to
hierarchy. If used according to "design your modules for qualified import",
it would still allow fairly easy use and looking up function uses.
import Graphics.UI.GTK (import q
On Sun, 15 Jun 2008, Andrew Coppin wrote:
Henning Thielemann wrote:
I think it is another instance of mixing up errors and exceptions (you know
the haskellwiki pages ...)
Since an 'error' marks a programming error (which should never occur) it
would not hurt the program if all 'error's are
Henning Thielemann wrote:
I think it is another instance of mixing up errors and exceptions (you
know the haskellwiki pages ...)
Since an 'error' marks a programming error (which should never occur)
it would not hurt the program if all 'error's are replaced by
'undefined', an illegal memory a
On 2008.06.15 16:50:28 +0200, Adrian Neumann <[EMAIL PROTECTED]> scribbled 6.9K
characters:
> I screwed up the email, sorry about that. What I wanted to say was:
>
> Hello,
>
> as homework I was assigned to "design and draw an image" using the SOE
> Graphics library [1]. In order to impress my cla
I screwed up the email, sorry about that. What I wanted to say was:
Hello,
as homework I was assigned to "design and draw an image" using the
SOE Graphics library [1]. In order to impress my classmates I decided
to draw a bush-like thingy using a Lindenmayer-System. It turns out
quite nice
{- I downloaded the source and put my file in the same directory
You may need to adjust the imports -}
module Main where
import Picture
import Draw -- change xWin to 1000 and yWin to 700 for this to work
import EnableGUI -- I use a Mac
import SOE hiding (Region)
import qualified SOE as G (Regio
Andrew Coppin wrote:
Obviously there is no way in hell this code path can ever be executed.
Ah, the number of times I've thought that and been wrong :)
From a simplistic perspective what I think you're asking for is
to have obscure occasions when your program goes wrong with random
consequence
> > I was just listening to Brooks' talk at OOPSLA 2007 and in the Q&A part
> > at the end he mentions a paper on increasing entropy in software
> > systems. He mentions the authors' names but I can't quite make it out
> > and Google hasn't been very helpful either. He says the paper “must
> > b
Magnus Therning <[EMAIL PROTECTED]> writes:
> I was just listening to Brooks' talk at OOPSLA 2007 and in the Q&A part
> at the end he mentions a paper on increasing entropy in software
> systems. He mentions the authors' names but I can't quite make it out
> and Google hasn't been very helpful ei
On 15 Jun 2008, at 07:41, Deborah Goldsmith wrote:
On Jun 14, 2008, at 1:06 PM, Don Stewart wrote:
tom.davie:
In the mean time -- who knows enough to make ghc target ARM, and get
this to link against the iPhone libraries? This would be quite a
coup
if it could be made to run there!
I'd
Robert Vollmert <[EMAIL PROTECTED]> writes:
> Great reply!
Thanks.
> One minor point: If real_programme is to be pure, you should use let:
Whoops! I was thinking "let" but wrote the wrong thing. If
my email had been through a type-checker, it would have
spotted the mistake.
--
Jón Fairbairn
Great reply!
One minor point: If real_programme is to be pure, you should use let:
On Jun 14, 2008, at 12:30, Jon Fairbairn wrote:
main :: IO()
do gen <- getStdGen
the_list <- real_programme gen
let the_list = real_programme gen
print the_list
You should be able to deduce f
Hi,
>> There's a way to put something in the .cabal file about extra data files,
>> and have it install them in a certain location that you can then find
>> programmatically. I forget the details, but I think it's pretty easy to set
>
> http://neilmitchell.blogspot.com/2008/02/adding-data-files-u
24 matches
Mail list logo