[Haskell-cafe] Re: Haskell Logo write-in candidate

2009-03-20 Thread Jon Fairbairn
Warren Harris warrensomeb...@gmail.com writes: After spending a bit of time trying to decide how to vote, I ended up deciding that my favorite would be a hybrid of several of the designs (#9 #49 FalconNL, and #50 George Pollard). It's probably too late to include this in the voting, but

[Haskell-cafe] Re: Query on list comprehension

2009-03-19 Thread Jon Fairbairn
Henning Thielemann lemm...@henning-thielemann.de writes: On Tue, 17 Mar 2009, Melanie_Green wrote: What are the limitations of list comprehension. I want to use listcomprehension to output the pattern below. So a mixture of a's and newline characters. The part im stuck at is creating

[Haskell-cafe] Re: Query on list comprehension

2009-03-18 Thread Jon Fairbairn
Melanie_Green jac_legend_...@hotmail.com writes: What are the limitations of list comprehension. I want to use listcomprehension to output the pattern below. So a mixture of a's and newline characters. The part im stuck at is creating arguments in the listcomprehension to stop at some point

[Haskell-cafe] Re: Sugestion for a Haskell mascot

2009-03-12 Thread Jon Fairbairn
Joe Fredette jfred...@gmail.com writes: Hehe, I love it. Sloth is a synonym for Lazyness in English too, and they're so freaking cute... :) I wouldn't say it was an exact synonym. Though the dictionary definitions are similar, sloth has a more negative connotation than laziness; the fourth

[Haskell-cafe] Re: How to work with date?

2009-03-02 Thread Jon Fairbairn
Magicloud Magiclouds magicloud.magiclo...@gmail.com writes: Hi,   I am working on some calendar GUI thing. And I cannot find a library to operate the date. Like, when `now - getZonedTime`, how could I get all the dates of the week. Or when I got `today`, how to get the date of 10 days ago?

[Haskell-cafe] Re: How to work with date?

2009-03-02 Thread Jon Fairbairn
Bulat Ziganshin bulat.zigans...@gmail.com writes: Hello Jon, Monday, March 2, 2009, 2:22:55 PM, you wrote: take 10 $ map (addDays (-1)) $ repeat $ utctDay $ zonedTimeToUTC now take 10 $ iterate (addDays (-1)) $ utctDay $ zonedTimeToUTC now take anything I post before 14:00 with a pinch of

[Haskell-cafe] Re: permuting a list

2009-02-16 Thread Jon Fairbairn
Paul Johnson p...@cogito.org.uk writes: See http://okmij.org/ftp/Haskell/perfect-shuffle.txt I should have read that first time round! -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2009-01-31)

[Haskell-cafe] Re: Low-level high-level languages?

2009-02-16 Thread Jon Fairbairn
Maurí­cio briqueabra...@yahoo.com writes: Hi, I've checked this 'BitC' language (www.bitc-lang.org). It uses some ideas we see in Haskell, although with different realization, and target mainly reliable low level code, like micro-kernels (although I think it could be used anywhere C is

[Haskell-cafe] Re: permuting a list

2009-02-15 Thread Jon Fairbairn
Heinrich Apfelmus apfel...@quantentunnel.de writes: The answer is a resounding yes and the main idea is that shuffling a list is *essentially the same* as sorting a list; the minor difference being that the former chooses a permutation at random while the latter chooses a very particular

Re: Outlaw tabs

2009-01-26 Thread Jon Fairbairn
Achim Schneider bars...@web.de writes: Twan van Laarhoven twa...@gmail.com wrote: Tabs can be convenient for quick scripts and things like that, where you wouldn't use -Wall. And while I keep hearing about the problems with tabs, I have never encountered any with Haskell code. If you

Re: Outlaw tabs

2009-01-25 Thread Jon Fairbairn
Lennart Augustsson lenn...@augustsson.net writes: But VT is allowed in Haskell. Gosh, so it is. It's been a while since I looked, and I've no recollection of the discussion that made it part of whitechar. But does it mean what I want it to mean? Does anyone actually use it? Are there any

Re: Outlaw tabs

2009-01-25 Thread Jon Fairbairn
Lennart Augustsson lenn...@augustsson.net writes: I don't know what you want it to mean, so I can't answer that. :) I'm not saying, either ;-P I doubt anyone has ever used a VT on purpose. I know I haven't. I regard it as a lexical quirk. Say no to quirks. -- Jón Fairbairn

[Haskell-cafe] Re: Existencial quantification and polymorphic datatypes

2009-01-20 Thread Jon Fairbairn
Mauricio briqueabra...@yahoo.com writes: I'm trying, without success, to understand the difference between existencial quantification and polymorphic datatypes. Polymorphic types are universally quantified; so id:: forall t. t - t means that id works for every type t. If haskell had a

[Haskell-cafe] Re: Different return type?

2009-01-19 Thread Jon Fairbairn
John Ky newho...@gmail.com writes: Hi, Possibly a silly question but is it possible to have a function that has a different return type based on it's first argument? Are you sure that's what you really want? For instance data Person = Person { name :: String, ... } data Business =

[Haskell-cafe] Re: Logos of Other Languages

2008-12-19 Thread Jon Fairbairn
Ashley Yakeley ash...@semantic.org writes: All of these get one thing right that the current and most of the proposed Haskell logos do not: they don't make any reference to the syntax of the language itself. Doing so seems to miss the point of a logo: it's supposed to appeal visually, rather

[Haskell-cafe] Re: TimeDiff to Int?

2008-11-14 Thread Jon Fairbairn
Lyle Kopnicky [EMAIL PROTECTED] writes: Thanks, but that doesn't seem to work. I got an answer of -3. I tried it again a minute later and it was still -3. I tried again a minute later and it was -1. It's just after 9am here, so I have no idea what to make of those numbers. That's most

[Haskell-cafe] Re: TimeDiff to Int?

2008-11-13 Thread Jon Fairbairn
Lyle Kopnicky [EMAIL PROTECTED] writes: I had some code using the oldtime package, and want to convert it to use the time package. One of the things I need to do is calculate the number of seconds since midnight. The easy part is getting a TimeDiff result: You mean DiffTime? utc -

[Haskell-cafe] Re: Announcing OneTuple-0.1.0

2008-10-02 Thread Jon Fairbairn
Benjamin L.Russell [EMAIL PROTECTED] writes: Note: the singleton tuple does not support tuple syntax. What is the syntax for the singleton tuple? [...] the singleton syntax will be different from the non-singleton syntax, which is also syntactically inelegant. What is your solution?

[Haskell-cafe] Re: Health effects

2008-10-01 Thread Jon Fairbairn
Adrian Neumann [EMAIL PROTECTED] writes: I often wonder how many cuts you need to divide a steak in n pieces. You can obviously get n pieces with (sqrt n) cuts by cutting a grid. But I'm sure some smart mathematician thought of a (log n) way. Are you allowed to move the pieces between

[Haskell-cafe] Re: [m..n] question

2008-09-22 Thread Jon Fairbairn
Richard A. O'Keefe [EMAIL PROTECTED] writes: Erlang's equivalent of [m..n] is lists:seq(M, N), which is currently defined to raise an exception when N M. In particular, lists:seq(1, N) returns a list of length N when N 0, but not when N = 0. I'm currently arguing that lists:seq(1, 0)

[Haskell-cafe] Re: Fixed-Point Combinators

2008-07-17 Thread Jon Fairbairn
Adrian Neumann [EMAIL PROTECTED] writes: Hello, while studying for a exam I came across this little pearl: Y = (L L L L L L L L L L L L L L L L L L L L L L L L L L L L) where L = λabcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m b i n a t o r)) posted by Cale

[Haskell-cafe] Re: working with Random.randoms

2008-06-15 Thread Jon Fairbairn
Robert Vollmert [EMAIL PROTECTED] writes: Great reply! Thanks. One minor point: If real_programme is to be pure, you should use let: Whoops! I was thinking let but wrote the wrong thing. If my email had been through a type-checker, it would have spotted the mistake. -- Jón Fairbairn

[Haskell-cafe] Re: working with Random.randoms

2008-06-14 Thread Jon Fairbairn
Stephen Howard [EMAIL PROTECTED] writes: I am a newcomer doing my obligatory struggling with Haskell's type system, That's your mistake. Don't struggle with the type system, the type system is your friend; when it tells you you are doing something wrong, it's usually right. and I've got a

[Haskell-cafe] Re: coerce (safe!)

2008-03-02 Thread Jon Fairbairn
Krzysztof Skrzętnicki [EMAIL PROTECTED] writes: Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to write a function of type (a-b). Well, possibly I didn't write anything particularly new, but please excuse me for I'm

[Haskell-cafe] Re: Datatypes - Haskell

2008-02-12 Thread Jon Fairbairn
Richard A. O'Keefe [EMAIL PROTECTED] writes: On the subject of data types, I've recently seen Haskell code using data Foo ... = Foo { ... } where I would have used newtype instead of data. When is it a good idea to avoid newtype? When the code was written before newtype was introduced

[Haskell-cafe] Yi, or Gtk2hs or fedora rpm problem?

2008-02-03 Thread Jon Fairbairn
This was mentioned on the yi-devel list http://groups.google.com/group/yi-devel/browse_frm/thread/392c3cd612490b1a/c304d54ffc000e4a?lnk=gstq=HSgtk.o%3A+unknown+symbol# but didn't cause much excitement as it's not clear whose problem it is, so I'll ask here as well: I recently downloaded yi-0.3

[Haskell-cafe] Re: anybody can tell me the pronuncation of haskell?

2008-01-29 Thread Jon Fairbairn
[EMAIL PROTECTED] writes: Jerzy Karczmarczuk (pronounced as written) Do you mean you don't care, or are you assuming that we know whether the convention is to read it as Polish orthography, English, or French? Jón (invariably mispronounced) -- Jón Fairbairn

[Haskell-cafe] Re: Newbie question

2008-01-22 Thread Jon Fairbairn
Bulat Ziganshin [EMAIL PROTECTED] writes: Hello Jon, Monday, January 21, 2008, 9:28:09 PM, you wrote: Ok. I have a my own class class A a and want to write function like this f:: (A a)=Integer-a. Can I do it? But in general you are going to want something a bit more useful, which means

[Haskell-cafe] Re: Newbie question

2008-01-21 Thread Jon Fairbairn
Alexander Seliverstov [EMAIL PROTECTED] writes: How does caller choose which particular instance of Num they want? They specify the type... or just pass the result to something that specifies the type. Try it in ghci: Prelude let f:: Integral i = Integer - i; f = fromIntegral Prelude let g ::

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

2007-12-27 Thread Jon Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes: I should have been more precise with my question. Given the code: fred = 2 + 2 bob = fred + fred In a Haskell implementation fred would be evaluated once to 4, then used twice. The 2+2 would only happen once (ignore defaulting and overloaded

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

2007-12-26 Thread Jon Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes: Hi, Are CAF's specified in the Haskell report? I couldn't find them mentioned. CAF is a term of art. If you define fred = 2 + 2 that's a CAF. If not, why do all Haskell compilers support them? How could they not? I'm not sure I understand your

[Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Jon Fairbairn
Cristian Baboi [EMAIL PROTECTED] writes: What I should have been told about upfront: - the syntax for an expression Since there are only declarations and expressions, the syntax of an expression involves pretty much all of the language, so it would be difficult to tell it upfront. - the

[Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Jon Fairbairn
Cristian Baboi [EMAIL PROTECTED] writes: On Tue, 18 Dec 2007 11:56:36 +0200, Jon Fairbairn [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] writes: - the syntax for a block Not sure what you mean by block. do a - [1..10] b - [3,4] return (a,b) is an expression... you

Re: class default method proposal

2007-12-13 Thread Jon Fairbairn
Duncan Coutts [EMAIL PROTECTED] writes: We all know that Functor should have been a superclass of Monad, and indeed we now know that Applicative should be too. Making such a change would break lots of things however so the change does not happen. However in this case the Monad operations can

[Haskell-cafe] Re: class default method proposal

2007-12-13 Thread Jon Fairbairn
Duncan Coutts [EMAIL PROTECTED] writes: We all know that Functor should have been a superclass of Monad, and indeed we now know that Applicative should be too. Making such a change would break lots of things however so the change does not happen. However in this case the Monad operations can

[Haskell-cafe] Re: Editorial error or something meaningful?

2007-12-01 Thread Jon Fairbairn
PR Stanley [EMAIL PROTECTED] writes: Hi taken from ch.8.3 in the Hutton book: Whereas return v always succeeds, the dual parser failure always fails regardless of the contents of the input string: The dual parser failure? It's a question of how you parse the phrase dual parser failure.

[Haskell-cafe] Re: Sinus in Haskell

2007-11-09 Thread Jon Fairbairn
Hans van Thiel [EMAIL PROTECTED] writes: On Fri, 2007-11-09 at 14:30 -0500, Brent Yorgey wrote: On Nov 9, 2007 2:08 PM, Hans van Thiel [EMAIL PROTECTED] wrote: Hello All, Can anybody explain the results for 1.0, 2.0 and 3.0 times pi below? GHCi yields the

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

2007-11-02 Thread Jon Fairbairn
Cale Gibbard [EMAIL PROTECTED] writes: On 21/10/2007, Jon Fairbairn [EMAIL PROTECTED] wrote: No, they (or at least links to them) typically are that bad! Mind you, as far as fragment identification is concerned, so are a lot of html pages. But even if the links do have fragment ids, pdfs

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

2007-11-01 Thread Jon Fairbairn
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 painted cmr just makes me giddy as a grad student. A beautifully rendered

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

2007-10-23 Thread Jon Fairbairn
Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes: On Oct 21, 2007, at 6:29 , Jon Fairbairn wrote: No, they (or at least links to them) typically are that bad! Mind you, as far as fragment identification is concerned, so are a lot of html pages. But even if the links do have fragment ids

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

2007-10-23 Thread Jon Fairbairn
Derek Elkins [EMAIL PROTECTED] writes: On Mon, 2007-10-22 at 01:12 +0100, Lennart Augustsson wrote: There's nothing wrong with Haskell types. It's the terms that make Haskell types an inconsistent logic. Logics are what are consistent or not, so saying the logic Haskell's type system

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

2007-10-21 Thread Jon Fairbairn
Peter Hercek [EMAIL PROTECTED] writes: Jon Fairbairn wrote: A hyperlink of the form a href=http://.../long-research-paper.html#interesting-paragraph; interesting bit/a is far more useful than one of the form a href=http://.../long-research-paper.pdf;look for section 49.7.3/a. It may

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

2007-10-20 Thread Jon Fairbairn
Simon Peyton-Jones [EMAIL PROTECTED] writes: I realise belatedly that my message might have sounded dismissive. My apologies; it wasn't intended to be. Good ideas are just that: good. Reinventing them is a sign of good taste. As to documenting GHC, we try to do that by writing papers.

[Haskell-cafe] Re: Strange subtract operator behavior - and lazy naturals

2007-10-18 Thread Jon Fairbairn
David Benbennick [EMAIL PROTECTED] writes: On 10/17/07, John Meacham [EMAIL PROTECTED] wrote: Oops, sorry, the version I posted was an intermediate one that had a different addition algorithm. here is a better one that fixes that issue: Zero + y = y Sum x n1 + y = Sum x (y + n1) note that

[Haskell-cafe] Re: How to thoroughly clean up Haskell stuff on linux

2007-10-13 Thread Jon Fairbairn
Lihn, Steve [EMAIL PROTECTED] writes: Hi, I have been hacking the Haskell installation a few days on Redhat Linux. GHC 6.6 - 6.6.1 - Lambdabot does not work. [...] Anyway, now my question is, how do I thoroughly clean up Haskell? (And maybe try again after a few days of rest.) Is

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

2007-09-27 Thread Jon Fairbairn
apfelmus [EMAIL PROTECTED] writes: 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 succ [0..]) in do putStrLn . show (isWHNF x)-- False putStrLn . show .

[Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-05 Thread Jon Fairbairn
Sterling Clover [EMAIL PROTECTED] writes: of course you could rewrite this in a while loop too although you'd have to use an assignment, but at least still not one with a silly done variable. People seem to have overlooked the bit of Algol68 I posted, so I'll repeat it While If E

[Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-04 Thread Jon Fairbairn
Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes: On Sep 4, 2007, at 5:02 , Miguel Mitrofanov wrote: It depends on arbitrary restrictions on what constitutes an (boolean) expression, something that is anathema to functional programmers :-) Spot the language: while if E then S; F

[Haskell-cafe] Re: Newbie terminology for partial application

2007-08-27 Thread Jon Fairbairn
Peter Verswyvelen [EMAIL PROTECTED] writes: A while ago I confused currying with partial application, which was pointed out by members of this community, and the wiki pages got adapted so that newbies like me don't make the same mistake twice ;) That's great. Anyway, at the risk of making

[Haskell-cafe] Re: help understanding lazy evaluation

2007-08-23 Thread Jon Fairbairn
Stefan O'Rear [EMAIL PROTECTED] writes: Indeed, you've caught on an important technical distinction. Lazy: Always evaluating left-outermost-first. I think most people would rather use the term normal order¨ for that; lazy means evaluating in normal order /and/ not evaluating the same

[Haskell-cafe] Re: Hints for Euler Problem 11

2007-08-17 Thread Jon Fairbairn
Kim-Ee Yeoh [EMAIL PROTECTED] writes: Aaron Denney wrote: I find the first far more readable. The compiler should be able to assemble it all at compile time, right? 'Course not. The (++) function like all Haskell functions is only a /promise/ to do its job. I find this comment

[Haskell-cafe] Compile-time v run-time

2007-08-17 Thread Jon Fairbairn
I wrote: the compile-time/run-time dichotomy is only relevant when a value depends on data only available at run-time. Something I've wanted to experiment with for a long time and never got round to is writing CAFs back to the load module at the end of a run (if they're small enough or took a

[Haskell-cafe] Re: defining last using foldr

2007-08-16 Thread Jon Fairbairn
Chaddaï Fouché [EMAIL PROTECTED] writes: so you need an f so that c `f` x is c (for any c and x) and yet (b `f` c) is c for any c and b -- this is impossible (or I'm asleep). Well, it isn't impossible but quite hard (and not even standard H98 if I'm not mistaken) If it is possible, I'm

[Haskell-cafe] Re: defining last using foldr

2007-08-15 Thread Jon Fairbairn
Alexteslin [EMAIL PROTECTED] writes: I am really sorry, but i still can't define the function. The chapter the exercise is in precedes algebraic types or Maybe a types. And is seems that must being easy to define. I answered some exercises on using foldr such as summing for example, but

[Haskell-cafe] Re: mutually recursive types

2007-08-08 Thread Jon Fairbairn
rodrigo.bonifacio [EMAIL PROTECTED] writes: Hi, I am learning the haskell programming language and had tried to define the following types: type Scenario = (String, String, [Step]) type Step = (String, Scenario, String, String, String) data Scenario = Scenario String String [Step] data

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

2007-08-01 Thread Jon Fairbairn
David Roundy [EMAIL PROTECTED] writes: On Mon, Jul 30, 2007 at 11:47:46AM +0100, Jon Fairbairn wrote: [snippage] This is all very horrid, but as far as I can tell what I was proposing wouldn't lead to such a mess, except possibly via defaulting, which, as the least important aspect

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

2007-07-30 Thread Jon Fairbairn
ChrisK [EMAIL PROTECTED] writes: And the readability is destroyed because you cannot do any type inference in your head. If you see { Matrix m = ; Matrix x = m * y; ...; } Then you know very little about the possible types of y since can only conclude that: [snippage] This

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-27 Thread Jon Fairbairn
ChrisK [EMAIL PROTECTED] writes: Jon Fairbairn wrote: I currently only get f :: [t] - something, so if I later discover that I need to change the input representation to be more efficient than lists, I have to rewrite f. Wouldn't it be so much nicer if I could simply add a declaration

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

2007-07-25 Thread Jon Fairbairn
Simon Marlow [EMAIL PROTECTED] writes: Dan Licata wrote: Simon PJ and I are implementing view patterns, a way of pattern matching against abstract datatypes, in GHC. At the risk of being a spoil-sport, I have a somewhat negative take on view patterns. Not because I think they're

[Haskell-cafe] Re: how to see operators precedence in GHCi

2007-07-25 Thread Jon Fairbairn
Bulat Ziganshin [EMAIL PROTECTED] writes: Hello , from http://community.livejournal.com/ru_declarative/54566.html Q: how to see operators precedence in GHCi? A: Prelude let showParen = (undefined::()-()) Prelude showParen $ 2+3*4 interactive:1:12: No instance for (Num

[Haskell-cafe] Re: historical question about Haskell and Haskell Curry

2007-07-19 Thread Jon Fairbairn
Michael Vanier [EMAIL PROTECTED] writes: We always say that Haskell is named for Haskell Curry because his work provided the logical/computational foundations for the language. How exactly is this the case? Specifically, does anyone claim that Curry's combinatorial logic is more relevant to

[Haskell-cafe] Re: historical question about Haskell and Haskell Curry

2007-07-19 Thread Jon Fairbairn
Paul Hudak [EMAIL PROTECTED] writes: Actually, the more compelling reason we chose Haskell over Alonzo was that, at the time, Church was alive -- he died in 1995 -- whereas Curry was not -- he died in 1982. We felt uncomfortable naming the language after someone who still alive (however

[Haskell-cafe] Re: Defaulting to Rational [was: Number overflow]

2007-07-14 Thread Jon Fairbairn
Jonathan Cast [EMAIL PROTECTED] writes: On Friday 13 July 2007, Jon Fairbairn wrote: Henning Thielemann [EMAIL PROTECTED] writes: On Thu, 12 Jul 2007, Jon Fairbairn wrote: Surely the first few digits can be computed? That was my first thought, too. We can't define data Real

[Haskell-cafe] Re: Defaulting to Rational [was: Number overflow]

2007-07-13 Thread Jon Fairbairn
Henning Thielemann [EMAIL PROTECTED] writes: On Thu, 12 Jul 2007, Jon Fairbairn wrote: (ie limited precision, but unbounded magnitude). If we were to use BigFloat the base would need to be a power of ten to get the desired results for things like Don's example) People will be confused

[Haskell-cafe] Re: Defaulting to Rational [was: Number overflow]

2007-07-12 Thread Jon Fairbairn
Henning Thielemann [EMAIL PROTECTED] writes: On Thu, 12 Jul 2007, Jon Fairbairn wrote: Now, a proper exact real type is doubtless very inefficient, but wouldn't it be possible to define something that had a fairly efficient head, and a lazy tail? So you'd have, say data Real = R

[Haskell-cafe] Re: Abstraction leak

2007-07-01 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: While we're on the subject... am I the first person to notice that Haskell doesn't appear to have much support for fiddling with streams of bits? No. Presumably the author of Data.Bits noticed some lack. (Note that Integer is an instance of Num and

[Haskell-cafe] Re: Reinvention

2007-06-27 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: I seem to be forever writing code that looks like this: decode :: String - (SKI,String) decode (c:cs) = case c of 'S' - (S,cs) 'K' - (K,cs) 'I' - (I,cs) '*' - let (e0,cs0) = decode cs; (e1,cs1) = decode cs1 in (e0 :@: e1, cs1) This looks

[Haskell-cafe] Re: Construct all possible trees

2007-06-14 Thread Jon Fairbairn
Mirko Rahn [EMAIL PROTECTED] writes: Jon Fairbairn wrote: Trees with all the elements of a list in that order: the_trees [x] = [Leaf x] the_trees l = zipWith Branch (concat (map the_trees (tail $ inits l))) (concat (map the_trees (tail $ tails l))) Sorry

[Haskell-cafe] Re: Construct all possible trees

2007-06-13 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: Jon Fairbairn wrote: I'm trying to construct a function all_trees :: [Int] - [Tree] such that all_trees [1,2,3] will yield [ Leaf 1, Leaf 2, Leaf 3, Branch (Leaf 1) (Leaf 2), Branch (Leaf 1) (Leaf 3), Branch (Leaf 2) (Leaf 1

[Haskell-cafe] Re: Construct all possible trees

2007-06-12 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: I'm trying to construct a function all_trees :: [Int] - [Tree] such that all_trees [1,2,3] will yield [ Leaf 1, Leaf 2, Leaf 3, Branch (Leaf 1) (Leaf 2), Branch (Leaf 1) (Leaf 3), Branch (Leaf 2) (Leaf 1), Branch (Leaf 2) (Leaf 3),

[Haskell-cafe] Re: tail recursion ?

2007-06-11 Thread Jon Fairbairn
H. [EMAIL PROTECTED] writes: Hello @ all, Sometimes one has an imperative algorithm, and wants to write a program in Haskell which do has the same effect... So the question is - how a construct as the following can efficiently be written? -- Pseudo code: n[1..1] = false

[Haskell-cafe] Re: tail recursion ?

2007-06-11 Thread Jon Fairbairn
H. [EMAIL PROTECTED] writes: Jon Fairbairn jon.fairbairn at cl.cam.ac.uk writes: The idea in Haskell is not to think of stepping through the array. Look at accumArray and ixmap. Thanks for your answer. But I can't really see how the calc-function can be written more efficiently

[Haskell-cafe] Re: tail recursion ?

2007-06-11 Thread Jon Fairbairn
Simon Brenner [EMAIL PROTECTED] writes: The key is letting haskell be lazy and produce the output one item at a time. True. This solution goes up to 100k in 25M of heap and up to 400k in 200M of heap. While working better, the space requirement seems to be (at least almost) quadratic, so

[Haskell-cafe] Re: Hardware

2007-06-02 Thread Jon Fairbairn
Claus Reinke [EMAIL PROTECTED] writes: either be slower than mainstream hardware or would be overtaken by it in a very short space of time. i'd like to underline the last of these two points, and i'm impressed that you came to that conclusion as early as the eighties. Well, Stuart and I

[Haskell-cafe] Re: Hardware

2007-06-02 Thread Jon Fairbairn
Neil Davies [EMAIL PROTECTED] writes: Bulat That was done to death as well in the '80s - data flow architectures where the execution was data-availability driven. The issue becomes one of getting the most of the available silicon area. Unfortunately with very small amounts of computation

[Haskell-cafe] Re: Just for a laugh...

2007-06-01 Thread Jon Fairbairn
Dougal Stanton [EMAIL PROTECTED] writes: On 31 May 2007 21:52:33 +0100, Jon Fairbairn [EMAIL PROTECTED] wrote: Yes, but you didn't say that it's not only silly but demonstrates the opposite of expressiveness as it's all about breaking an abstraction and must be non-portable code

[Haskell-cafe] Re: Hardware

2007-06-01 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: OK, so... If you were going to forget everything we humans know about digital computer design - the von Neuman architecture, the fetch/decode/execute loop, the whole shooting match - and design a computer *explicitly* for the purpose of executing

[Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread Jon Fairbairn
David House [EMAIL PROTECTED] writes: On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: If you're bored... can you come up with a solution to this? Try using floatToDigits: http://haskell.org/ghc/docs/latest/html/libraries/base/Numeric.html#v%3AfloatToDigits floatToDigits takes a base

[Haskell-cafe] Re: Just for a laugh...

2007-05-31 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: Jon Fairbairn wrote: David House [EMAIL PROTECTED] writes: On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: If you're bored... can you come up with a solution to this? Try using floatToDigits: http://haskell.org/ghc/docs/latest/html

[Haskell-cafe] Re: Cute code [was: The C Equiv of != in Haskell miscommunication thread]

2007-05-29 Thread Jon Fairbairn
Vincent Kraeutler [EMAIL PROTECTED] writes: anyhow. if someone has a pedestrian's guide to the fixed point operator lying around, a link would be much appreciated. At the risk of increasing rather than decreasing your confusion (but in the hope that once you get over it you will be

[Haskell-cafe] Re: Language extensions

2007-05-29 Thread Jon Fairbairn
Andrew Coppin [EMAIL PROTECTED] writes: OTOH, how many function can you write with :: [Int] - Int? Quite a lot, but if you'd asked how many functions can you write :: Integer - Integer, the answer would be all of them (think about it). -- Jón Fairbairn [EMAIL

[Haskell-cafe] Re: Curiose types

2007-05-27 Thread Jon Fairbairn
POST X-Face: H#SM:U1U-/6#NN83s6?Die557~]Dfifz~-|V:wSKGL6T-|!qk{U4/M7+k5Py!-{q=2Q/%0@ E29yc_kQC^ User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Andrew Coppin [EMAIL PROTECTED] writes: As I lay in bed last night, a curios fact occurred to me. (Yes, I don't get out very much...) You

[Haskell-cafe] Re: Debunking tail recursion

2007-05-20 Thread Jon Fairbairn
Ilya Tsindlekht [EMAIL PROTECTED] writes: On Sat, May 19, 2007 at 09:16:46PM +0100, Jon Fairbairn wrote: Ilya Tsindlekht [EMAIL PROTECTED] writes: By definition, tail recursive function is recursive function in which the value returned from a recursive call is immediately returned

[Haskell-cafe] Re: Debunking tail recursion

2007-05-19 Thread Jon Fairbairn
David House [EMAIL PROTECTED] writes: On 18/05/07, Albert Y. C. Lai [EMAIL PROTECTED] wrote: Lazy evaluation says, to evaluate x, call f first, then x is the last call. x may be the last to be evaluated, but you still have to pass through f's call context 'on the way out'. Not exactly,

[Haskell-cafe] Re: Debunking tail recursion

2007-05-19 Thread Jon Fairbairn
Ilya Tsindlekht [EMAIL PROTECTED] writes: On Sat, May 19, 2007 at 04:10:29PM +0100, Jon Fairbairn wrote: [...] foldl f z l = case l of (x:xs) - foldl f (f z x) xs [] - z which reveals that foldl in the RHS isn't really the leftmost outermost

Re: fromJust Nothing problem

2006-11-14 Thread Jon Fairbairn
On 2006-11-14 at 13:57+0300 Serge D. Mechveliani wrote: Thanks to people who discussed the question of who said `fromJust Nothing' and -xc option. My last impression is that instead of using -xc it is better to write programs in a debug-friendly style. For example, let g x must

Re: [Haskell-cafe] Fractional/negative fixity?

2006-11-07 Thread Jon Fairbairn
On 2006-11-07 at 18:30+0100 Henning Thielemann wrote: On Tue, 7 Nov 2006, Simon Marlow wrote: This is a much more heavyweight change, and its not a clear win. Haskell 2 ? :-) If you'd like to make a concrete proposal, then feel free to do so and I'll make sure it gets onto the wiki.

Re: [Haskell] ASCII higher than 127

2006-10-17 Thread Jon Fairbairn
On 2006-10-17 at 16:31+0200 Andreas Marth wrote: How was that with Haskell and Unicode??? I think this probably belongs on ghc-users rather than Haskell. Anyhow, there aren't any ASCII characters higher than 127. While up to ghc-6.4.2 the following function worked it now doesn't compile:

Constant files/Re: Here-docs in Haskell source

2006-09-25 Thread Jon Fairbairn
On 2006-09-24 at 01:59BST Neil Mitchell wrote: As a side note, perhaps if you're shoving massive amounts of text into a Haskell source file you want to either move to something more structured (like haskell source extensions), IIRC the original problem was MySQL statements, which really call

Re: [Haskell] Haskell web forum

2006-09-20 Thread Jon Fairbairn
On 2006-09-20 at 21:19+0200 Niklas Broberg wrote: A mailing list will never be enough. Really? A forum has way way more potential. More potential than what we have already: URL: http://dir.gmane.org/gmane.comp.lang.haskell.general ? Jón -- Jón Fairbairn

Re: Floating point problems

2006-08-30 Thread Jon Fairbairn
This is more of a haskell-café than a ghc users question, but I'll put some thoughts here: On 2006-08-30 at 19:38BST Jamie Brandon wrote: I recently defied my supervisor and used Haskell to write my coursework instead of C. If the object of the course is to teach you (more about) C, that might

Re: map and fmap

2006-08-30 Thread Jon Fairbairn
I don't really have the stamina to keep up with discussions like this. I have a bit more now than the first time round, so here's some more... On 2006-08-29 at 07:58+0200 John Hughes wrote: On the contrary, it seems we had plenty of experience with an overloaded map--it was in the language

Re: All Monads are Functors

2006-08-26 Thread Jon Fairbairn
On 2006-08-25 at 19:09PDT Ashley Yakeley wrote: Jon Fairbairn wrote: There has been discussion in the past about whether Monad should be defined as class Functor m = Monad m where ... It's more complicated now that we have Ross Patterson's Applicative. http://haskell.org/ghc

Re: map and fmap

2006-08-21 Thread Jon Fairbairn
On 2006-08-20 at 15:52+0200 John Hughes wrote: From: Jon Fairbairn [EMAIL PROTECTED] To reinforce what Aaron said, if a programme works now, it'll still work if map suddenly means fmap. Well, this isn't quite true, is it? Here's an example: class Foldable f where fold

Re: map and fmap

2006-08-17 Thread Jon Fairbairn
On 2006-08-15 at 12:38+0200 John Hughes wrote: From: Robert Dockins [EMAIL PROTECTED] On Aug 14, 2006, at 3:00 PM, Iavor Diatchki wrote: and I think, that a better approach to problems like these would be to have a simplified learning Prelude for the beginners class, rather than

Re: Re[6]: All Monads are Functors

2006-08-15 Thread Jon Fairbairn
On 2006-08-15 at 16:25CDT Taral wrote: On 8/15/06, Bulat Ziganshin [EMAIL PROTECTED] wrote: in this case we lose class Functor a = Monad a base class declaration. so what will be the meaning of this: I don't see why that is the case. class Functor m = Monad m where return :: a - m

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-27 Thread Jon Fairbairn
On 2006-07-27 at 01:33EDT Paul Hudak wrote: Thanks for asking about this -- it probably should be in the paper. Dan Doel's answer is closest to the truth: I imagine the answer is that having the syntax for it looks nicer/is clearer. if a b c could be more cryptic than if a then b

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-27 Thread Jon Fairbairn
On 2006-07-27 at 13:01+0200 Tomasz Zielonka wrote: But because if-then-else is an expression, there is another problem. That was exactly my point when I made the muttering about self-bracketing (if ... fi, like everything else, is an expression in Algol68) all those years ago. I really regret

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-21 Thread Jon Fairbairn
On 2006-07-20 at 18:31BST I wrote: On 2006-07-13 at 10:16BST I wrote: Hooray! I've been waiting to ask Why aren't we asking what laws hold for these operations? Having thought about this for a bit, I've come up with the below. This is intended to give the general idea -- it's not

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-20 Thread Jon Fairbairn
On 2006-07-13 at 10:16BST I wrote: Hooray! I've been waiting to ask Why aren't we asking what laws hold for these operations? Having thought about this for a bit, I've come up with the below. This is intended to give the general idea -- it's not polished code, and I'm not at all wedded to the

<    1   2   3   4   >