hi
I have a function parseInt... which needs an error guard for when the input is
not an Int.
parseInt :: ParserparseInt [] = []parseInt xs = let (digits, rest) = span
isDigit (removeSpace xs)in [(EInt (read digits), removeSpace
rest)]
Also... I have a function that does
Hi,
I'm trying to use the ST monad in order to turn an almost pure function into
a pure one: reading a precalculated list of primes into a prime set. But the
following code brings an error:
primes :: Set Integer
primes = runST $ getPrimes primes10h7.txt
getPrimes :: String - (forall s. ST s
Ok, solved, the use of ($) was the problem.
I changed it
primes :: Set Integer
primes = runST (getPrimes primes10h7.txt)
and it compiles (and works too).
Nicu
-Ursprüngliche Nachricht-
Von: Nicu Ionita [mailto:[EMAIL PROTECTED]
Gesendet: Sonntag, 9. Dezember 2007 12:12
An:
Stefan O'Rear wrote:
On Sat, Dec 08, 2007 at 08:33:36PM +, Andrew Coppin wrote:
I just spent the evening writing a library that's a thin layer over Gtk2hs.
It took an age to get it to compile, but eventually it worked. Yay!
When I ran it, I got this:
Test2:
The typechecker in 6.6.1 gets confused by the ($) and loses track of
the 'freeness' of s (the thread variable) . The same code should work
fine in 6.8.1, or alternatively in 6.6.1 without the ($).
Cheers
pepe
On 09/12/2007, at 12:11, Nicu Ionita wrote:
Hi,
I'm trying to use the ST monad
On Dec 9, 2007 2:39 PM, pepe [EMAIL PROTECTED] wrote:
The typechecker in 6.6.1 gets confused by the ($) and loses track of
the 'freeness' of s (the thread variable) . The same code should work
fine in 6.8.1, or alternatively in 6.6.1 without the ($).
True. However, note that the release notes
True. However, note that the release notes of 6.8.1 encourage not to
rely in this new feature because it can change in the feature.
I obviously meant in the future, sorry.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Mon, 03 Dec 2007 18:24:10 +0100, Mathieu Boespflug [EMAIL PROTECTED]
wrote:
On Nov 2, 2007 10:19 PM, nornagon [EMAIL PROTECTED] wrote:
On 03/11/2007, Greg Fitzgerald [EMAIL PROTECTED] wrote:
Anybody know of an ARM back end for any of the Haskell compilers?
If there's an arm-eabi port
On 7 Dec 2007, at 12:39 PM, Dan Weston wrote:
Luke Palmer wrote:
On Dec 7, 2007 7:57 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 7, 2007 7:41 PM, Dan Weston [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
You can project the compile time numbers into runtime ones:
Yes, that works well if I
IO is important because you can't write any real program without using it.
Ouch! I get awfully discouraged when I read statements like this one. The
more people who believe it, the more true it becomes. If you want to do
functional programming, instead of imperative programming in a
(moving to haskell-cafe)
readIVar' :: IVar a - a
readIVar' = unsafePerformIO . readIVar
so, we do not need readIVar'. it could be a nice addition to the
libraries, maybe as unsafeReadIVar or unsafeReadMVar.
The same argument applies any to pure function, doesn't it? For instance, a
non-IO
On Sun, Dec 09, 2007 at 12:11:42PM +0100, Nicu Ionita wrote:
Hi,
I'm trying to use the ST monad in order to turn an almost pure function into
a pure one: reading a precalculated list of primes into a prime set. But the
following code brings an error:
primes :: Set Integer
primes =
Am Sonntag, 9. Dezember 2007 18:31 schrieb Conal Elliott:
IO is important because you can't write any real program without using
it.
Ouch! I get awfully discouraged when I read statements like this one. The
more people who believe it, the more true it becomes. If you want to do
Bryan O'Sullivan wrote:
Albert Y. C. Lai wrote:
I can't blame you for being not observant. Afterall, this is precisely
what I'm alluding to with everyone can haz PC [...]
Please don't flame people on the list.
I'm flaming an idea, not people on the list.
There's an ARM backend in hbc.
On Nov 2, 2007 8:30 PM, Greg Fitzgerald [EMAIL PROTECTED] wrote:
Anybody know of an ARM back end for any of the Haskell compilers?
Thanks,
Greg
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Dec 9, 2007 10:07 AM, Daniel Fischer [EMAIL PROTECTED] wrote:
Interactive programmes without using IO? Cool :)
And how!
I think you misunderstood Lennart.
Thanks for checking. In this case, I think I understood Lennart fine and
that he was saying what you're saying.
Would you deny that
On Dec 8, 2007 6:33 PM, Andrew Coppin [EMAIL PROTECTED] wrote:
(Also, the documentation for Graphics.UI.Gtk.Misc.DrawingArea suggests
that you may want to draw a Pixbuf using the pixbufRenderToDrawable
function - but GHC complains that this function doesn't exist. I had to
use drawPixbuf
Thanks, Luke. I'd been unconsciously assuming that the IVar would get
written to (if ever) by a thread other than the one doing the reading.
(Even then, there could be a deadlock.)
- Conal
On Dec 9, 2007 9:37 AM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 9, 2007 5:09 PM, Conal Elliott
Conal,
It's true that you can avoid using IO (except for a wrapper) for certain
kinds of programs.
For instance, if all you want is a String-String function, or some GUI
program (you forgot to mention fudgets, which was the first wrapper of this
kind) then you can ignore IO and just use a nice
I would claim that it's fine to use the type
readIVar :: IVar a - a
if you're willing to give the right semantics to
newIVar :: IO (IVar a)
The semantics is that sometimes when you create an IVar you'll get one that
always returns _|_ when read, sometimes you'll get a proper one. Now if you
Conal,
I think TV etc. is fantastic stuff, but that mean that we cannot, say,
invoke an external program in Haskell until someone has figured out a
composable library for this?
I sincerely hope someone will, but the only way we have right now is the
ugly IO monad.
-- Lennart
On Dec 9, 2007
I think your real point is that some things we still haven't figured out how
to express functionally. Right? I would certainly agree with that part.
Perhaps you exaggerating when you wrote IO is important because you can't
write any real program without using it.
Cheers, - Conal
On Dec 9, 2007
Am Sonntag, 9. Dezember 2007 21:29 schrieb Conal Elliott:
I think your real point is that some things we still haven't figured out
how to express functionally. Right?
That's my point, at least. Currently, AFAIK, the only way to get input and
produce output is via the IO monad, so it is de
hi I have a function parseInt... which needs an error guard for when the input
is not an Int. parseInt :: ParserparseInt [] = []parseInt xs = let (digits,
rest) = span isDigit (removeSpace xs)in [(EInt (read digits),
removeSpace rest)] Also... I have a function that does this...
On 12/9/07, Ryan Bloor [EMAIL PROTECTED] wrote:
hi
I have a function parseInt... which needs an error guard for when the input
is not an Int.
parseInt :: Parser
parseInt [] = []
parseInt xs = let (digits, rest) = span isDigit (removeSpace xs)
in [(EInt (read digits),
[reply forwarded to list]
-- Forwarded message --
From: Ryan Bloor [EMAIL PROTECTED]
hi
sorry for vagueness.
I am writing a basic Parser from scratch. So far I have functions;
# removeSpaces
# match - which checks if a string is a substring of another
# orParser which
hi sorry for vagueness. I am writing a basic Parser from scratch. So far I
have functions; # removeSpaces # match - which checks if a string is a
substring of another # orParser which combines two parser's abilities # Basic
pasrers like... parseInt, parseTrue, parseFalse, parseBoolusing the
Thanks for the clarification.
AFAIK, the only way to get input and produce output is via the IO monad
Now you know something different, don't you? FRP, Pan, TV. Also
Grapefruit, functional forms, and others I'm not thinking of or don't know
about.
As for your example, mixing the IO with the
Hi Conal,
On Dec 9, 2007 6:09 PM, Conal Elliott [EMAIL PROTECTED] wrote:
readIVar' :: IVar a - a
readIVar' = unsafePerformIO . readIVar
so, we do not need readIVar'. it could be a nice addition to the
libraries, maybe as unsafeReadIVar or unsafeReadMVar.
The same argument applies any to
Thanks. If I'm tracking, your real point is that imperative programming in
Haskell is still useful enough to keep around. I agree.
I'm still puzzled. Did you understand something I said, or maybe someone
else said, as suggesting that imperative programming be removed from Haskell
any time
Daniel Fischer [EMAIL PROTECTED] writes:
IO is important because you can't write any real program without using
it.
Ouch! I get awfully discouraged when I read statements like this
one.
I think Lennart was referring to that, you HAVE to know a little IO to write
programmes, at least
Am Sonntag, 9. Dezember 2007 23:35 schrieb Ketil Malde:
Daniel Fischer [EMAIL PROTECTED] writes:
IO is important because you can't write any real program without using
it.
Ouch! I get awfully discouraged when I read statements like this
one.
I think Lennart was referring to that,
Maybe you should look into Parsec, a Haskell library for writing parsers.
Google should find what you need.
- Phil
On Dec 9, 2007 1:58 AM, Ryan Bloor [EMAIL PROTECTED] wrote:
hi
I have a function parseInt... which needs an error guard for when the
input is not an Int.
parseInt :: Parser
Andrew Coppin wrote:
Such a GUI would be cool for a number of projects. It still needs to
exist first. ;-)
I don't think anyone has mentioned this:
http://haskell.org/Blobs
which I haven't used, though the screenshots look good.
___
Haskell-Cafe
I doubt all imperative programming will be banished from Haskell anytime
soon. I really, really wish we had all the nice abstractions in place
already, but we just don't.
You can't write any program in Haskell without using IO, because the type of
main involves IO.
And currently I believe that
Maybe I'm exaggerating, but it's true for 96% of all programs. (96% is with
a :-))
I did not express anything that was meant to be a perpetual truth, only best
practice at the moment.
For a living I write programs that are almost without interaction with the
outside world. Still, I need a to
On Sat, 2007-12-08 at 13:08 -0800, Stefan O'Rear wrote:
On Sat, Dec 08, 2007 at 08:33:36PM +, Andrew Coppin wrote:
I just spent the evening writing a library that's a thin layer over Gtk2hs.
It took an age to get it to compile, but eventually it worked. Yay!
When I ran it, I got
The xmonad dev team is pleased to announce the 0.5 release of xmonad!
http://xmonad.org
xmonad is a tiling window manager for X. Windows are arranged
automatically to tile the screen without gaps or overlap, maximising
screen use. Window manager features are
It so happens that Haskell currently insists on main :: IO (). That's
simple to fix, however, and with great pay-off. Suppose instead main :: TV
a (where I'm omitting the other TV type args for simplicity.) Then a
program could not only be run, but also composed with other programs. They
could
Hi,
Yes, I looked into it as per the Mailman documentation.
I was wondering if there was a module already that could do it, to
avoid some work :)
What is the difference between In-Reply-To and References?
And the list of posts was just the beginning. Each post would have
sufficient information
And looks like this post has gone on a tangent :D
Vimal
And looks like this _thread_ has gone on a tangent :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Thanks. I don't know for what uses of IVars the difference in
expressiveness is helpful, but now I get that the difference is there.
Cheers, - Conal
On Dec 9, 2007 2:08 PM, Benja Fallenstein [EMAIL PROTECTED]
wrote:
Hi Conal,
On Dec 9, 2007 6:09 PM, Conal Elliott [EMAIL PROTECTED] wrote:
hi I am writing a basic Parser from scratch. So far I have functions;#
removeSpaces# match - which checks if a string is a substring of another#
orParser which combines two parser's abilities# Basic pasrers like... parseInt,
parseTrue, parseFalse, parseBoolusing the orParser on True and
(...)
Would you deny that any useful programme has to do at least some of
the following:
-accept programme arguments at invocation
-get input, be it from a keyboard, mouse, reading files, pipes...
-output a result or state info, to the monitor, a file, a pipe...
===
As long
Argh, that last sentence should read the file is left alone..
On Dec 9, 2007 10:15 PM, David Fox [EMAIL PROTECTED] wrote:
Here is a practical example I ran into a few days ago. With this
expression:
writeFile path (compute text)
the file at path would be overwritten with an empty file
45 matches
Mail list logo