Re: [Haskell-cafe] Basic question concerning the category Hask (was: concerning data constructors)

2008-01-02 Thread Jonathan Cast
On 2 Jan 2008, at 5:49 AM, Yitzchak Gale wrote: Hi Andrew, Andrew Bromage wrote: I still say it "isn't a set" in the same way that a group "isn't a set". Haskell data types have structure that is respected by Haskell homomorphisms. Sets don't. Ah, that's certainly true. But what is that a

Re: [Haskell-cafe] Re: Web server continued

2007-12-31 Thread Jonathan Cast
On 31 Dec 2007, at 1:33 PM, Achim Schneider wrote: Jonathan Cast <[EMAIL PROTECTED]> wrote: On 31 Dec 2007, at 10:43 AM, Achim Schneider wrote: Achim Schneider <[EMAIL PROTECTED]> wrote: That's not specified though, the runtime could choose to let + force the two chunks

Re: [Haskell-cafe] Re: Web server continued

2007-12-31 Thread Jonathan Cast
On 31 Dec 2007, at 10:43 AM, Achim Schneider wrote: Achim Schneider <[EMAIL PROTECTED]> wrote: That's not specified though, the runtime could choose to let + force the two chunks the different way round. And that is probably also the reason why [1..] == [1..] is _|_. Is "Something that can

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

2007-12-30 Thread Jonathan Cast
On 30 Dec 2007, at 11:16 AM, Cristian Baboi wrote: On Sun, 30 Dec 2007 19:02:11 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: On 30 Dec 2007, at 10:54 AM, Cristian Baboi wrote: On Sun, 30 Dec 2007 18:39:51 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: On 30 Dec 2007,

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

2007-12-30 Thread Jonathan Cast
On 30 Dec 2007, at 11:12 AM, Cristian Baboi wrote: On Sun, 30 Dec 2007 19:10:44 +0200, Daniel Fischer <[EMAIL PROTECTED]> wrote: Am Sonntag, 30. Dezember 2007 17:55 schrieb Cristian Baboi: On Sun, 30 Dec 2007 18:34:08 +0200, Daniel Fischer <[EMAIL PROTECTED]> wrote: > True, but again, what

Re: [Haskell-cafe] The semantics of constructor patterns

2007-12-30 Thread Jonathan Cast
On 30 Dec 2007, at 11:10 AM, Cristian Baboi wrote: In section 4.3.3., chapter 4: Structured types and the semantics of pattern-matching, by S.Peyton Jones and Philip Wadler, there is this equation: Eval[[\(s p1 p2 ... pt).E]] (s a1 a2 ...at) = Eval[[\p1 ... \pt.E]] a1 ... at The text s

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

2007-12-30 Thread Jonathan Cast
On 30 Dec 2007, at 10:54 AM, Cristian Baboi wrote: On Sun, 30 Dec 2007 18:39:51 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: On 30 Dec 2007, at 10:14 AM, Cristian Baboi wrote: On Sat, 29 Dec 2007 21:49:16 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: On 29 Dec 2007

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

2007-12-30 Thread Jonathan Cast
On 30 Dec 2007, at 10:14 AM, Cristian Baboi wrote: On Sat, 29 Dec 2007 21:49:16 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: On 29 Dec 2007, at 5:01 AM, Cristian Baboi wrote: By portable I mean: works on the same machine, with the same OS, but with different Haskell implemen

Re: [Haskell-cafe] More newbie typeclass confusion...

2007-12-29 Thread Jonathan Cast
On 29 Dec 2007, at 9:31 PM, alex wrote: Hi there. If someone can tell me why I am getting type ambiguity in the following code: class (Ord s, Num s) => Scalar s where zero :: s class Metric m where delta :: Scalar s => m -> m -> s (=~):: m -> m -> Bool

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

2007-12-29 Thread Jonathan Cast
On 29 Dec 2007, at 2:18 PM, Miguel Mitrofanov wrote: ok, please compute 2^2^30 before continuing discussion. Just for the record: I don't think your computer is able to compute 2^(2^30). Certainly not at the moment (not with memory loads the way they are now). jcc

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

2007-12-29 Thread Jonathan Cast
On 29 Dec 2007, at 5:01 AM, Cristian Baboi wrote: On Sat, 29 Dec 2007 02:08:14 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: How can one make portable dynamic libraries then ? If by portable you mean, works on /both/ OSs, then GHC-specific should be portable enough for you..

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

2007-12-29 Thread Jonathan Cast
On 29 Dec 2007, at 11:40 AM, Achim Schneider wrote: Andrew Coppin <[EMAIL PROTECTED]> wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? I don't know... I'm probably mor

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

2007-12-29 Thread Jonathan Cast
On 29 Dec 2007, at 10:14 AM, Ben Franksen wrote: Jonathan Cast wrote: 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

Re: [Haskell-cafe] Sending bottom to his room

2007-12-29 Thread Jonathan Cast
On 29 Dec 2007, at 6:39 AM, Cristian Baboi wrote: On Sat, 29 Dec 2007 13:30:03 +0200, Luke Palmer <[EMAIL PROTECTED]> wrote: On Dec 29, 2007 11:14 AM, Cristian Baboi <[EMAIL PROTECTED]> wrote: In The Implementation of Functional Programming Languages by S.P. Jones, section 2.5.3, page 32

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] 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 or

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 compu

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

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.

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

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 8:38 PM, Albert Y. C. Lai wrote: Achim Schneider wrote: [n..] == [m..], the first thing I notice is n == m && n+1 == m+1 , which already expresses all of infinity in one instance and can be trivially cancelled to n == m , which makes the whole darn thing only _|_ if n or m is

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 4:54 PM, Achim Schneider wrote: Jonathan Cast <[EMAIL PROTECTED]> wrote: _|_ is the denotation of every Haskell expression whose denotation is _|_. Mu. Why take away _|_? Because, when zenning about instance (Eq a) => Eq [a] where [] == []

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 12:20 PM, Achim Schneider wrote: Jonathan Cast <[EMAIL PROTECTED]> wrote: On 27 Dec 2007, at 10:44 AM, Achim Schneider wrote: Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi: I'll have to tru

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 10:44 AM, Achim Schneider wrote: 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 . I also cannot test this: let x=(1:x); y=1:1:y in x

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 9:57 AM, Cristian Baboi wrote: Good to know. I intended to use Haskell for algorithms, but it seems it is not so good at them. Very sad. The entire point of Haskell is that it allows the user to transcend the algorithm as a way of expressing computations. I hope someda

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 9:47 AM, Cristian Baboi wrote: I don't know. I'm a beginner in Haskell, and I down't know about T. You mean they cannot ? I was under the impression that the purpose of computers cannot be fulfiled if we cannot get the result of computations out of the computers. H

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 9:41 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 17:39:25 +0200, Jonathan Cast <[EMAIL PROTECTED]> wrote: On 27 Dec 2007, at 6:51 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 14:42:37 +0200, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: Hello Cristia

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 9:34 AM, Cristian Baboi wrote: I'll have to trust you, because I cannot test it. let x=(1:x); y=(1:y) in x==y . I also cannot test this: let x=(1:x); y=1:1:y in x==y Correct. You could try proving it. Or you could try proving that these expressions are equal to _|_.

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 8:53 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson <[EMAIL PROTECTED]> wrote: Absolutly. Every expression in Haskell denotes a value. Now, we've not agreed what "value" means, but to me it is a value. :) It is one value, or several ?

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 8:28 AM, Cristian Baboi wrote: How about x below: let x=(1:x) in x ? Is x a single value in Haskell ? (let x=1:x in x) is. x went out of scope a couple of lines back. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 8:08 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson <[EMAIL PROTECTED]> wrote: Comparing functions is certainly possible in Haskell, but there's no standard function that does it. If course, it might not terminate, but the same is true for

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 6:51 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 14:42:37 +0200, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: Hello Cristian, Thursday, December 27, 2007, 12:19:08 PM, you wrote: Yes, but one can store the result of an operation to disk except in the particular case t

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

2007-12-27 Thread Jonathan Cast
On 27 Dec 2007, at 4:57 AM, Cristian Baboi wrote: On Thu, 27 Dec 2007 12:40:22 +0200, Yitzchak Gale <[EMAIL PROTECTED]> wrote: I wrote: On the other hand, functions are members of types that are just like any other Haskell type. They are first-class in that sense. Cristian Baboi wrote: I

Re: [Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Jonathan Cast
On 26 Dec 2007, at 12:30 PM, Peter Verswyvelen wrote: Well I certainly hope the standard defines that both fred and bob will only be evaluated once, because my programs depend on that :) If your programs depend on lazy evaluation, they can't be Haskell 98. Any complete reduction method is

Re: [Haskell-cafe] New to Haskell: The End

2007-12-18 Thread Jonathan Cast
On 18 Dec 2007, at 7:28 AM, [EMAIL PROTECTED] wrote: Concerning the subject: "The End" of WHAT? Cristian Baboi writes: Reinier Lamers wrote: Cristian Baboi wrote: Haskell strengts as I see them: ... - it has a compiler ... Is there anything you would like to add ? Higher-order functions

Re: [Haskell-cafe] data vs newtype (was: OOP'er with (hopefully) trivial questions)

2007-12-17 Thread Jonathan Cast
On 17 Dec 2007, at 7:39 AM, David Menendez wrote: On Dec 17, 2007 8:51 AM, Bayley, Alistair <[EMAIL PROTECTED]> wrote: As an aside, I was wondering exactly what the differences are between newtype and data i.e. between > newtype A a = A a and > data A a = A a According to: http://www.has

Re: [Haskell-cafe] Questions about the Functor cl ass and it's use in "Data types à la carte"

2007-12-16 Thread Jonathan Cast
On 16 Dec 2007, at 9:47 AM, Dominic Steinitz wrote: Jonathan Cast wrote: On 16 Dec 2007, at 3:21 AM, Dominic Steinitz wrote: Do you have a counter-example of (.) not being function composition in the categorical sense? Let bot be the function defined by bot :: alpha -> beta bot =

Re: [Haskell-cafe] Questions about the Functor cl ass and it's use in "Data types à la carte"

2007-12-16 Thread Jonathan Cast
On 16 Dec 2007, at 3:21 AM, Dominic Steinitz wrote: Do you have a counter-example of (.) not being function composition in the categorical sense? Let bot be the function defined by bot :: alpha -> beta bot = bot By definition, (.) = \ f -> \ g -> \ x -> f (g x) Then bot . id = ((\ f

Re: [Haskell-cafe] Questions about the Functor cl ass and it's use in "Data types à la carte"

2007-12-16 Thread Jonathan Cast
On 16 Dec 2007, at 2:23 AM, Dominic Steinitz wrote: keep in mind that Haskell "composition" (.) is not really composition in the category-theoretic sense, because it adds extra laziness. Use this Do you have a counter-example of (.) not being function composition in the categorical sense? Le

Re: [Haskell-cafe] Execution of external command

2007-12-16 Thread Jonathan Cast
On 14 Dec 2007, at 1:21 AM, Jules Bean wrote: Evan Laforge wrote: it seems that script may be not terminated if its output isn't read, so better code should be (_, h, g, _) <- runInteractiveCommand "script params" result <- hGetLine h hGetContents h >>= evaluate.length hGetContents g >>= ev

Re: [Haskell-cafe] Re: distinguish functions from non-functions in a class/instances

2007-12-10 Thread Jonathan Cast
On 10 Dec 2007, at 11:33 AM, Dan Weston wrote: Questioning apfelmus definitely gives me pause, but... > id :: a -> a-- "arity" 1 > id = ($) :: (a -> b) -> (a -> b) -- "arity" 2 I agree with the arities given above (but without quotes) and see no ill-definedness to

Re: [Haskell-cafe] Re: distinguish functions from non-functions in a class/instances

2007-12-09 Thread Jonathan Cast
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

Re: [Haskell-cafe] Re: do

2007-12-03 Thread Jonathan Cast
On 3 Dec 2007, at 4:19 PM, Dan Piponi wrote: On Dec 3, 2007 3:54 PM, Ben Franksen <[EMAIL PROTECTED]> wrote: I don't buy this. As has been noted by others before, IO is a very special case, in that it can't be defined in Haskell itself, and there is no evaluation function runIO :: IO a -> a.

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Jonathan Cast
On 26 Nov 2007, at 10:48 AM, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused with subsequent action

Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-24 Thread Jonathan Cast
On 24 Nov 2007, at 9:09 PM, Brent Yorgey wrote: On Nov 24, 2007 10:55 PM, Conal Elliott <[EMAIL PROTECTED]> wrote: why care about trailing whitespace? Probably because it looks bad in darcs patch summaries (trailing whitespace --> little red dollar signs). Unless there's another reason I do

Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Jonathan Cast
On 22 Nov 2007, at 11:16 AM, Andrew Coppin wrote: Aaron Denney wrote: On 2007-11-21, Andrew Coppin <[EMAIL PROTECTED]> wrote: In short, lots of Haskell-related things seem to be extremely Unix-centric and downright unfriendly towards anybody trying to set things up on Windows. If I didn't alr

Re: [Haskell-cafe] Composing monads

2007-11-22 Thread Jonathan Cast
On 22 Nov 2007, at 10:17 AM, Maurí cio wrote: Hi, If I have two computations a->IO b and b->IO c, can I join them to get an a->IO c computation? I imagine something like a liftM dot operator. This is called Kleisli composition, by the way; it's defined as (>=>) in Control.Monad. jcc

Re: [Haskell-cafe] What is the role of $!?

2007-11-17 Thread Jonathan Cast
On 17 Nov 2007, at 8:04 PM, PR Stanley wrote: Hi okay, so $! is a bit like $ i.e. the equivalent of putting parentheses around the righthand expression. I'm still not sure of the difference between $ and $!. Maybe it's because I don't understand the meaning of "strict application". While w

Re: [Haskell-cafe] What is the role of $!?

2007-11-14 Thread Jonathan Cast
On 14 Nov 2007, at 4:32 PM, Shachaf Ben-Kiki wrote: On Nov 14, 2007 4:27 PM, Justin Bailey <[EMAIL PROTECTED]> wrote: It's: f $! x = x `seq` f x That is, the argument to the right of $! is forced to evaluate, and then that value is passed to the function on the left. The function itself is

Re: [Haskell-cafe] Re: Weird ghci behaviour?

2007-11-13 Thread Jonathan Cast
On 13 Nov 2007, at 11:03 PM, Jules Bean wrote: Just to be clear: my proposal is that if you want it to go faster you do ghci foo.hi or ghci foo.o ... so you still have the option to run on compiled code. My suggestion is simply that "ghci foo.hs" is an instruction to load source code (si

Re: [Haskell-cafe] generating Maybe

2007-11-07 Thread Jonathan Cast
On 7 Nov 2007, at 12:40 PM, Tim Newsham wrote: Data.Maybe has functions for processing Maybe's but nothing useful for creating maybe. I think the following would be a very useful addition, a guarded function: guarded :: (a -> Bool) -> (a -> b) -> a -> Maybe b guarded p f x | p x

Re: [Haskell-cafe] FP design

2007-11-07 Thread Jonathan Cast
On 7 Nov 2007, at 11:26 AM, Donn Cave wrote: I have been working on a little Java project lately at work, by way of an introduction to the language, and naturally I often have cause to regret that it isn't Haskell instead. But in the specific matter I'm wrestling with, the Java library's OOP m

Re: [Haskell-cafe] Monte Carlo Pi calculation (newbie learnings)

2007-11-06 Thread Jonathan Cast
get into, and not very polite. Jonathan Cast wrote: Nope. newStdGen is specified in terms of split, which means it leaves the random generator in a state independent of the generator it returns. Perfectly safe. (I think you think you used getStdGen). I was referring to randoms and randomRs

Re: [Haskell-cafe] Monte Carlo Pi calculation (newbie learnings)

2007-11-06 Thread Jonathan Cast
On 6 Nov 2007, at 6:00 AM, Yitzchak Gale wrote: There is still a problem here - my code (and also all of the previous posters, I think) clobbers the random generator, rendering it unusable for future calculations. In this case that is probably not a problem, but it is a bad habit to get into, a

Re: [Haskell-cafe] FP design

2007-11-05 Thread Jonathan Cast
On Tue, 2007-11-06 at 10:32 +1030, Levi Stephen wrote: > Hi, > > I'm was wondering how most people work during when designing a functional > program. Do you create data structures/types first? Do you work from some > type > signatures? > > For example, take a blog. Is the first step likely to

Re: [Haskell-cafe] Go parallel

2007-11-05 Thread Jonathan Cast
On Mon, 2007-11-05 at 20:12 +, Andrew Coppin wrote: > Hi folks. > > Take a look at this: > > render :: IOArray Point Colour -> (Point -> Colour) -> IO () > render framebuffer fn = mapM_ (\p -> writeArray framebuffer p (fn p)) > all_points > > How do I alter this to compute fn in multip

Re: [Haskell-cafe] Monte Carlo Pi calculation (newbie learnings)

2007-11-05 Thread Jonathan Cast
On Mon, 2007-11-05 at 20:11 +, Alex Young wrote: > Hi all, > > I'm new to Haskell, and don't quite understand how IO and lazy > evaluation work together yet. In order to improve my understanding, I > thought I'd try to knock together a translation of a fairly simple > problem I can code up

Re: [Haskell-cafe] Re: Semantics of uniqueness types for IO (Was: Why can't Haskell be faster?)

2007-11-02 Thread Jonathan Cast
On Fri, 2007-11-02 at 15:43 -0400, Jeff Polakow wrote: > > Hello, > > > > Just a bit of minor academic nitpicking... > > > > > > > Yeah. After all, the "uniqueness constraint" has a theory with > an > > > > excellent pedigree (IIUC linear logic, whose proof theory Clean > uses > > > > here,

Re: [Haskell-cafe] Re: Semantics of uniqueness types for IO (Was: Why can't Haskell be faster?)

2007-11-02 Thread Jonathan Cast
On Fri, 2007-11-02 at 14:41 -0400, Jeff Polakow wrote: > > Hello, > > Just a bit of minor academic nitpicking... > > > Yeah. After all, the "uniqueness constraint" has a theory with an > > excellent pedigree (IIUC linear logic, whose proof theory Clean uses > > here, goes back at least to th

Re: [Haskell-cafe] Re: Semantics of uniqueness types for IO (Was: Why can't Haskell be faster?)

2007-11-02 Thread Jonathan Cast
On Fri, 2007-11-02 at 11:56 -0400, Brandon S. Allbery KF8NH wrote: > On Nov 2, 2007, at 11:51 , Jonathan Cast wrote: > > >> I will grant that hiding *World / RealWorld# inside IO is cleaner > >> from a practical standpoint, though. Just not from a semantic one. > >

Re: [Haskell-cafe] Re: Semantics of uniqueness types for IO (Was: Why can't Haskell be faster?)

2007-11-02 Thread Jonathan Cast
On Fri, 2007-11-02 at 08:35 -0400, Brandon S. Allbery KF8NH wrote: > On Nov 2, 2007, at 6:35 , apfelmus wrote: > > > during function evaluation. Then, we'd need a "purity lemma" that > > states that any function not involving the type *World as in- and > > output is indeed pure, which may be

Re: [Haskell-cafe] Re: Hiding side effects in a data structure

2007-11-01 Thread Jonathan Cast
On Thu, 2007-11-01 at 21:42 +, Jon Fairbairn wrote: > "Hugh Perkins" <[EMAIL PROTECTED]> writes: > > > On 10/26/07, John Meacham <[EMAIL PROTECTED]> wrote: > >> Heh, the plethora of pdf papers on Haskell is part of what originally > >> brought me to respect it. Something about that metafont pa

Re: [Haskell-cafe] List comprehension order of evaluation

2007-10-25 Thread Jonathan Cast
On Thu, 2007-10-25 at 19:59 -0200, Maurí­cio wrote: > Hi, > > Today, if I write: > > [a:[b] | a<-"ab" , b<-"12"] > > I get: > > ["a1","a2","b1","b2"] > > Are there any guarantees that I'll never > get ["a1","b1","a2","b2"] instead, i.e., > that the first list will always be the > last one to

Re: [Haskell-cafe] Do you trust Wikipedia?

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-19 at 02:45 +0200, [EMAIL PROTECTED] wrote: > PR Stanley writes: > > > One of the reasons I'm interested in Wikipedia and Wikibook is because > > you're more likely to find Latex source code used for typesetting the > > maths. > > Latex is the one and only 100% tool right now. >

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-12 at 19:33 -0400, Brandon S. Allbery KF8NH wrote: > On Oct 12, 2007, at 18:35 , Albert Y. C. Lai wrote: > > > You are not expected to be convinced this, but it seems > > continuations completely characterize system programming. :) > > Didn't someone already prove all monads can

Re: [Haskell-cafe] Polymorphic (typeclass) values in a list?

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-19 at 23:57 +0800, TJ wrote: > Henning Thielemann: > > > class Renderable a where > > > render :: a -> RasterImage > > > > > > scene :: Renderable a => [a] > > > > This signature is valid, but it means that all list elements must be of > > the same Renderable type. > > Yes, that'

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-19 at 00:02 +0200, [EMAIL PROTECTED] wrote: > Dan Weston writes: > > > ... now I am totally flummoxed: > > > > thm1 :: (a -> a) -> a > > thm1 f = let x = f x in x > > > > > thm1 (const 1) > > 1 > > > > I *thought* that the theorem ((a => a) => a) is not derivable (after all,

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-12 at 13:52 -0400, Steve Schafer wrote: > On Fri, 12 Oct 2007 18:24:38 +0100, you wrote: > > >I was actually thinking more along the lines of a programming language > >where you can just write > > > > head :: (n > 1) => List n x -> x > > > > tail :: List n x -> List (n-1) x > >

Re: [Haskell-cafe] Type Synonyms

2007-10-11 Thread Jonathan Cast
On Fri, 2007-10-12 at 11:00 +1300, ok wrote: > On 11 Oct 2007, at 4:06 pm, Tom Davies basically asked for > something equivalent to Ada's > type T is new Old_T; > which introduces a *distinct* type T that has all the operations and > literals of Old_T. In functional terms, suppose there is a

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-11 Thread Jonathan Cast
On Wed, 2007-10-10 at 21:45 -0400, Brandon S. Allbery KF8NH wrote: > On Oct 10, 2007, at 20:14 , Michael Vanier wrote: > > > I haven't been following this discussion closely, but here's an > > idea: use reverse psychology. > > > > "Haskell -- You're probably not smart enough to understand it." >

Re: [Haskell-cafe] Re: pi

2007-10-11 Thread Jonathan Cast
On Thu, 2007-10-11 at 07:57 +, Aaron Denney wrote: > On 2007-10-11, Jonathan Cast <[EMAIL PROTECTED]> wrote: > > Yes. I am very eager to criticize your wording. To wit, I'm still > > failing to understand what your position is. Is it fair to say that > > yo

Re: [Haskell-cafe] pi

2007-10-11 Thread Jonathan Cast
On Thu, 2007-10-11 at 11:22 +0200, [EMAIL PROTECTED] wrote: > My last word (promise!) on the subject, especially addressed to Jonathan > Cast, who writes: > > > To wit, I'm still failing to understand what your position is. > > I quote the Master: > > Le

Re: [Haskell-cafe] pi

2007-10-10 Thread Jonathan Cast
On Thu, 2007-10-11 at 02:11 +0200, [EMAIL PROTECTED] wrote: > Jonathan Cast adds 'something' to a discussion about pi. > > I commented the statement of Yitzchak Gale, who answered some point > of Dan Piponi: > > >> > A default implementation of pi woul

Re: [Haskell-cafe] Re: pi

2007-10-10 Thread Jonathan Cast
On Wed, 2007-10-10 at 12:29 +0200, [EMAIL PROTECTED] wrote: > ChrisK writes: > > > Putting 'pi' in the same class as the trigonometric functions is good > > design. > > If you wish so... But: > Look, this is just a numeric constant. > Would you like to have e, the Euler's constant, etc., as wel

Re: [Haskell-cafe] pi

2007-10-10 Thread Jonathan Cast
On Wed, 2007-10-10 at 10:40 +0200, [EMAIL PROTECTED] wrote: > Yitzchak Gale writes: > > > Dan Piponi wrote: > >> The reusability of Num varies inversely with how many > >> assumptions you make about it. > > > > A default implementation of pi would only increase usability, > > not decrease it. >

Re: [Haskell-cafe] pi

2007-10-09 Thread Jonathan Cast
On Tue, 2007-10-09 at 13:07 -0700, Don Stewart wrote: > jonathanccast: > > I just noticed that pi doesn't have a default definition in the standard > > prelude, according to the Haddock docs. Why is this? > > $ ghci > Prelude> :t pi > pi :: (Floating a) => a > > Prelude> pi >

[Haskell-cafe] pi

2007-10-09 Thread Jonathan Cast
I just noticed that pi doesn't have a default definition in the standard prelude, according to the Haddock docs. Why is this? jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-10-05 Thread Jonathan Cast
On Fri, 2007-10-05 at 20:19 +, Aaron Denney wrote: > On 2007-10-05, Peter Verswyvelen <[EMAIL PROTECTED]> wrote: > > But where is the great IDE Haskell deserves??? :-) Seriously, 99% of the > > programmers I know don't want to look at it because when they see Emacs > > or VIM, they say "what

Re: [Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-03 Thread Jonathan Cast
On Wed, 2007-10-03 at 14:47 -0700, Justin Bailey wrote: > One of the "holes" in real-world Haskell is you never know if a > library/function is calling unsafePerformIO and you have to trust the > library author. I recognize the necessity of the function, but should > it announce itself? unsafePerfo

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-03 Thread Jonathan Cast
On Wed, 2007-10-03 at 14:15 +0200, Stephane Bortzmeyer wrote: > On Wed, Oct 03, 2007 at 12:01:50AM +0200, > Twan van Laarhoven <[EMAIL PROTECTED]> wrote > a message of 24 lines which said: > > > Lots of people wrote: > > > I want a UTF-8 bikeshed! > > > No, I want a UTF-16 bikeshed! > > Person

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-02 Thread Jonathan Cast
On Wed, 2007-10-03 at 00:01 +0200, Twan van Laarhoven wrote: > Lots of people wrote: > > I want a UTF-8 bikeshed! > > No, I want a UTF-16 bikeshed! > > What the heck does it matter what encoding the library uses internally? +1 jcc ___ Haskell-Cafe

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-02 Thread Jonathan Cast
On Tue, 2007-10-02 at 22:05 +0400, Miguel Mitrofanov wrote: > > I would like to, again, strongly argue against sacrificing > > compatibility > > with Linux/BSD/etc. for the sake of compatibility with OS X or > > Windows. > > Ehm? I've used to think MacOS is a sort of BSD... Cocoa, then. jcc

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-02 Thread Jonathan Cast
On Tue, 2007-10-02 at 08:02 -0700, Deborah Goldsmith wrote: > On Oct 2, 2007, at 5:11 AM, ChrisK wrote: > > Deborah Goldsmith wrote: > > > >> UTF-16 is the native encoding used for Cocoa, Java, ICU, and > >> Carbon, and > >> is what appears in the APIs for all of them. UTF-16 is also what's > >>

Re: [Haskell-cafe] Newb question about map and a list of lists

2007-09-28 Thread Jonathan Cast
On Fri, 2007-09-28 at 11:19 -0700, Chuk Goodin wrote: > I have a list of lists of pairs of numeric Strings (like this: > [["2","3"],["1","2"],["13","14"]] etc.) I'd like to change it into a > list of a list of numbers, but I'm not sure how to go about it. If it > was just one list, I could use map,

Re: [Haskell-cafe] Re: isWHNF :: a -> IO Bool ?

2007-09-27 Thread Jonathan Cast
On Thu, 2007-09-27 at 16:57 +0100, Tristan Allwood wrote: > On Thu, Sep 27, 2007 at 05:31:51PM +0200, apfelmus wrote: > > Tristan Allwood wrote: > >> Does anyone know if there is a function that tells you if a haskell > >> value has been forced or not? e.g. isWHNF :: a -> IO Bool let x = > >> (map

Re: [Haskell-cafe] Haskell Cheat Sheet?

2007-09-26 Thread Jonathan Cast
On Wed, 2007-09-26 at 17:09 -0500, Derek Elkins wrote: > On Wed, 2007-09-26 at 14:12 -0700, Jonathan Cast wrote: > > On Wed, 2007-09-26 at 11:43 -0700, Dan Weston wrote: > > > It seems no one liked idea #2. I still think fix is the wrong name for > > > this,

Re: [Haskell-cafe] unsafePerformIO: are we safe?

2007-09-26 Thread Jonathan Cast
On Wed, 2007-09-26 at 14:28 -0700, Dan Piponi wrote: > On 9/26/07, Lennart Augustsson <[EMAIL PROTECTED]> wrote: > > Things can go arbitrarily wrong if you misuse unsafePerformIO, you can even > > subvert the type system. > > So...if I was in a subversive kind of mood (speaking hypothetically), >

Re: [Haskell-cafe] Haskell Cheat Sheet?

2007-09-26 Thread Jonathan Cast
On Wed, 2007-09-26 at 11:43 -0700, Dan Weston wrote: > It seems no one liked idea #2. I still think fix is the wrong name for > this, maybe limit would be better. It calculates least fixed points. `fix' is as good a name as any. `limit' is terrible; the argument to fix, a -> a, is neither a seq

Re: [Haskell-cafe] PROPOSAL: New efficient Unicode string library.

2007-09-26 Thread Jonathan Cast
On Wed, 2007-09-26 at 18:46 +0100, Duncan Coutts wrote: > In message <[EMAIL PROTECTED]> Jonathan Cast <[EMAIL PROTECTED]> writes: > > On Wed, 2007-09-26 at 09:05 +0200, Johan Tibell wrote: > > > > If UTF-16 is what's used by everyone else (how about Java?

Re: [Haskell-cafe] PROPOSAL: New efficient Unicode string library.

2007-09-26 Thread Jonathan Cast
On Wed, 2007-09-26 at 09:05 +0200, Johan Tibell wrote: > > I'll look over the proposal more carefully when I get time, but the > > most important issue is to not let the storage type leak into the > > interface. > > Agreed, > > > From an implementation point of view, UTF-16 is the most efficient

Re: [Haskell-cafe] Haskell Cheat Sheet?

2007-09-26 Thread Jonathan Cast
On Tue, 2007-09-25 at 17:19 -0700, Dan Weston wrote: > One suggestion: > > Section 3.6 defines a function "fix": > > fix :: Eq x => (x -> x) -> x -> x > > fix f x = if x == x' then x else fix f x' > where x' = f x > > This confusingly differs in both type and meaning from the traditio

Re: [Haskell-cafe] Desugaring of infix operators is (always?) the wrong way round

2007-09-25 Thread Jonathan Cast
On Tue, 2007-09-25 at 19:18 +0100, Brian Hulley wrote: > Brian Hulley wrote: > > I'm wondering if anyone can shed light on the reason why > > > >x # y > > > > gets desugared to > > > > (#) x y > > > > and not > > > > (#) y x > > > > > Can anyone think of an example where the current desuga

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Jonathan Cast
On Tue, 2007-09-25 at 12:24 +0100, Andrew Coppin wrote: > Chaddaï Fouché wrote: > > 2007/9/25, Andrew Coppin <[EMAIL PROTECTED]>: > > > >> This is why I found it so surprising - and annoying - that you can't use > >> a 2-argument function in a point-free expression. > >> > >> For example, "zipWi

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Jonathan Cast
On Tue, 2007-09-25 at 11:40 +0100, Andrew Coppin wrote: > Aaron Denney wrote: > > On 2007-09-25, Andrew Coppin <[EMAIL PROTECTED]> wrote: > > > >> OK, *now* I'm puzzled... Why does map . map type-check? > >> > > > > (map . map) = (.) map map > > > > (.) :: (a -> b) -> (b -> c) -> a -> c > >

<    1   2   3   4   5   6   >