Re: [Haskell-cafe] Interesting data structure

2007-12-28 Thread Paul Johnson
Tim Docker wrote: I found it worthwhile to try and visualise what's going on here. Let's say I have 4 calculations that I want to run in parallel. The first doesn't need a request; the second needs to make a single request (A1); the third needs to make two requests where the second (B2) depends o

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Jon Harrop
On Saturday 29 December 2007 06:31:35 Miguel Mitrofanov wrote: > >> Well, it seems for me that Erlang is much less functional than Lisp. > >> It's totally OO, in fact. > > > > OO is orthogonal to functional. > > ? Kay's definition of OOP necessarily implies imperative behaviour. OCaml has purely f

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Jon Harrop
On Saturday 29 December 2007 06:09:44 Bill Wood wrote: > On Fri, 2007-12-28 at 20:23 -0700, Luke Palmer wrote: > > OO is orthogonal to functional. Erlang is pure functional, Lisp is a > > bastard child... > > Give it its historical due, please -- bastard grandsire at least. You'll have to speak u

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Peter Verswyvelen
Jon Harrop wrote: However, both F# and Scala have the potential to dwarf all of these languages in the not-so-distant future. I believe F# will do so in 2008 but Scala will take 2-3 years because they have far fewer resources to develop essential tools like working IDE plug-ins. I agree on t

Re[2]: [Haskell-cafe] Unbuffered character IO under Windows XP?

2007-12-28 Thread Bulat Ziganshin
Hello Ryan, Saturday, December 29, 2007, 7:14:25 AM, you wrote: > Is it possible to have unbuffered character IO under > Windows XP? > I have this problem as well and would love to hear if there is an answer. once i had a hard day trying to figure out how to to the same in Unix. in Windows, it w

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Miguel Mitrofanov
Well, it seems for me that Erlang is much less functional than Lisp. It's totally OO, in fact. OO is orthogonal to functional. ? Kay's definition of OOP necessarily implies imperative behaviour. Erlang is pure functional, Erlang functions are not prevented from having side effects in any

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Bill Wood
On Fri, 2007-12-28 at 20:23 -0700, Luke Palmer wrote: . . . > OO is orthogonal to functional. Erlang is pure functional, Lisp is a > bastard child... Give it its historical due, please -- bastard grandsire at least. -- Bill Wood ___ Haskell-Cafe

Re: [Haskell-cafe] Specializing classes with classes

2007-12-28 Thread alex
I see.. (Presumably you meant "instance Alg Sometype", "instance Vec Sometype" etc.) I have got it working now, and it looks like: 1) I can't specialise superclass methods with other class methods, within the class hierarchy, and 2) I have to instantiate each superclass individually, for any type

Re: [Haskell-cafe] An interesting monad: "Prompt"

2007-12-28 Thread Thomas Hartman
Would you mind posting the code for Prompt used by import Prompt I tried using Prompt.lhs from your first post but it appears to be incompatible with the guessing game program when I got tired of reading the code and actually tried running it. best, thomas. 2007/12/4, Ryan Ingram <[EMAIL PROT

Re: [Haskell-cafe] Specializing classes with classes

2007-12-28 Thread ajb
G'day all. Quoting alex <[EMAIL PROTECTED]>: I would like to do this: class Foo t where hi :: t -> Bool class Foo t => Bar t where hi x = True This is arguably one of the most requested features in Haskell. The only reason why it hasn't been implemented yet is that

Re: [Haskell-cafe] Unbuffered character IO under Windows XP?

2007-12-28 Thread Ryan Ingram
I have this problem as well and would love to hear if there is an answer. I think there are some windows terminal settings that the GHC runtime should twiddle when you change the buffering state on stdin, but I don't know exactly what is involved. -- ryan On 12/28/07, Peter Schmitz <[EMAIL PRO

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Jon Harrop
On Friday 28 December 2007 11:05:12 Andrew Coppin wrote: > I thought Lisp and Erlang were both infinitely more > popular and better known. Followed by Clean and O'Camal. According to the Debian and Ubuntu package popularity figures OCaml, Haskell and Erlang are the most popular general-purpose f

[Haskell-cafe] Specializing classes with classes

2007-12-28 Thread alex
Hi, I am new to everything Haskell and am stumped on an aspect of Type Classes. I would like to do this: class Foo t where hi :: t -> Bool class Foo t => Bar t where hi x = True But using GHC 6.8.1 on PPC I get this error: `hi' is not a (visible) method of c

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Luke Palmer
On Dec 28, 2007 2:55 PM, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote: > >> I thought Lisp and Erlang were both infinitely more > >> popular and better known. > > > > Certainly not infinitely. Lisp isn't entirely functional, and while > > Erlang is an industrial success story, I think Haskell is se

[Haskell-cafe] Unbuffered character IO under Windows XP?

2007-12-28 Thread Peter Schmitz
module Main(main) where import System.IO main = do b1 <- hGetBuffering stdin print b1 b2 <- hGetBuffering stdout print b2 -- not sure if these help, or are needed hSetBuffering stdin NoBuffering hSetBuffering stdout NoBuffering b1 <- hGetBuffering stdin print b1 b2

[Haskell-cafe] Re: Haskell-cafe reply-to etiquette

2007-12-28 Thread Ben Franksen
Justin Bailey wrote: > When I joined the haskell-cafe mailing list, I was surprised to see > the "reply-to" header on each message was set to the sender of a given > message to the list, rather than the list itself. That seemed counter > to other mailing lists I had been subscribed to, but I didn't

[Haskell-cafe] Re: Function Stores

2007-12-28 Thread Achim Schneider
"Cristian Baboi" <[EMAIL PROTECTED]> wrote: > Can you help me find it ? > Watch out for those garbage collectors, they always carry the stuff away as soon as you turn your back on it. You can find them easily by spotting stop-and-go traffic on any street.

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 12:08 PM, Cristian Baboi wrote: On Fri, 28 Dec 2007 19:18:33 +0200, ChrisK <[EMAIL PROTECTED]> wrote: This thread is obviously a source of much fun. I will play too. Well, it starts with Wikipedia ... :-) What is the definition of an entry point in Haskell ? "Haske

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 8:42 AM, Cristian Baboi wrote: On Fri, 28 Dec 2007 16:34:23 +0200, apfelmus <[EMAIL PROTECTED]> wrote: Jules Bean wrote: Cristian Baboi wrote: But I guess it won't work because the compiler will optimize it and the call will disappear. I'm not quite sure what you're tr

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 8:21 AM, Cristian Baboi wrote: On Fri, 28 Dec 2007 16:10:15 +0200, Jules Bean <[EMAIL PROTECTED]> wrote: It won't work because haskell functions can't have side-effects. I'm not quite sure what you're trying to say here. Jules What I am trying to say is: - storing som

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 4:40 AM, Cristian Baboi wrote: On Fri, 28 Dec 2007 12:01:51 +0200, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote: [1 .. ] and x=1:x are maximal ? Yes. How can a Haskell implementation recognize a maximal value ? x=1:x for example. It can't. jcc ___

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 4:20 AM, Cristian Baboi wrote: Thank you. This is what I understand so far: - the maximal values is what is usually called data Incorrect. Total functions are maximal. - the non maximal are what is usually called code Incorrect. `Non maximal' expressions are just e

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Mitar
Hi! On Dec 29, 2007 12:13 AM, Evan Laforge <[EMAIL PROTECTED]> wrote: > Maybe you could use view patterns? > > foo (regex "(.*);(.*);(.*)") -> [c1, c2, c3] = ... Oh. Beautiful. :-) > Parser combinators basically provide generalized regexes, and they all > take lists of arbitrary tokens rather th

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 4:10 AM, Cristian Baboi wrote: On Fri, 28 Dec 2007 12:01:51 +0200, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote: It sounds like a limit. xn --> x for n --> :-) Yeah, that's right. If xn is monotone, then I only have to worry when it is not bounded, right ? How can

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 3:37 AM, Cristian Baboi wrote: Thank you. It sounds like a limit. xn --> x for n --> :-) I could say that LUBs are colimits, not limits, but I won't :) More seriously, I don't like the calculus --> notation in this context; these are suprema, not lims. How can I get

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 2:08 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 20:46:24 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: Preference doesn't come into it. By definition, the denotations of Haskell functions are monotone continous functions on pointed complete partial orders. You s

Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 1:15 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 17:39:25 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: Haskell is not a computer programming language; Haskell implementations are not required to run on computers. Haskell is a formal notation for computation (compl

Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 1:12 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 17:35:54 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: Only on Von Neuman machines. Haskell implementations are not required to run on Von Neuman machines. That's why the language is called functional. (Imperative

Re: [Haskell-cafe] Re: Re[2]: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 3:13 PM, Ben Franksen wrote: Bulat Ziganshin wrote: Hello Yitzchak, Thursday, December 27, 2007, 12:10:21 PM, you wrote: In particular, two functions are equal only if they produce the same value for every input, and in general it is impossible for a computer to check that.

[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Ben Franksen
Wolfgang Jeltsch wrote: > P.S.: Didn’t send this to the list in the first place. I don’t like > mailing lists which don’t set the Reply-To: field. There are serious reasons not to, see http://www.unicom.com/pw/reply-to-harmful.html My personal suggestion is to try news.gmane.org (group: gmane.co

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jonathan Cast
On 28 Dec 2007, at 7:15 AM, Cristian Baboi wrote: But I guess it won't work because the compiler will optimize it and the call will disappear. On Fri, 28 Dec 2007 14:58:53 +0200, Cristian Baboi <[EMAIL PROTECTED]> wrote: Here is how I want print to be in Haskell print :: (a->b) -> (a->b

[Haskell-cafe] Re: Re[2]: Wikipedia on first-class object

2007-12-28 Thread Ben Franksen
Bulat Ziganshin wrote: > Hello Yitzchak, > Thursday, December 27, 2007, 12:10:21 PM, you wrote: >> In particular, >> two functions are equal only if they produce >> the same value for every input, and in general it is >> impossible for a computer to check that. > > "for a computer" is superfluous

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Lennart Augustsson
You are right, Portable Haskell Dynamic libraries do not exist because the Haskell standard does not talk about them at all. Portable C Dynamic libraries do not exist either. Given POSIX they exist, but if you happen upon a platform that only has a C compiler it won't have them. On Dec 28, 2007 7

Re: [Haskell-cafe] Function Stores

2007-12-28 Thread Lennart Augustsson
What is it that you are trying to do? On Dec 28, 2007 10:49 PM, Cristian Baboi <[EMAIL PROTECTED]> wrote: > Here is what I was able to come up with: > > > module Store where > > data FStore1 a b = Empty1 | FS1 ( a->b , FStore1 a b ) > > store1 :: (a->b) -> (FStore1 a b) > store1 f = let x = FS1

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Lennart Augustsson
Contents of DECREMENT Register. On Dec 28, 2007 6:20 PM, Brian Sniffen <[EMAIL PROTECTED]> wrote: > On Dec 28, 2007 6:05 AM, Andrew Coppin <[EMAIL PROTECTED]> > wrote: > > [I actually heard a number of people tell me that learning LISP would > > change my life forever because LISP has something c

[Haskell-cafe] Re: Doing some things right

2007-12-28 Thread Achim Schneider
Andrew Coppin <[EMAIL PROTECTED]> wrote: > Brian Sniffen wrote: > > On Dec 28, 2007 6:05 AM, Andrew Coppin > > <[EMAIL PROTECTED]> wrote: > >> [I actually heard a number of people tell me that learning LISP > >> would change my life forever because LISP has something called > >> "macros". I tried

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Evan Laforge
> Would not it be interesting and useful (but not really efficient) to > have patterns something like: > > foo :: Eq a => a -> ... > foo (_{4}'b') = ... > > which would match a list with four elements ending with an element 'b'. Or: > > foo (_+';'_+';'_) = ... Maybe you could use view patterns? f

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Stefan O'Rear
On Fri, Dec 28, 2007 at 11:40:24PM +0100, Mitar wrote: > Hi! > > On Dec 28, 2007 5:51 PM, Lihn, Steve <[EMAIL PROTECTED]> wrote: > > Since regex is involved, it is specific to (Byte)String, not a generic > > list. > > Oh, this gives me an interesting idea: making regular expressions more > gener

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Mitar
Hi! On Dec 28, 2007 5:51 PM, Lihn, Steve <[EMAIL PROTECTED]> wrote: > Since regex is involved, it is specific to (Byte)String, not a generic > list. Oh, this gives me an interesting idea: making regular expressions more generic. Would not it be interesting and useful (but not really efficient) t

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Miguel Mitrofanov
I thought Lisp and Erlang were both infinitely more popular and better known. Certainly not infinitely. Lisp isn't entirely functional, and while Erlang is an industrial success story, I think Haskell is seeing a wider range of application. Well, it seems for me that Erlang is much less funct

[Haskell-cafe] Function Stores

2007-12-28 Thread Cristian Baboi
Here is what I was able to come up with: module Store where data FStore1 a b = Empty1 | FS1 ( a->b , FStore1 a b ) store1 :: (a->b) -> (FStore1 a b) store1 f = let x = FS1 (f, x) in x data FStore2 a b = Empty2 | FS2 ( a->b , FStore2 a b, FStore2 a b ) store2 :: (a->b) -> (FStore2 a b) stor

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Albert Y. C. Lai
Mitar wrote: I am really missing the (general) split function built in standard Haskell. I do not understand why there is something so specific as words and lines but not a simple split? The same goes for join. Don't forget Text.Regex.splitRegex. ___

Re: [Haskell-cafe] Haskell-cafe reply-to etiquette

2007-12-28 Thread Albert Y. C. Lai
Justin Bailey wrote: When I joined the haskell-cafe mailing list, I was surprised to see the "reply-to" header on each message was set to the sender of a given message to the list, rather than the list itself. That seemed counter to other mailing lists I had been subscribed to, but I didn't think

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Alex Sandro Queiroz e Silva
Hallo, Andrew Coppin escreveu: Brian Sniffen wrote: On Dec 28, 2007 6:05 AM, Andrew Coppin <[EMAIL PROTECTED]> wrote: [I actually heard a number of people tell me that learning LISP would change my life forever because LISP has something called "macros". I tried to learn it, and disliked it

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Andrew Coppin
Brian Sniffen wrote: On Dec 28, 2007 6:05 AM, Andrew Coppin <[EMAIL PROTECTED]> wrote: [I actually heard a number of people tell me that learning LISP would change my life forever because LISP has something called "macros". I tried to learn it, and disliked it greatly. It's too messy. And wha

[Haskell-cafe] Re: [Debian-haskell] OT: ghc 6.8 in Debian?

2007-12-28 Thread Ganesh Sittampalam
On Fri, 28 Dec 2007, Magnus Therning wrote: It seems my emails to the Debian Haskell list (CC'd on this email as well) are silently dropped :-( I don't believe that's the case; I've been getting them, and they're in the archive: http://urchin.earth.li/pipermail/debian-haskell/2007-December/t

[Haskell-cafe] OT: ghc 6.8 in Debian?

2007-12-28 Thread Magnus Therning
It seems my emails to the Debian Haskell list (CC'd on this email as well) are silently dropped :-( Since I suspect the readers of /that/ list are likely to be on this one as well I thought I'd give this a try. What's happening with GHC 6.8 in Debian? There was an email about a month ago announc

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Ketil Malde
Andrew Coppin <[EMAIL PROTECTED]> writes: >> >> http://www.cs.kuleuven.ac.be/%7Edtai/projects/ALP//newsletter/dec07/content/Articles/tom/content.html > "Haskell is the undisputed flagship of the FP community." > Er... really? It depends on how you define the "FP community", of course. Th

[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 19:18:33 +0200, ChrisK <[EMAIL PROTECTED]> wrote: This thread is obviously a source of much fun. I will play too. Well, it starts with Wikipedia ... :-) What is the definition of an entry point in Haskell ? "Haskell" does not have such a concept. At all. An implem

[Haskell-cafe] Re: Doing some things right

2007-12-28 Thread ChrisK
Brian Sniffen wrote: > On Dec 28, 2007 6:05 AM, Andrew Coppin <[EMAIL PROTECTED]> wrote: >> [I actually heard a number of people tell me that learning LISP would >> change my life forever because LISP has something called "macros". I >> tried to learn it, and disliked it greatly. It's too messy. An

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Jules Bean
Luke Palmer wrote: On Dec 28, 2007 9:35 AM, Jules Bean <[EMAIL PROTECTED]> wrote: In particular, adding sharing can stop something being GCed, which can convert an algorithm which runs in linear time and constant space to one which runs in linear space (and therefore, perhaps, quadratic time).

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 18:27:29 +0200, Achim Schneider <[EMAIL PROTECTED]> wrote: Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: Am Freitag, 28. Dezember 2007 07:49 schrieben Sie: > On Thu, 27 Dec 2007 18:19:47 +0200, Wolfgang Jeltsch > <[EMAIL PROTECTED]> wrote: > > Am Donnerstag, 27. Dezember 2007

[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Achim Schneider
Daniel Fischer <[EMAIL PROTECTED]> wrote: > Is infinity an even number or an odd one? > Definitely odd, but not uneven. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Missing join and split

2007-12-28 Thread ChrisK
Lihn, Steve wrote: > Programmer with perl background would think split like: >= split > Since regex is involved, it is specific to (Byte)String, not a generic > list. Also it appears one would need help from Text.Regex(.PCRE) to do > that. > >> intercalate a (split a xs) = a > This ident

[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread ChrisK
This thread is obviously a source of much fun. I will play too. Cristian Baboi wrote: > On Fri, 28 Dec 2007 18:32:05 +0200, Jules Bean <[EMAIL PROTECTED]> > wrote: > >> Cristian Baboi wrote: >>> Let me ask you 3 simple questions. >>> Can one use Haskell to make dynamically linked libraries (DLL

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Brian Sniffen
On Dec 28, 2007 6:05 AM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > [I actually heard a number of people tell me that learning LISP would > change my life forever because LISP has something called "macros". I > tried to learn it, and disliked it greatly. It's too messy. And what the > heck is "cdr"

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Daniel Fischer
Am Freitag, 28. Dezember 2007 17:27 schrieb Achim Schneider: > > Both have an infinite number of 1. Why do you say “always”? It > > seems that you think of x and y as “variables” whose values change > > over time. This is not the case. They both have a single value for > > all time: the infini

[Haskell-cafe] Re: what does @ mean?.....

2007-12-28 Thread Achim Schneider
Achim Schneider <[EMAIL PROTECTED]> wrote: > zeroIf :: MonadPlus m => (a -> Bool) -> m a -> m a > zeroIf f m = m >>= (\nz -> if f nz then mzero else m) > > zeroZero :: (MonadPlus m, Num a) => m a -> m a > zeroZero = zeroIf (==0) > > makes it interesting again as you can't construct a Just value

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Alex Sandro Queiroz e Silva
Hallo, Andrew Coppin escreveu: [I actually heard a number of people tell me that learning LISP would change my life forever because LISP has something called "macros". I tried to learn it, and disliked it greatly. It's too messy. And what the heck is "cdr" ment to mean anyway? To me, LISP does

[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Achim Schneider
Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: > Am Freitag, 28. Dezember 2007 07:49 schrieben Sie: > > On Thu, 27 Dec 2007 18:19:47 +0200, Wolfgang Jeltsch > > <[EMAIL PROTECTED]> wrote: > > > Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi: > > >> I'll have to trust you, because I can

[Haskell-cafe] Re: what does @ mean?.....

2007-12-28 Thread Achim Schneider
Ben Franksen <[EMAIL PROTECTED]> wrote: > Achim Schneider wrote: > >> ChrisK <[EMAIL PROTECTED]> wrote: >> >>> zeroNothing Nothing = Nothing >>> zeroNothing (Just n) = >>> if n == 0 then Nothing else (Just n) >>> >>> versus >>> >>> zeroNothing Nothing = Nothing >>> zeroNothing x@(Just n) = >

RE: [Haskell-cafe] Missing join and split

2007-12-28 Thread Lihn, Steve
Programmer with perl background would think split like: = split Since regex is involved, it is specific to (Byte)String, not a generic list. Also it appears one would need help from Text.Regex(.PCRE) to do that. > intercalate a (split a xs) = a This identity rule does not hold for perl's

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Luke Palmer
On Dec 28, 2007 9:35 AM, Jules Bean <[EMAIL PROTECTED]> wrote: > In particular, adding sharing can stop something being GCed, which can > convert an algorithm which runs in linear time and constant space to one > which runs in linear space (and therefore, perhaps, quadratic time). I've heard of th

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 18:32:05 +0200, Jules Bean <[EMAIL PROTECTED]> wrote: Cristian Baboi wrote: Let me ask you 3 simple questions. Can one use Haskell to make dynamically linked libraries (DLL on Windows, so on Linux) ? The short answer is yes. The long answer is that this is not a feat

[Haskell-cafe] Re: FFI"pointer" data types question

2007-12-28 Thread Ben Franksen
Galchin Vasili wrote: > If I am calling a ANSI function that requires a pointer to a C > struct, > which FFI pointer type should use? A commonly used technique is to declare an empty data type data MyStruct and then use Ptr MyStruct in the FFI call. This is useful if the C struct

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Jules Bean
Serge LE HUITOUZE wrote: I tend to believe that the '@' notation is mere syntactic sugar. Indeed, it seems to me that Haskell compilers need not to be very clever to share the identical sub-expressions, for one very simple reason implied by Haskell semantics: referential transparency. Am I right

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jules Bean
Cristian Baboi wrote: Let me ask you 3 simple questions. Can one use Haskell to make dynamically linked libraries (DLL on Windows, so on Linux) ? The short answer is yes. The long answer is that this is not a feature of haskell, but rather a feature of certain programs, which happen to be mo

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Serge LE HUITOUZE
Jedaï wrote: > [...] > Yes, but in the second version, it has to reconstruct (S a) before > comparing it to "one" where in the first it could do the comparison > directly. In this cas there may be some optimisation involved that > negate this difference but in many case it can do a real performanc

Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Wolfgang Jeltsch
Am Freitag, 28. Dezember 2007 08:12 schrieb Cristian Baboi: > On Thu, 27 Dec 2007 17:35:54 +0200, Jonathan Cast > > <[EMAIL PROTECTED]> wrote: > > Only on Von Neuman machines. Haskell implementations are not required > > to run on Von Neuman machines. That's why the language is called > > functio

Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Wolfgang Jeltsch
Am Freitag, 28. Dezember 2007 07:49 schrieben Sie: > On Thu, 27 Dec 2007 18:14:53 +0200, Wolfgang Jeltsch > > <[EMAIL PROTECTED]> wrote: > > Am Donnerstag, 27. Dezember 2007 15:53 schrieb Cristian Baboi: > >> On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson > >> > >> <[EMAIL PROTECTED]> wrote

Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Wolfgang Jeltsch
Am Freitag, 28. Dezember 2007 07:49 schrieben Sie: > On Thu, 27 Dec 2007 18:19:47 +0200, Wolfgang Jeltsch > <[EMAIL PROTECTED]> wrote: > > Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi: > >> I'll have to trust you, because I cannot test it. > >> > >> let x=(1:x); y=(1:y) in x==y . >

[Haskell-cafe] Re: what does @ mean?.....

2007-12-28 Thread Ben Franksen
Achim Schneider wrote: > ChrisK <[EMAIL PROTECTED]> wrote: > >> zeroNothing Nothing = Nothing >> zeroNothing (Just n) = >> if n == 0 then Nothing else (Just n) >> >> versus >> >> zeroNothing Nothing = Nothing >> zeroNothing x@(Just n) = >> if n == 0 then Nothing else x >> > versus > > zer

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Benja Fallenstein
On Dec 28, 2007 4:24 PM, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > Right; I misspoke. What I meant was that you would want a split such that > > intercalate a (split a xs) = a > > for finite, total (a,xs) (and, since it's achievable, even for > infinite xs). Of course, (split a xs = [xs])

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Luke Palmer
On Dec 28, 2007 5:58 AM, Cristian Baboi <[EMAIL PROTECTED]> wrote: > Here is how I want print to be in Haskell > > print :: (a->b) -> (a->b) > > with print = id, but the following "side effect": > > - I want to call the print function today, and get the value tomorrow. You might be interested in t

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Benja Fallenstein
On Dec 28, 2007 3:55 PM, David Roundy <[EMAIL PROTECTED]> wrote: > On Dec 28, 2007 9:51 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > > If you use intercalate to join, I would presume that you would want to > > use an inverse of it to split. I'd write it like this: > > Of course, there is no i

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread David Roundy
On Dec 28, 2007 9:51 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > If you use intercalate to join, I would presume that you would want to > use an inverse of it to split. I'd write it like this: But alas, words and lines differ on how properly to split, so there's no hint from the standard li

[Haskell-cafe] translating some C# abstractions into Haskell....

2007-12-28 Thread Nicholls, Mark
Lets say I've got Interface IFoo Where X : IBar Where Y : IBar { } Would seem to translate roughly to class (IBar x, IBar y) => IFoo foo x y ? (or does it?) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicholls, Mark Sent: 28 December

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Benja Fallenstein
Hi all, On Dec 28, 2007 12:38 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > For joining you probably want some combination of intersperse and > concat, e.g. > > unlines = concat . intersperse "\n" And that's what we have :-) Data.List.intercalate :: [a] -> [[a]] -> [a] Data.List.intercalate x

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 16:34:23 +0200, apfelmus <[EMAIL PROTECTED]> wrote: Jules Bean wrote: Cristian Baboi wrote: But I guess it won't work because the compiler will optimize it and the call will disappear. I'm not quite sure what you're trying to say here. (That's the "world view on Haske

[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread apfelmus
Jules Bean wrote: Cristian Baboi wrote: But I guess it won't work because the compiler will optimize it and the call will disappear. I'm not quite sure what you're trying to say here. (That's the "world view on Haskell" issue I mean. I know this feeling with physics: "what the heck are they

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 16:10:15 +0200, Jules Bean <[EMAIL PROTECTED]> wrote: It won't work because haskell functions can't have side-effects. I'm not quite sure what you're trying to say here. Jules What I am trying to say is: - storing something to disk does not mean one must have a functio

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jules Bean
It won't work because haskell functions can't have side-effects. I'm not quite sure what you're trying to say here. Jules Cristian Baboi wrote: But I guess it won't work because the compiler will optimize it and the call will disappear. On Fri, 28 Dec 2007 14:58:53 +0200, Cristian Baboi <[

[Haskell-cafe] Re: what does @ mean?.....

2007-12-28 Thread Achim Schneider
ChrisK <[EMAIL PROTECTED]> wrote: > zeroNothing Nothing = Nothing > zeroNothing (Just n) = > if n == 0 then Nothing else (Just n) > > versus > > zeroNothing Nothing = Nothing > zeroNothing x@(Just n) = > if n == 0 then Nothing else x > versus zeroNothing Nothing = Nothing zeroNothing x =

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 15:29:00 +0200, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote: >> take 5 [1,2,3,4,5,undefined] (What would GHCi print? [1,2,3,4,5] Then please square that with your comment that we don't care how much of the list gets evaluated.) I don't care if it evaluates it, reads i

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
> >> take 5 [1,2,3,4,5,undefined] > (What would GHCi print? [1,2,3,4,5] > Then please square that with your comment that we don't care how much of > the list gets evaluated.) I don't care if it evaluates it, reads it's answer from some internal table, or consult it's lawyer. I just want it to

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
But I guess it won't work because the compiler will optimize it and the call will disappear. On Fri, 28 Dec 2007 14:58:53 +0200, Cristian Baboi <[EMAIL PROTECTED]> wrote: Here is how I want print to be in Haskell print :: (a->b) -> (a->b) with print = id, but the following "side effect"

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
Here is how I want print to be in Haskell print :: (a->b) -> (a->b) with print = id, but the following "side effect": - I want to call the print function today, and get the value tomorrow. On Fri, 28 Dec 2007 12:03:04 +0200, apfelmus <[EMAIL PROTECTED]> wrote: Cristian Baboi wrote: ht

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Peter Gammie
On 28/12/2007, at 7:19 PM, Miguel Mitrofanov wrote: So what do you expect: take 5 [1,2,3,4,5,undefined] to do? Nothing! It's a value, not an instruction! Dang, I knew I'd choose at least one wrong word in all of that. :-P What is it's value, then? ... and what is the value of the othe

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
> I'll bite. Please, don't. > So what do you expect: > take 5 [1,2,3,4,5,undefined] > to do? Nothing! It's a value, not an instruction! > So it does seem to matter how much of the list it evaluates... No, it's implementation details. I'm reasoning about values, not computations, and I use com

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Cristian Baboi
On Fri, 28 Dec 2007 12:03:04 +0200, apfelmus <[EMAIL PROTECTED]> wrote: Cristian Baboi wrote: http://en.wikipedia.org/wiki/First-class_object The term was coined by Christopher Strachey in the context of “functions as first-class citizens” in the mid-1960's.[1] Depending on the language

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Alfonso Acosta
On Dec 28, 2007 12:21 PM, Nicholls, Mark <[EMAIL PROTECTED]> wrote: > So in the example given... > Is equivalent ? Yes, it is ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: what does @ mean?.....

2007-12-28 Thread ChrisK
Nicholls, Mark wrote: > Hello, I wonder if someone could answer the following… > > The short question is what does @ mean in > > > > mulNat a b > > | a <= b = mulNat' a b b > > | otherwise = mulNat' b a a > > where > > mulNat' x@(S a) y orig > > | x =

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Andrew Coppin
Mitar wrote: Hi! I am really missing the (general) split function built in standard Haskell. I do not understand why there is something so specific as words and lines but not a simple split? The same goes for join. Yes, I can of course define them but ... in an interactive mode it would be quit

[Haskell-cafe] Missing join and split

2007-12-28 Thread Mitar
Hi! I am really missing the (general) split function built in standard Haskell. I do not understand why there is something so specific as words and lines but not a simple split? The same goes for join. Yes, I can of course define them but ... in an interactive mode it would be quite handy to have

RE: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Nicholls, Mark
Lovelythank you very muchanother small step forward. -Original Message- From: Chaddaï Fouché [mailto:[EMAIL PROTECTED] Sent: 28 December 2007 11:29 To: Nicholls, Mark Cc: Alfonso Acosta; haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] what does @ mean?. 2007/12/28, Nicho

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Chaddaï Fouché
2007/12/28, Nicholls, Mark <[EMAIL PROTECTED]>: > So in the example given... > > mulNat a b > | a <= b = mulNat' a b b > | otherwise = mulNat' b a a > where > mulNat' x@(S a) y orig > | x == one = y > | otherwise = mulNat' a (addNat orig

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Chaddaï Fouché
2007/12/28, Alfonso Acosta <[EMAIL PROTECTED]>: > @ works as an aliasing primitive for the arguments of a function > > f x@(Just y) = ... > > using "x" in the body of f is equivalent to use "Just y". Perhaps in > this case is not really useful, but in some other cases it saves the > effort and spac

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Jules Bean
Peter Gammie wrote: On 28/12/2007, at 5:50 PM, Miguel Mitrofanov wrote: Right, so when I say to GHCi: Prelude> take 5 [1..] and it says: [1,2,3,4,5] then it really has computed the entirety of the infinite sequence [1..], and not some approximation? Of course not! In fact, it

RE: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Nicholls, Mark
So in the example given... mulNat a b | a <= b = mulNat' a b b | otherwise = mulNat' b a a where mulNat' x@(S a) y orig | x == one = y | otherwise = mulNat' a (addNat orig y) orig Is equivalent to mulNat a b | a <= b = mulNat' a

Re: [Haskell-cafe] what does @ mean?.....

2007-12-28 Thread Alfonso Acosta
@ works as an aliasing primitive for the arguments of a function f x@(Just y) = ... using "x" in the body of f is equivalent to use "Just y". Perhaps in this case is not really useful, but in some other cases it saves the effort and space of retyping really long expressions. And what is even more

  1   2   >