[sorry if you receive this twice; mailing list problems]
SCOTT J. wrote:
Thanks for your assistance. I'm using now Notepad.exe . Before I did
it in Wordpad. I use Windows XP. I'm trying to solve this nasty problem
WordPad probably saved your file in RTF rather than TXT. Keep using
Notepad
John Goerzen wrote:
It turns out that Network.Socket.recv raises an EOF error when it gets
back 0 bytes of data.
As it should... recv(2) returns zero bytes precisely when it reaches
EOF; this is the standard sockets-API EOF indicator. See any sockets
tutorial.
HTTP is expecting it to
read. I don't see the problem... (Okay, I can see that if select lies,
and the
read takes a long time you might miss the next scheduling timeslot - but
as far as I am aware select doesn't lie, and read will return immediately
if select says there is data ready)...
select() _does_ lie for
are duplicated by fork(), but the open file descriptions
(your file pointers) are shared. This is obvious by observing what
happens when you write to the same fd in parent and child after a
fork: you don't end up overwriting, you end up interleaving.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http
Hi,
my name is Fabian Otto.
Welcome! Feel free to join in the discussion.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
Haskell-Cafe
Daniel Fischer writes:
One might replace type signatures with comments, of course, and so convey
better information, but that is more work, hence we poor ignorants will
settle for signatures.
You mean one might add comments _as well as_ type signatures, of
course. The only thing worse than
On the other hand, it's difficult or impossible to make a list of a
bunch of different types of things that have nothing in common save
being members of the class.
I've recently been playing with making, for each class C, a
interface datatype IC (appropriately universally and existentially
When I compile it I get three files, an actual runnable binary (at only
5M in size), a .o file and a .hi file. I'm sure these additional files
are usefull in someway and as soon as I come across the right piece of
documentation everything should make sense. But as a person new to
When I compile it I get three files, an actual runnable binary (at only
5M in size), a .o file and a .hi file. I'm sure these additional files
are usefull in someway and as soon as I come across the right piece of
documentation everything should make sense. But as a person new to the
.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
John Goerzen [EMAIL PROTECTED] wrote:
On 2004-12-06, Keith Wansbrough [EMAIL PROTECTED] wrote:
The static vs dynamic linking question has been discussed many times.
The summary is: GHC is a highly-optimising compiler, and the binary
interface _necessarily_ changes with every minor revision
Nice summary.
What I think is missing is an explanation of when you would want this
feature (and when you wouldn't, more importantly). Here is the kind of
platonic dialogue that summarises my limited understanding:
[..dialogue snipped..]
This is good, and is the sort of thing that should
on the
GHC compiler.
What does your teacher want you to do?
Reply to the list, please, not to me only.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe
for internationalization either, because word (and
thus
parameter) ordering may vary among languages.
POSIX / SUS 2001 printf() supports positional arguments, like this:
printf(%2$d %1$s\n,days of christmas,12);
This is required for l10n, as you say..
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED
So you say (and I do agree). But how can I *observe* that they are the same?
Well, not with a single program run (obviously). But it is the case
that for any program P and input sequence X (i.e., keys
pressed):
running P with X
and
running {foo = getChar; P'} with X (where P' is P with all
Graham Klyne wrote:
At 12:27 11/11/04 +, Ben Rudiak-Gould wrote:
[..]
going to be safe, because it's just not the case that
x = once (newIORef ())
y = x
has the same intended meaning as
x = once (newIORef ())
y = once (newIORef ())
No amount of
/hawiki/CircularProgramming for more examples of this
pattern.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http
Hi,
This may be silly, but I tried to code a simmulated annealing method
to solve the travelling salesman prblem, by adapting the algorithm
described in Numerical Recipes in C.
Doesn't seem silly so far! :-)
The problem is that there are
so many iterations, that the program gets killed
[posted to haskell-cafe per SLPJ's request]
Hi Adrian,
I can assure you that for the intended applications of oneShot it
is vital that realInit is executed once at most, but the user must
[..]
So please, no more handwaving arguments about this kind of thing
being unnecessary, bad programming
Adrian Hey writes:
The problem is simple enough to restate for anyone who's interested.
Provide a simple reliable mechanism to ensure that in a given
program run one particular top level IO operation cannot be executed
more than once.
Can you give one concrete example of an intended
Haskell (http://www.haskell.org/onlinereport/decls.html). The use of arity
[..]
BTW, what might the reason for that be, is it for the sake of ease of
translation/implementation, or for the sake of some principle? I
mean, as soon as a person realises that there are multiple syntaxes
for
/manual021.html#htoc99
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Oh, I disagree with this point of view. Circle is certainly a value,
i.e. a full-fledged function, as Brian Beckman correctly surmised. The
Ben Rudiak-Gould wrote:
Brian Beckman wrote:
data Shape = Circle Float
| Square Float
I read this something along the
arithmetic. ACM Computing Survey Volume 23 , Issue 1
(March 1991) Pages: 5 - 48.
http://portal.acm.org/citation.cfm?id=103163
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory
This would also benefit string processing... Imagine:
test = ++
This could be implented as two list cells, one for each string, anf
the cost of the ++ becomes the same as the cost of :
No, you still have to copy so you can change the tail pointer -
but at least it's a
Actually, I've been wondering about this. If my understanding is
correct, Haskell lists are basicly singly-linked lists of cons cells (is
that correct?) A simple (I think) thing to do would be to make the
lists doubly-linked and circular. That would let us do nice things like
have O(1)
.
Count me as a vote for the better-but-slightly-slower wc.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http
I'm an utter noob to Haskell, and FP in gnereal. I would like to create
a function taking an argument which is a function (actually an equation
taking no args, but dependent on other equations), which prints the name
of the function and and it's result. Is there a way of doing this in
[+RTS -xc]
A major problem with this that I notice is that it dumps the stack
whenever any exception is raised, which is a big pain if your program
does IO and regularly raises and catches exceptions as part of normal
operation. A big improvement would be to only dump the backtrace if the
I just saw this on the OCaml list (in a posting by Rafael 'Dido'
Sevilla [EMAIL PROTECTED] in the Observations on OCaml vs. Haskell
thread). I can't believe that a simple wc implementation should be
570 times slower in Haskell than OCaml - could someone investigate and
fix the test?
--KW 8-)
Just wondering, but what exacly is the problem with this open/closed stuff?
As far as I understand it new instances can be added to classes in Haskell
(because they are open)... But its not like instances can be added at link
time, and all the instances that you wish to be considered _must_ be
After all, Java basically does exactly what you're asking for with
Java's head/tail would be doing runtime checks if they are throwing exceptions,
static guarantees mean the program would not be allowed to compile if it broke
the static guarantees.
Not so. In Java, the programmer is forced
correctly sorted lists under _all_ circunstances. This type signature
is much simpler than the actual sort - hence is useful.
sort :: (HList l,HOrderedList l') = l - l'
Nice and readable, and much simpler than the actual algorithm (be
it bubble sort, or a quick sort)
The type
Exceptions should only really be used for unpredictcable events, I find
that the defintion of functions like head is lacking rigor... I would
prefer to see:
head :: [a] - Maybe a
head (a0:_) = Just a0
head _ = Nothing
In principle, yes, but in practice, that would be silly. You use
head
just this.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Jon Fairbairn [EMAIL PROTECTED] writes:
On 2004-04-13 at 18:52+0200 Ketil Malde wrote:
Paul Cosby [EMAIL PROTECTED] writes:
Every time I try to use [underscore] in an definition it says
something like the symbol /017 is not recognised
Could that be \017, i.e. octal 17 (defined in
-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
them.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
upbringing.
No need even to use a file; just have it output to a pipe and read directly from the
pipe...
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing
Hello there!
Although you might not believe it since I'm going to ask a very very
very basic question, I have been using Haskell for educational
purposes for a couple semesters now. Nevertheless, I don't think I
have ever worked with non-Int number types! :)
I don't understand why I get
Dear Haskellers,
Today I searched over more than an hour on the web to
find an implementation of an algorithm that was first
written in the 1970's that solves 2-Conjuntive Normal
Form logical sentences in polynomial time.
I don't recall the exact algorithm, but here are some observations:
I have written a small TH application (module THRecord) which creates update
functions for records. It is intended to be used like this:
You should probably ask on the Template Haskell mailing list:
http://www.haskell.org/mailman/listinfo/template-haskell
--KW 8-)
--
Keith Wansbrough [EMAIL
/tutorial/
http://www.haskell.org/tutorial/io.html
http://www.haskell.org/learning.html
Also
http://www.haskell.org/hawiki/ThatAnnoyingIoType
http://www.haskell.org/hawiki/UsingIo
http://www.haskell.org/hawiki/UsingMonads
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk
Conjecture
2. Hodge Conjecture
3. Navier-Stokes Equations
4. P vs NP
5. Poincare Conjecture
6. Riemann Hypothesis
7. Yang-Mills Theory
Any ideas how to solve any of these, with Haskell or otherwise?
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University
http://www.haskell.org/hawiki/HomeworkHelp
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman
numbers. This makes life simpler when using Haskell as a calculator.
HTH.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED
, and the second argument corresponds to the second line of the
definition.
Now go and do the same for Music.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe
[replying to self, oops]
getNotes n@(Note _ _ _) = [n]
[..]
But of course every function of this form *is a fold* and can be written as such.
Oops, I didn't look closely enough at this line. As written, this
*isn't* a fold because it examines the item (Note _ _ _ :: Music)
directly
I seem to understand the basic idea behind the fold function, i think but do
not seem to be able to write them myself. My understanding is that it works
by replacing every constructor with a fold ?
I think you mean replaces every constructor with a function or
constant.
Think of a list
Think of a list [1,2,3]. Recall this is syntactic sugar
(abbreviation) for 1:(2:(3:[])). That looks like
FYI, I've just added my answer to your question to the Haskell Wiki, at
http://www.haskell.org/hawiki/WhatIsaFold
Enjoy!
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http
on the
first, as in rascal or tattle. I feel silly telling people what a
great language it is, when I can't even pronounce its name... :)
For me it rhymes with tattle - technically, the second vowel is a schwa. Stress
is on the first syllable.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http
to allow * as well.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Keith Wansbrough [EMAIL PROTECTED] writes:
And I don't think - is part of the language - it only appears in the type
syntax, not term syntax. If you allow it, you have to allow * as well.
Errm, you just gave an example of - in the term syntax...
(\x - x*x) 3
Guilty... sorry
too dumb, but how do you return _|_ ?
Return
undefined
or better,
error Erroneously demanded bottom result of buffer allocation phase
Note that
undefined :: a
undefined = undefined
error :: String - a
{- defined internally -}
HTH.
--KW 8-)
--
Keith Wansbrough [EMAIL
Hello,
When I have started my project, I use a Tuples but i would know if it
is possible to create a record such C or Ocaml provide. I mean creating
a structure where variables are accessible by a '.' or something
like that.
Yes. Like this:
data Tree a = Node { key :: Int,
find it useful to peruse (although you should
certainly continue to ask questions here too - we're a pretty friendly
bunch!).
Best wishes,
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory
In attempting to improve the CSV parser based on comments, I have the
following code that's attached. I'm having a heck of a time getting the
double quotes = an escaped quote thing to work. There is some commented out
code which was my last attempt. As it stands the code works, minus the
quote
character. That is, the strings
This is a quoted string
Koln
appear in a CSV file as
This is a quoted string
Koln
Also, be sure to support newlines within quoted strings (I think you do already).
Many CSV parsers fail to do this, with nasty results.
--KW 8-)
--
Keith Wansbrough
Hi all,
I have a question on compiling a concurrent haskell source code
using GHC. Today is my first time playing around with concurrency in
Haskell, and this afternoon, GHC seemed to be able to compile my
code and produced an executable. However, that executable did not
seem to run the
that this is *not* the same as existential quantification; note
carefully the location of the forall wrt the constructor.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing
suggest you ask your instructor/lecturer, or consult your textbook.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http
, 1997, LATOS - A Lightweight Animation Tool for Operational
Semantics]
http://www.eecs.usma.edu/Personnel/okasaki/pubs.html#hw02 [Chris Okasaki, Haskell
Workshop 2002, Techniques for embedding postfix languages in Haskell]
Enjoy!
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http
a look at remind for a language that can express all these things, *and* knows
the date of Easter.
http://www.linuxjournal.com/article.php?sid=3529
http://www.roaringpenguin.com/remind/
Not suggesting we copy this directly, of course!!
--KW 8-)
PS: Happy New Year, everyone!
--
Keith
! The Haskell Wiki lives at
http://www.haskell.org/wiki/wiki
and you probably want to put the article under LessFrequentlyAskedQuestions.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory
add your nuggets of wisdom to the
Wiki whenever you write a detailed answer to the email list. This way
we can build up a repository of answers to FAQs very easily.
Thanks!
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer
are written in C++, no one is written in
C.
If I want to write haskell bindings for such a thing, what can I do?
Go to www.haskell.org, and look at Libraries and Tools. There you will see HOpenGL,
which is just what you seek.
http://haskell.org/HOpenGL/
HTH!
--KW 8-)
--
Keith Wansbrough
does anybody know how to do a term unification in Haskell in O(n), where n
is length of the input terms? I know Montanari-Martelli algorithm for this,
but I'm unable to code it in Haskell (in O(n)). I would need a destructive
update of the directed graph representing terms (to do a
Jerry writes:
While my goals are:
* Become a pragmatic haskell programmer in the shortest time
* At the minimal expense
What I have done for the past few weeks were:
* I read almost all the free educational sources at www.haskell.org,
* Subscribed to this mailing list and try to digest
Hello *,
I am just curious: Why does Haskell not provide exceptions a la SML?
Why does only the IO monad allow for exceptions?
GHC certainly implements exceptions, along the lines described in
A semantics for imprecise exceptions, Simon Peyton Jones, Alastair
Reid, Tony Hoare, Simon
the Latex companion, but it's not listed there AFAICT.)
\newcommand{\lsem}{[\![}
\newcommand{\rsem}{]\!]}
is what I use; there are some real ones in \usepackage{stmaryrd} if you really want
them.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
Cambridge University
2. Macros make the parsed grammar dynamic. Usually compiler has hard-coded
parser generated by LALR parser generator(like Happy or Yacc) compiled in.
Introducing each macro like you proposed would need(I think) generating
new parser(at least for the fragment of the grammar).
Dylan has macros
Jerzy Karczmarczuk [EMAIL PROTECTED] writes:
Macros in Scheme are used to unfold n-ary control structures such as COND
into a hierarchy of IFs, etc. Nothing (in principle) to do with laziness
or HO functions.
Isn't this exactly the reason that macros are less necessary in lazy languages?
In
ms
Please, everyone (not just Chris) fill in the relevant pages with discussion of what
the various patterns are, and add new ones of interest. Let's see if we can get a
book together like the Design Patterns crowd...
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/u
e doesn't work).
HTH.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
Cambridge University Computer Laboratory.
74 matches
Mail list logo