Re: [Haskell-cafe] Why are field selectors functions?

2013-08-08 Thread Jon Fairbairn
AntC anthony_clay...@clear.net.nz writes: No! This isn't more bikeshedding about notation. It's a bit of Haskell archaeology. On Sun, Jun 30, 2013 at 2:59 AM, Judah Jacobson wrote: [This isn't exactly what Judah wrote.] ... Instead of `x f` (to access field x of record f), maybe we

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-04 Thread Jon Fairbairn
Francesco Mazzoli f...@mazzo.li writes: At Fri, 03 May 2013 16:34:28 +0200, Andreas Abel wrote: The answer to your question is given in Boehm's theorem, and the answer is no, as you suspect. For the untyped lambda-calculus, alpha-equivalence of beta-eta normal forms is the same as

Re: [Haskell-cafe] Prolog-style patterns

2013-04-09 Thread Jon Fairbairn
Jan Stolarek jan.stola...@p.lodz.pl writes: Hi all, consider this simple reimplementation of 'elem' function: member :: Eq a = a - [a] - Bool member _ [] = False member y (x:xs) | x == y= True | otherwise = member y xs If Haskell allowed to write pattern matching

Re: [Haskell-cafe] Ticking time bomb

2013-03-23 Thread Jon Fairbairn
Marc Weber marco-owe...@gmx.de writes: The only safe way is acceptnig keys from people you know don't view pdf using adobe reader, I don’t… who don't browse the web (neither use flash) etc. I only browse the web (in general) from a diskless virtual machine. And then still you also have to

Re: [Haskell-cafe] Country names and language names

2013-03-08 Thread Jon Fairbairn
Henk-Jan van Tuyl hjgt...@chello.nl writes: On Wed, 06 Mar 2013 20:53:57 +0100, Obscaenvs obscae...@gmail.com wrote: Do not forget that country names can change; e.g. the Netherlands Antilles were split up in 2010. This might cause problems if you store country codes in a database. If you

Re: [Haskell-cafe] How to input Unicode string in Haskell program?

2013-02-22 Thread Jon Fairbairn
Alexander V Vershilov alexander.vershi...@gmail.com writes: The problem is that Prelude.getLine uses current locale to load characters: for example if you have utf8 locale, then everything works out of the box: $ runhaskell 1.hs résumé 履歴書 резюме résumé 履歴書 резюме But if you change locale

Re: [Haskell-cafe] Why isn't Program Derivation a first class citizen?

2013-02-13 Thread Jon Fairbairn
Rustom Mody rustompm...@gmail.com writes: On Wed, Feb 13, 2013 at 4:17 AM, Nehal Patel nehal.a...@gmail.com wrote: Why isn't Program Derivation a first class citizen? --- I am stating these things from somewhat foggy memory (dont have any lambda-calculus texts handy) and so will

Re: [Haskell-cafe] lambda case

2012-11-30 Thread Jon Fairbairn
Andreas Abel andreas.a...@ifi.lmu.de writes: I had been missing a pattern matching lambda in Haskell for a long time (SML had fn since ages) and my typical use will be monadic_expr = \case branches We’ve been through that. I want something similar, but would have preferred something

[Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-11-29 Thread Jon Fairbairn
Ben Franksen ben.frank...@online.de writes: just wanted to drop by to say how much I like the new lambda case extension. I use it all the time and I just *love* how it relieves me from conjuring up dummy variables, which makes teh code not only esier to write but also to read. […] should

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-27 Thread Jon Fairbairn
Yuri de Wit yde...@gmail.com writes: Would this be relevant? https://github.com/jonsterling/Data.Records That looks promising, thanks. It does use rather a lot of extensions, so it’ll take me a while to understand it. -- Jón Fairbairn

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-26 Thread Jon Fairbairn
Twan van Laarhoven twa...@gmail.com writes: On 24/10/12 12:08, Jon Fairbairn wrote: Is there a convenient way of handling a data structure with lots of fields of different types that may or may not be filled in? Not sure about convenience, but here is a type safe solution with O(log n

[Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Jon Fairbairn
Is there a convenient way of handling a data structure with lots of fields of different types that may or may not be filled in? Something equivalent to data D = D {a::Maybe A, b::Maybe B, c::Maybe C, …} but with better space efficiency and a more convenient empty object. An easy alternative

Re: [Haskell-cafe] Monads

2012-10-01 Thread Jon Fairbairn
Albert Y. C. Lai tre...@vex.net writes: On 12-09-30 06:33 PM, Jake McArthur wrote: When discussing monads, at least, a side effect is an effect that is triggered by merely evaluating an expression. A monad is an interface that decouples effects from evaluation. I don't understand that

Re: [Haskell-cafe] How to take a minimum sub list that only contain certain number of elements of certain type?

2012-09-25 Thread Jon Fairbairn
Magicloud Magiclouds magicloud.magiclo...@gmail.com writes: Hi, For example, I have an array [0..]. Now I want to take a sub list that starts from index 0, and only contain 4 odds, and is minimum result. The answer should be [0, 1, 2, 3, 4, 5, 6, 7]. How to do that? Combining lazy

Re: [Haskell-cafe] Knight Capital debacle and software correctness

2012-08-05 Thread Jon Fairbairn
Jay Sulzberger j...@panix.com writes: On Sat, 4 Aug 2012, Clark Gaebel cgae...@uwaterloo.ca wrote: As far as I know, you can't check equivalence of _|_. Since Haskell uses _|_ to represent a nonterminating computation, this would be synonymouswith solving the halting problem. Ah, thanks.

[Haskell-cafe] Failing to find a function

2012-02-19 Thread Jon Fairbairn
This is probably a failure of my search fu or some other mental lacuna, but is there already a definition of this function somewhere: \a b - runKleisli $ (Kleisli a) + Kleisli b ? Hoogling for its type MonadPlus m = (a - m b) - (a - m b) - a - m b doesn’t net me anything useful. -- Jón

Re: [Haskell-cafe] Failing to find a function

2012-02-19 Thread Jon Fairbairn
Erik Hesselink hessel...@gmail.com writes: On Sun, Feb 19, 2012 at 12:50, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: This is probably a failure of my search fu or some other mental lacuna, but is there already a definition of this function somewhere: \a b - runKleisli $ (Kleisli

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-05 Thread Jon Fairbairn
Haisheng Wu fre...@gmail.com writes: a = [1,1,1,1] b = [0,1,2,3] d = [0,0,0,0] for i in b: for j in c: if (i+j)3: d[i+j] += a[i] Do you have any cool solution in FP way? I find the above sufficiently alien that I can’t work out what it’s meant to do (what is it actually

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2012-01-18 Thread Jon Fairbairn
and termination. I would hope there would be, as that (or at least productivity) is the point of saying that Haskell has non-strict semantics. On Mon, Jan 9, 2012 at 3:01 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: Perhaps what I should have said to be almost as succinct but this time accurate

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2012-01-09 Thread Jon Fairbairn
wren ng thornton w...@freegeek.org writes: On 12/28/11 10:23 AM, Jon Fairbairn wrote: Thiago Negrievoh...@gmail.com writes: Lazy evaluation is one implementation of non-strict semantics, where the arguments are evaluated only when they are needed. I would say this: * non-strict

Re: [Haskell-cafe] How to split this string.

2012-01-06 Thread Jon Fairbairn
Steve Horne sh006d3...@blueyonder.co.uk writes: On 05/01/2012 11:09, Brandon Allbery wrote: On Thu, Jan 5, 2012 at 05:57, Steve Horne sh006d3...@blueyonder.co.uk mailto:sh006d3...@blueyonder.co.uk wrote: -- groupCut - Similar to groupBy, but where groupBy assumes an equivalence

Re: [Haskell-cafe] How to split this string.

2012-01-05 Thread Jon Fairbairn
Steve Horne sh006d3...@blueyonder.co.uk writes: On 02/01/2012 11:12, Jon Fairbairn wrote: maxm...@mtw.ru writes: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Jon Fairbairn
max m...@mtw.ru writes: I want to write a function whose behavior is as follows: foo string1\nstring2\r\nstring3\nstring4 = [string1, string2\r\nstring3, string4] Note the sequence \r\n, which is ignored. How can I do this? cabal install split then do something like import Data.List

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2011-12-28 Thread Jon Fairbairn
Thiago Negri evoh...@gmail.com writes: Lazy evaluation is one implementation of non-strict semantics, where the arguments are evaluated only when they are needed. I would say this: * non-strict semantics require that no argument is evaluated unless needed. * lazy evaluation is an

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2011-12-28 Thread Jon Fairbairn
Thiago Negri evoh...@gmail.com writes: 2011/12/28 Jon Fairbairn jon.fairba...@cl.cam.ac.uk: * non-strict semantics require that no argument is evaluated  unless needed. That's not the case on optimistic evaluation. Oops, yes. I should have said something like “non-strict semantics require

Re: [Haskell-cafe] Overloaded Strings as default

2011-11-29 Thread Jon Fairbairn
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: On 29 November 2011 07:28, Daniel Díaz Casanueva dhelta.d...@gmail.com wrote: Hi Cafe, I only feel curious about what would be the consequences of becoming the Overloaded Strings feature (currently, an extension) to be default in

Re: [Haskell-cafe] XML modification

2011-11-25 Thread Jon Fairbairn
Andrew Coppin andrewcop...@btinternet.com writes: On 23/11/2011 12:58 PM, Andrew Coppin wrote: On 23/11/2011 10:14 AM, Jon Fairbairn wrote: HaXml Mmm. That looks very promising... which gives some idea of the flavour. OK. So it looks like processXmlWith is the function I want, if I'm

Re: [Haskell-cafe] XML modification

2011-11-23 Thread Jon Fairbairn
Andrew Coppin andrewcop...@btinternet.com writes: I've got a folder with about 80 XML files in it. I want to take each file and make specific modifications to it. (Mostly just finding specific attributes and changing their values to make then all consistent.) Now I guess it wouldn't take me

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-06 Thread Jon Fairbairn
Joachim Breitner m...@joachim-breitner.de writes: Hi Cafe, this is an idea that has been floating in my head for a while, and I’m wondering about its feasibility and, if feasible, complexity (in the range from „trivial“ over “blog post” over “paper” to “thesis”). Application authors in

Re: [Haskell-cafe] Data.IArray rant

2011-09-06 Thread Jon Fairbairn
Roman Leshchinskiy r...@cse.unsw.edu.au writes: On 03/09/2011, at 03:04, Ivan Lazar Miljenovic wrote: On 3 September 2011 11:38, Evan Laforge qdun...@gmail.com wrote: The result is that my first contact with haskell arrays left me with the impression that they were complicated, hard to

[Haskell-cafe] xmonad on xkcd

2011-08-07 Thread Jon Fairbairn
http://xkcd.com/934/ (and look at the “hover text”) — so who’s going to implement it? -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] The Typeable class is changing

2011-07-12 Thread Jon Fairbairn
Carl Howells chowe...@janrain.com writes: This will affect snap-core and heist, of the things I've provided Typeable instances for. In snap-core, deriving makes it use the internal module name, rather than the canonical location of the type. This causes issues with the Hint library, so

Re: [Haskell-cafe] Comment Syntax

2011-06-05 Thread Jon Fairbairn
Albert Y. C. Lai tre...@vex.net writes: On 11-06-04 02:20 AM, Roman Cheplyaka wrote: It is, for my taste, a good comment marker, because of its resemblance to a dash. It makes the code look like real text: let y = x + 1 -- increment x COBOL is real text, if that is what you want. MOVE

Re: [Haskell-cafe] Comment Syntax

2011-06-04 Thread Jon Fairbairn
Roman Cheplyaka r...@ro-che.info writes: * Andrew Coppin andrewcop...@btinternet.com [2011-06-03 18:12:04+0100] On 03/06/2011 05:02 PM, Albert Y. C. Lai wrote: I propose that only {- -} is comment; that is, -- is an operator token and not a marker of comments. I'm curious to know why

[Haskell-cafe] Re: a simple question about types

2010-11-18 Thread Jon Fairbairn
Daniel Fischer daniel.is.fisc...@web.de writes: On Wednesday 17 November 2010 19:09:16, Jerzy M wrote: Hallo, let me take this simple function: (2*). If I check its type :t (2*) I'll obtain (2*) :: (Num a) = a - a But now it suffices to write g = (2*) and check :t g to obtain g

[Haskell-cafe] Catching up on Time and Directory

2010-11-16 Thread Jon Fairbairn
I'm probably terribly out of date with this, so I wonder if anyone can save me the bother of working out what the /preferred/ libraries are for (a) determining the last-modified-time of a file or directory and (b) manipulating the resulting time datum. I can find

[Haskell-cafe] Re: Mysterious fact

2010-11-03 Thread Jon Fairbairn
Lennart Augustsson lenn...@augustsson.net writes: Jon, you beat me to it. I was going to mention Ponder. Strange chance; yesterday was the first time I read haskell café for something like half a year. But Ponder did have a builtin type, it had the function type built in. :) Well, to use

[Haskell-cafe] Re: Mysterious fact

2010-11-02 Thread Jon Fairbairn
Andrew Coppin andrewcop...@btinternet.com writes: The other day, I accidentally came up with this: |{-# LANGUAGE RankNTypes #-} type Either x y= forall r. (x - r) - (y - r) - r left :: x - Either x y left x f g= f x right :: y - Either x y right y f g= g y | This is

[Haskell-cafe] Re: Function to find a substring

2010-06-08 Thread Jon Fairbairn
R J rj248...@hotmail.com writes: What's an elegant definition of a Haskell function that takes two strings and returns Nothing in case the first string isn't a substring of the first, or Just i, where i is the index number of the position within the first string where the second string

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Jon Fairbairn
Alexander Solla a...@2piix.com writes: On May 23, 2010, at 1:35 AM, Jon Fairbairn wrote: It seems to me relevant here, because one of the uses to which one might put the symmetry rule is to replace an expression “e1 == e2” with “e2 == e1”, which can turn a programme that terminates

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-23 Thread Jon Fairbairn
Alexander Solla a...@2piix.com writes: On May 22, 2010, at 1:32 AM, Jon Fairbairn wrote: Since Bool is a type, and all Haskell types include ⊥, you need to add conditions in your proofs to exclude it. Not really. Bottom isn't a value, so much as an expression for computations that don't

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-22 Thread Jon Fairbairn
R J rj248...@hotmail.com writes: I'm trying to prove that (==) is reflexive, symmetric, and transitive over the Bools, given this definition: (==):: Bool - Bool - Bool x == y = (x y) || (not x not y) Since Bool is a type, and all Haskell types include ⊥, you need to add conditions in

[Haskell-cafe] Re: Announcement: Data.ISO3166_CountryCodes version 0.1

2010-04-25 Thread Jon Fairbairn
John Millikin jmilli...@gmail.com writes: Thanks for the library! I'm sure it will be very useful for people dealing with internationalized applications / libraries. I have a few suggestions, which might make your library easier to use and maintain. First, it's very common to include

[Haskell-cafe] Re: The instability of Haskell libraries

2010-04-24 Thread Jon Fairbairn
John Goerzen jgoer...@complete.org writes: It is somewhat of a surprise to me that I'm making this post, given that there was a day when I thought Haskell was moving too slow ;-) My problem here is that it has become rather difficult to write software in Haskell that will still work with

[Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Jon Fairbairn
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Daryoush Mehrtash dmehrt...@gmail.com writes: Is there a way to persist a [IO ()] to say a file then retrieve it later and execute it using a sequence function? I'm not sure I understand what you're wanting... you can pass around

[Haskell-cafe] Re: Integers v ints

2010-04-02 Thread Jon Fairbairn
Jens Blanck jens.bla...@gmail.com writes: On 1 April 2010 10:53, Ivan Lazar Miljenovic ivan.miljeno...@gmail.comwrote: Jens Blanck jens.bla...@gmail.com writes: I was wondering if someone could give me some references to when and why the choice was made to default integral numerical

[Haskell-cafe] Re: Are there any female Haskellers?

2010-03-28 Thread Jon Fairbairn
Leon Smith leon.p.sm...@gmail.com writes: On Sat, Mar 27, 2010 at 1:56 PM, Jason Dagit da...@codersbase.com wrote:  For some reason it started out as a male dominated field.  Let's assume for cultural reasons.  Once it became a male dominated field, us males  unknowingly made the work and

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Jon Fairbairn
Daniel Fischer daniel.is.fisc...@web.de writes: Am Dienstag 15 Dezember 2009 03:04:43 schrieb Richard O'Keefe: On Dec 14, 2009, at 5:11 PM, Daniel Fischer wrote: 1. I wasn't playing in the under_score vs. camelCase game, just proposing a possible reason why the camelCase may have been

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-09 Thread Jon Fairbairn
Deniz Dogan deniz.a.m.do...@gmail.com writes: 2009/12/8 Jon Fairbairn jon.fairba...@cl.cam.ac.uk: Deniz Dogan deniz.a.m.do...@gmail.com writes: [...] allow hyphens in identifiers, much like in Lisp languages? E.g. hello-world would be a valid function name. I (among others) suggested

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-08 Thread Jon Fairbairn
Deniz Dogan deniz.a.m.do...@gmail.com writes: Has there been any serious suggestion or attempt to change the syntax of Haskell to allow hyphens in identifiers, much like in Lisp languages? E.g. hello-world would be a valid function name. I (among others) suggested it right at the beginning

[Haskell-cafe] Re: Fwd: Is () a 0-length tuple?

2009-11-08 Thread Jon Fairbairn
Pasqualino \Titto\ Assini tittoass...@gmail.com writes: The syntax is similar, but what else is? What would you expect from an empty tuple? (a,b,c) has a constructor function p3 a b c = (a,b,c) and three destructor functions s3_1 (a,b,c) = a, s3_2 (a,b,c) = b and s3_3 (a,b,c)=c (a,b) has a

[Haskell-cafe] Re: Curried function terminology

2009-10-06 Thread Jon Fairbairn
David Virebayre dav.vire+hask...@gmail.com writes: On Mon, Oct 5, 2009 at 11:52 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: [1] A pet peeve of mine is x supports y being used backwards (as in our application supports windows Vista, which would only make sense if it were something

[Haskell-cafe] Re: Curried function terminology

2009-10-05 Thread Jon Fairbairn
michael rice nowg...@yahoo.com writes: This is from Learn You A Haskell: == Curried functions Every function in Haskell officially only takes one parameter. So how is it possible that we defined and used several functions that take more than one parameter so far? Well, it's a

[Haskell-cafe] Re: Cabal packages - cabbages

2009-09-21 Thread Jon Fairbairn
Conor McBride co...@strictlypositive.org writes: On 20 Sep 2009, at 23:11, Jason Dusek wrote: Some day, we're going to need a short, catchy name for Cabal packages. Let's call them cabbages. Not that this is a good reason to change your mind, but some sufficiently ancient Brits may

[Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-18 Thread Jon Fairbairn
Ketil Malde ke...@malde.org writes: Gregory Propf gregorypr...@yahoo.com writes: Heh, perhaps we should petition to have a new computer key and symbol added to the world's way of writing maths, something like maybe a downward angled slash to mean prefix (-) Or just use 'negate' and

[Haskell-cafe] Re: Mapping over multiple values of a list at once?

2009-08-28 Thread Jon Fairbairn
Raynor Vliegendhart shinnon...@gmail.com writes: Just wondering, what should be the expected output be of something like mavg 4 [1..3]? [3%2] or []? [0%1, 1%4, 3%4, 3%2, 3%2, 5%4, 3%4, 0%1], of course ;-P -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk

[Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Jon Fairbairn
Colin Paul Adams co...@colina.demon.co.uk writes: Jon == Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: Jon darcs get --partial Jon http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/HTMLs Did you make any progress on this at Anglo-Haskell? Not really, owing to Microsoft site

[Haskell-cafe] ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-05 Thread Jon Fairbairn
A while ago I wrote this rather pedantic html library (it guarantees standards compliance via types, even down to the nesting restrictions). I announced it on the libraries list, but chronic fatigue gets in the way of following things up, so I haven't taken it any further until recently. And

[Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-05 Thread Jon Fairbairn
I wrote: You can get the whole thing with darcs get --partial http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/nHTMLs but that was a temporary url that I copied and pasted. The correct one: darcs get --partial http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/HTMLs And I

[Haskell-cafe] Re: Need feedback on my Haskell code

2009-07-29 Thread Jon Fairbairn
CK Kashyap ck_kash...@yahoo.com writes: line' (x1, y1) (x2, y2) deltax deltay ystep isSteep error | x1 == x2 = if isSteep then [(y1, x1)] else [(x1, y1)] | isSteep = (y1, x1) : line' (newX, newY) (x2, y2) deltax deltay ystep isSteep newError | otherwise = (x1, y1) :

[Haskell-cafe] Re: Adding a field to a data record

2009-07-29 Thread Jon Fairbairn
Henry Laxen nadine.and.he...@pobox.com writes: It seems to me this should be easy, but I can't quite figure out how to do it without a lot of typing. Here is the question: Suppose you have a data type like: Data Foo = Foo { a :: Int, b :: Int, ... many other fields ... y :: Int }

[Haskell-cafe] Re: Implicit concatenation in list comprehensions

2009-07-22 Thread Jon Fairbairn
Bulat Ziganshin bulat.zigans...@gmail.com writes: Hello Neil, Tuesday, July 21, 2009, 1:26:55 PM, you wrote:  ++ [ -i      | not (null (ghcOptSearchPath opts)) ]  ++ [ -i, dir | dir - ghcOptSearchPath opts ] Following the discussions, I now support this extension too - I keep seeing more

[Haskell-cafe] Re: was: Debugging methods for haskell structured data types the right way in haskell

2009-07-20 Thread Jon Fairbairn
Fernan Bolando fernanbola...@mailc.net writes: On Sun, Jul 19, 2009 at 7:40 AM, wren ng thorntonw...@freegeek.org wrote: Fernan Bolando wrote: The intention is z0 is a system parameter and database, it contains a set of info needed to define a particular simulation A single-constructor

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-18 Thread Jon Fairbairn
Henning Thielemann lemm...@henning-thielemann.de writes: On Thu, 16 Jul 2009, Fernan Bolando wrote: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index too large A good way to avoid such problems is to avoid partial functions at

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando fernanbola...@mailc.net writes: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index too large This is not very informative. It did not give me a hint which function was causing this. In C adding a few printf would have

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando fernanbola...@mailc.net writes: On Thu, Jul 16, 2009 at 4:10 PM, Jon Fairbairnjon.fairba...@cl.cam.ac.uk wrote: I wonder if your code has to use !! at all? I took a look at a random module from the above link, and (without making much attempt at understanding it), I'd guess

[Haskell-cafe] Re: Haskell Zippers on Wikibooks: teasing! :)

2009-07-15 Thread Jon Fairbairn
Matthias Görgens matthias.goerg...@googlemail.com writes: doesn't make much sense to me yet, although I suspect I can read the mu as a lambda on types? Not really. The mu has more to do with recursion. I'd say it's entirely to do with recursion. It's like the Y combinator (or fix) for

[Haskell-cafe] Re: ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-11 Thread Jon Fairbairn
Wolfgang Jeltsch g9ks1...@acme.softbase.org writes: Am Freitag, 10. Juli 2009 05:26 schrieb rocon...@theorem.ca: I find it amazing that you independently chose to spell colour with a `u'. It makes me feel better about my choice. I have to admit that it makes me unhappy. :-( Why do we use

[Haskell-cafe] Re: golf, predicate check function for MonadPlus

2009-07-07 Thread Jon Fairbairn
Dan Doel dan.d...@gmail.com writes: On Thursday 02 July 2009 6:36:09 am Jon Fairbairn wrote: check :: (MonadPlus m) = (a - Bool) - a - m a check p a | p a = return a | otherwise = mzero I've often noticed the need for a similar function in conjunction with unfoldr

[Haskell-cafe] golf, predicate check function for MonadPlus (was Re: How to read safely?)

2009-07-02 Thread Jon Fairbairn
Dan Doel dan.d...@gmail.com writes: There was talk of adding a readMaybe a while ago, but apparently it never happened. As it is, you can use reads, read s becomes: case reads s of [(a, rest)] | all isSpace rest - code using a _ - error case

[Haskell-cafe] Re: (fwd) Haskell logo fail

2009-06-18 Thread Jon Fairbairn
Jason Dusek jason.du...@gmail.com writes: Why don't we have a picture of a cool dinosaur instead? Something cool because the last heat of life went out of it 65 million years ago? -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk

[Haskell-cafe] Re: Haskell philosophy question

2009-05-17 Thread Jon Fairbairn
Vasili I. Galchin vigalc...@gmail.com writes: Hello, I am confused between Haskell as delineated in the Haskell Report VS ghc pragmas which extend Haskell beyond the Haskell Report. Pragmas are part of the report, and while I agree that using them for extensions is stretching the

[Haskell-cafe] Re: fromInteger for Lists

2009-05-02 Thread Jon Fairbairn
Henning Thielemann schlepp...@henning-thielemann.de writes: Paul Keir schrieb: There's nothing better than making a data type an instance of Num. In particular, fromInteger is a joy. But how about lists? http://www.haskell.org/haskellwiki/Num_instance_for_functions

[Haskell-cafe] Re: chr/ord?

2009-04-29 Thread Jon Fairbairn
Tim Wawrzynczak inforichl...@gmail.com writes: On Tue, Apr 28, 2009 at 8:08 PM, michael rice [1]nowg...@yahoo.com wrote: Hi, My Prelude docs must be out of date because chr and ord don't seem to be there. How do I access these functions? Michael, those functions are not in the

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-23 Thread Jon Fairbairn
Colin Paul Adams co...@colina.demon.co.uk writes: Lennart == Lennart Augustsson lenn...@augustsson.net writes: Lennart Of course, n+k will be missed by Haskell obfuscators. I Lennart mean, what will we do without (+) + 1 + 1 = (+) ? I think what would be missed would you be having

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) --first release

2009-04-23 Thread Jon Fairbairn
Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com writes: Jon Fairbairn wrote: But we can remove them in future language versions. The point I was trying to make at the beginning of this subthread was that implementations should follow the definition, because having a core language

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-23 Thread Jon Fairbairn
John A. De Goes j...@n-brain.net writes: That's absurd. You have no way to access private source code, so any decision on what features to exclude from future versions of Haskell must necessarily look at publicly accessible source code. This is all entirely beside the point. The question

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-22 Thread Jon Fairbairn
Miguel Mitrofanov miguelim...@yandex.ru writes: Well, the problem is that every implementor does choose a subset of standart to implement. That's what I'm complaining about. It's much worse in JavaScript - essential features working differently in Internet Explorer, Firefox, Opera, and

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-20 Thread Jon Fairbairn
Achim Schneider bars...@web.de writes: Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: a...@cs.uu.nl writes: Utrecht Haskell Compiler -- first release, version 1.0.0 The UHC team is happy to announce the first

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Jon Fairbairn
a...@cs.uu.nl writes: Utrecht Haskell Compiler -- first release, version 1.0.0 The UHC team is happy to announce the first public release of the Utrecht Haskell Compiler (UHC). UHC supports almost all Haskell98

[Haskell-cafe] Re: Learning Haskell

2009-03-24 Thread Jon Fairbairn
Tom.Amundsen tomamund...@gmail.com writes: How long did it take you to become proficient in Haskell? Something more than twenty years. By that, I mean - how long until you were just as comfortable with Haskell as you were with your strongest language at that time? Oh, Haskell was my

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

2009-03-21 Thread Jon Fairbairn
Warren Harris warrensomeb...@gmail.com writes: Hi Jon, I agree with much of your rant, and would agree that the logo is probably the least interesting about haskell, but I think that it's worth spending a little time to spiffy up haskell's image from a marketing perspective. I don't

[Haskell-cafe] Re: Query on list comprehension

2009-03-20 Thread Jon Fairbairn
Richard O'Keefe o...@cs.otago.ac.nz writes: The problem we were asked about was specifically a aa aaa The code (iterate ('a':) \n) does not give the right answer. It's not just that it produces an infinite list instead of three strings, it doesn't even start with the right

[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

[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)

  1   2   3   >