for the types you
want to support -
data Object = IntObject Int | StringObject String
objectString :: Object - String
objectString (IntObject v) = show v
objectString (StringObject v) = v
main = mapM (putStrLn . objectString) [(IntObject 7), (StringObject eight)]
Donn Cave, [EMAIL
is the same with the other, right?
thanks,
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
in Haskell,
so whatever problem with one is the same with the other, right?
thanks,
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
don't see any other
Ptr-related function or constructor in the documentation - am I missing
something there?
Thanks,
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
, and that didn't leak nearly as much memory -
but still some, in a simple loop where pack doesn't leak anything.
Thanks,
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
hi shell
process, because that process exits instead of reading from its input.)
I can't say whether you really need forkIO, or whether it's really going
to do what you need - not only do I not know enough about the thread
model, neither do I know what you're really trying to do.
Donn Cave
.
For me, it hangs - since I left the wait in. If I omit the wait, it's
broken pipe, I think because we're trying to write data to head
after it exits.
Donn Cave, [EMAIL PROTECTED]
sh :: String - String - IO String
sh cmd = \input -
do (stdin, stdout, _, pid
involve operations on
the file handle, e.g., hClose.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
in such cases. For example,
one common way to share a file is to interlock around some resource,
and when you acquire the lock, you read the file (get its contents)
and release the lock.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell
their
livelihood on Haskell software development - it isn't the safe choice, and
it means someone finds the reasons for it very compelling.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
On Fri, 4 Aug 2006, Udo Stenzel wrote:
Hans van Thiel wrote:
I'm wondering why I can't find any commercial Haskell applications on
the Internet. Is there any reason for this?
Of course. Corporations are conservative to the point of being
boneheaded. So to avoid risk, they all went on the
seems
obtuse, I haven't used wxHaskell, more interested in the idea in
general - I've done it with Python, but there the API is more obvious.)
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org
On Wed, 2 Aug 2006, Donald Bruce Stewart wrote:
...
Of course, if you're learning Haskell, you should probably try to
/avoid/ mutable variables for a while.
Along the same line, I note that proposed solutions seem to use
features relatively recently added to the language, is that true?
StateT
- I'm asking
for the easy thing! You don't need to know why execve() needs to support
argv[0..n]. You don't need to know why there's an ldap_bind_s, and an
ldap_bind. Just give me access to the functions the way they are, please!
Thanks!
Donn Cave, [EMAIL PROTECTED
be assigned to the else clause, but there don't tend to be that
many other such contexts. Does that answer the question?
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
, but something about LDAP_OPT_X_TLS
hints that it may be non-standard.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
so on the link command,
libldap.a instead of -lldap. Pardon me if that's obvious!
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
is type 1. UNIX shell does that, awk,
Python ... (Perl is awk gone horribly wrong, so it presumably
does but if it doesn't, it's the exception that proves the rule.)
It has worked for a lot of people who do a lot of splitting, for
a lot of years.
Donn Cave, [EMAIL PROTECTED
the split condition be the first
parameter -- the infix notation looks good, but it will need a
flip to get the parameters in the right order.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org
(xs)
| ==
| \n `join` xs
|in Haskell (wherejoin sep = concat . intersperse sep )
Suit yourself! Since we seem to be in agreement on the basic point,
I won't go into what I think about \n.join(xs).
Donn Cave, [EMAIL PROTECTED
simply compare with
a separator string, but could easily do more - eat up trailing blanks,
for example.
Note use of Maybe, basically to disambiguate end of data with and without
match.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell
-parameter typeclass.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Haskell into this application
domain is an absurdity on the order of Edgar Rice Burroughs' fantasy
of Tarzan appearing out of the jungle and being appointed chief of
the Waziri.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe
, and there would need to be
some rules about how binaries would work to cooperate with the Haskell type
system.
What about the parameters - certainly there's little point in relieving me
of the bother of quoting a command name, if I have to quote each parameter?
Donn Cave, [EMAIL PROTECTED
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
, but you know cat is
actually a standard UNIX command, that writes to standard output
and has no output file parameter? What's up with the new parameter
in your version - was it not going to be workable the way it was?
Donn Cave, [EMAIL PROTECTED
instead, for example. I don't see
anything about what you were doing that would be obviously different
from runProcessInteractive, but as long as you're making a pipe for
error output, you may as well read it and see if gnuplot has left
any clue to its problem there.
Donn Cave, [EMAIL
descriptor may be inherited by multiple processes,
any one of which may hold it open - only the last close matters.
That's why functions like runProcess normally close the opposite
ends of the pipe, in the parent child forks, so that the parent
doesn't hold the child's open or vice versa.
Donn
= runProcess /bin/tcsh [-c, cmd] Nothing Nothing
Nothing Nothing Nothing
The 2nd parameter is argv with argv[0] gratuitously removed.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
devices like a tty, pipe etc.
Select/poll/epoll
are designed to work primarily with non-blocking I/O.
That's what the Linux kernel developers say, anyway, since it
would be inconvenient for them to fix this, even though it
apparently violates the POSIX specification.
Donn Cave, [EMAIL
, can open or dup another file onto fd 0. Conversely,
if a program contrives to change stdin to something besides fd 0, I would
have assumed the intent was to avoid any affect on child processes.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe
filesystem
events along with the usual select stuff.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
this
function, but it looks promising.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
/O,
and that the need for this can occur in such ordinary, mundane applications
as reading stdout and stderr in parallel.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
is that this parrot is
dead, and everyone is just too polite to say so. Unfortunately,
this inability to pull the shades on Green Card, Haskell Direct,
etc., takes away a little from ghc's outstanding FFI.
Donn Cave, [EMAIL PROTECTED]
___
Haskell
work on top of the file descriptor, but what
makes it worth the trouble?
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
the flushes in my example. The first may be necessary to avoid
copying buffered data into the fork, which would cause it to appear
twice. The second is a work-around for a bug that was mentioned here
only a day or two ago.
Donn Cave, [EMAIL PROTECTED]
module Main (main) where
import
or close is needed only
in relatively rare circumstances. C, for example ... in fact, I'm
surprised to see this behavior in any I/O library. The point of difference
I expect, in more modern languages, is between immediate and deferred
finalization.
Donn Cave, [EMAIL PROTECTED
like that. So it isn't at all necessary to have
another word for functions of type IO a.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Quoth Pupeno [EMAIL PROTECTED]:
| On Monday 26 December 2005 02:41, Donn Cave wrote:
| I don't think it will be too much worse. I would not try to
| combine the struct updates, in the both case -- it doesn't buy
| you anything, and pulls you into duplication you don't want.
| What about
there be a temptation to switch to the Objective CAML
tutorial because of a mistaken impression.
Donn Cave, [EMAIL PROTECTED]
---
sequence :: Monad m = [m a] - m [a]
sequence [] = return []
sequence (c:cs) = do x - c
xs - sequence cs
return (x:xs
evidently didn't write any compiler in Haskell
at all. Better a C++ program than a Haskell program that offends you?
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
world in the scheme of things, or if
at that first step it would be better to focus on the language.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
of this
notion altogether.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
when it occurs in library functions.
Now if you actually have observed that your SIGINT handler was entered
at this point, then please ignore me.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
it depends a lot on when we decide we `have to' use FFI, and in the end
the advantages will very often be too compelling. Even for basic data
manipulation without Haskell overhead, like FPS.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
hPutStr af append this line\n
hSeek sf AbsoluteSeek 40
hGetLine sf = print
hPutStr af append this line\n
hSeek sf AbsoluteSeek 60
hGetLine sf = print
(It works for me, with hugs on a more or less UNIX-like platform.)
Donn Cave, [EMAIL
Quoth Einar Karttunen ekarttun@cs.helsinki.fi:
| On 11.12 22:26, Donn Cave wrote:
| Quoth Einar Karttunen ekarttun@cs.helsinki.fi:
| | It seems that opening the same file multiple times (one writer
| | and multiple readers) is not supported at least on *nix with
| | GHC. I want to use one
' is coming along. (Hope they figured out a better
| name, anyway.)
|
| Got an url for the project?
http://homepages.inf.ed.ac.uk/wadler/links/
Having looked it up, of course I looked at it. Please forget I asked.
Donn Cave, [EMAIL PROTECTED
Quoth Jimmie Houchin [EMAIL PROTECTED]:
...
| Haskell looks like a very interesting language. I am only so-so with
| Python and I thought that maybe if instead of spending sufficient time
| to get proficient with Python, I could invest a similar time (more or
| less) and get reasonably
style of writing, does ... end a
sentence, or should that be interpreted in some other way?
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
32 bit floats on the C
side before swapping them with htonl.
Donn Cave, [EMAIL PROTECTED]
--- Netword.hsc ---
-# OPTIONS -fffi #-}
module Netword (htonl,ntohl) where
import Foreign
import Foreign.C
#include netw.h
foreign import ccall unsafe c_htonl htonl :: CInt - CInt
foreign import
On Tue, 20 Sep 2005, Bernard Pope wrote:
On Tue, 2005-09-20 at 10:14 +0200, Sven Moritz Hallberg wrote:
Donn Cave schrieb:
...
but how do you write
getArgs = \ [] - putStrLn (no arguments)
(a:_) - putStrLn (show a)
What about good old let?
main
= getArgs
., this seems to be OK:
getArgs = \ (a:_) - putStrLn (show a)
but how do you write
getArgs = \ [] - putStrLn (no arguments)
(a:_) - putStrLn (show a)
(pardon me if I missed where you were going in case of ...)
Donn Cave, [EMAIL PROTECTED
fromLDAPOpt LDAP_OPT_X_TLS = (#const LDAP_OPT_X_TLS)
fromLDAPOpt LDAP_OPT_X_TLS_REQUIRE_CERT = (#const LDAP_OPT_X_TLS_REQUIRE_CERT)
fromLDAPOpt LDAP_OPT_PROTOCOL_VERSION = (#const LDAP_OPT_PROTOCOL_VERSION)
fromLDAPOpt LDAP_OPT_DEBUG_LEVEL = (#const LDAP_OPT_DEBUG_LEVEL)
etc.
Donn
/survey.html, there are
also some significant omissions. For example, he doesn't use this
phrase, but I think there's no open recursion. I can't imagine
using this language's OO features in a C++ toolkit wrapper. But I
never tried it, and it might be an interesting demonstration project.
Donn
version, than to check the shell command input data for
shell punctuation that would have unintended results.
If you're on another platform or using another Haskell implementation,
it still might be worth a try, I just haven't tried it myself.
Donn Cave, [EMAIL PROTECTED
common mistake of discounting
a trailing separator, so both A:A: and A:A split to [A, A],
where the former should be [A, A, ]. It does handle
:A:A and A::A correctly, so you can just wrap splitPS with a
function that may add a nilPS depending on the end of the input
string.
Donn Cave
for curiosity's sake, how much string data are we
talking about here? Is it practical to process a serious volume
of data as [Char]?
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
On Wed, 11 May 2005, Jerzy Karczmarczuk wrote:
Pierre Barbier de Reuille wrote about Python and lambdas:
Well, I would not recommand using lambda functions ! The main reason
is they are limited in that they only accept expressions (ie. not
statements) and you can end up with very ugly things
of
Objective CAML (the language) as ocaml (the implementation), but given
the choice of a language I can actually use on a given platform, I am
predisposed to have a soft spot for its other virtues like predictable
execution and a relatively rigorous OOP model when you want it.
Donn Cave
need to also identify head's caller,
then it should be obvious that this requirement is recursive.
Donn Cave, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
301 - 362 of 362 matches
Mail list logo