Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Daniel Fischer
On Monday 05 September 2011, 08:35:30, Alexander Dunlap wrote: On 4 September 2011 21:44, Mario Blažević blama...@acanac.net wrote: I was recently surprised to discover that the maximum and maximumBy functions always return the *last* maximum, while minimum and minimumBy return the

Re: [Haskell-cafe] bitSize

2011-08-29 Thread Daniel Fischer
On Monday 29 August 2011, 12:32:51, Maciej Marcin Piechotka wrote: On Fri, 2011-08-26 at 20:30 +0100, Andrew Coppin wrote: I suppose I could use a binary logarithm. I'm just concerned that it would be rather slow. After all, I'm not interested in the exact logarithm (which is fractional),

Re: [Haskell-cafe] GHCI Feature Request: Last SuccessfulCompilation State Saved

2011-08-28 Thread Daniel Fischer
On Sunday 28 August 2011, 20:43:11, Rene de Visser wrote: Daniel Fischer daniel.is.fisc...@googlemail.com schrieb im Newsbeitrag news:201108272331.01371.daniel.is.fisc...@googlemail.com... On Saturday 27 August 2011, 23:10:17, David Virebayre wrote: 2011/8/27 aditya siram aditya.si

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-28 Thread Daniel Fischer
On Monday 29 August 2011, 00:56:52, KC wrote: I just noticed that the 20x20 grid has some 00 entries; thus, time could be saved by not touching any of the grid entries 3 cells away. Same for the 01 entries. The challenge, of course, is in finding these entries in the first place. :)

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 02:34:24, Oscar Picasso wrote: Hi, I order to improve my Haskell skills I started (again) to solve the project euler problems with this language. I am now at problem 11 and would really appreciate any comment about my code in order to make it more elegant or

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Daniel Fischer
to display them. NoScript :) I allowed oscarpicasso.com, but didn't look far enough to allow github.com. On Sat, Aug 27, 2011 at 4:47 AM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Saturday 27 August 2011, 02:34:24, Oscar Picasso wrote: Hi, I order to improve my Haskell skills I

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 17:31:41, Oscar Picasso wrote: As a side note, my domain name is not oscarpicasso.com. It was already taken by someone else so I decided to use opicasso.com Oh, yeah, it was that I allowed, misremembered the domain name.

Re: [Haskell-cafe] Modules and a main function

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 22:24:03, michael rice wrote: I'm not sure how to do that. Please demonstrate. Michael ghc -O -main-is StateGame --make StateGame more generally, ghc -O -main-is Foo.bar --make Foo if the desired main is function bar in module Foo.

Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 23:10:17, David Virebayre wrote: 2011/8/27 aditya siram aditya.si...@gmail.com: Hi all, I would like for the GHCI interpreter to save its environment before reloading a file and allowed the user to revert back to that state if the compilation was unsuccessful.

Re: [Haskell-cafe] bitSize

2011-08-26 Thread Daniel Fischer
On Friday 26 August 2011, 19:24:37, Andrew Coppin wrote: On 26/08/2011 02:40 AM, Daniel Peebles wrote: And as Daniel mentioned earlier, it's not at all obvious what we mean by bits used when it comes to negative numbers. I guess part of the problem is that the documentation asserts that

[Haskell-cafe] RFC: decodeFloat

2011-08-26 Thread Daniel Fischer
Occasionally, the behaviour of decodeFloat and its consequences causes concern and/or bug reports (e.g. http://hackage.haskell.org/trac/ghc/ticket/3898). The main problem is the treatment of NaNs and infinities (that it doesn't distinguish between 0.0 and -0.0 is a minor thing), which are

Re: [Haskell-cafe] bitSize

2011-08-26 Thread Daniel Fischer
On Friday 26 August 2011, 21:30:02, Andrew Coppin wrote: You wouldn't want to know how many bits you need to store on disk to reliably recreate the value? Or how many bits of randomness you need to compute a value less than or equal to this one? I suppose I could use a binary logarithm.

Re: With every new GHC release, also released any new versions of libraries

2011-08-25 Thread Daniel Fischer
On Thursday 25 August 2011, 10:39:29, Johan Tibell wrote: P.S. Could someone please remind me why containers ships with GHC? Some other packages shipped with GHC depend on containers, e.g. hoopl, template-haskell, haskeline, binary. And via haskeline, ghci depends on containers too.

Re: [Haskell-cafe] bitSize

2011-08-25 Thread Daniel Fischer
On Thursday 25 August 2011, 19:57:37, Andrew Coppin wrote: Quoting the Haddock documentation for Data.Bits.bitSize: Return the number of bits in the type of the argument. The actual value of the argument is ignored. The function bitSize is undefined for types that do not have a fixed

Re: [Haskell-cafe] different results after compilation

2011-08-24 Thread Daniel Fischer
On Wednesday 24 August 2011, 14:45:19, Комар Максим wrote: I have some script: $ runhaskell readfile.hs fromList [(Merchant {nick = 01010, location = prontera, x = 184, y = 94},Shop {buy = ShopBuy {titleB = AB Green Salad=5k, itemsB = fromList [(Item {itemId = 12065, price = 5000, refine = ,

Re: [Haskell-cafe] Using - as both type and value constructor

2011-08-24 Thread Daniel Fischer
On Wednesday 24 August 2011, 20:24:14, Armando Blancas wrote: Studying the paper *A Simple Implementation for Priority Search Queues*, by Ralf Hinze, I came across the following syntax that I didn't understand and I couldn't use in GHCi 7.0.3 for defining a binding data type (page 3):

Re: [Haskell-cafe] how long could it wait for an account on hackageDB?

2011-08-23 Thread Daniel Fischer
On Tuesday 23 August 2011, 16:14:43, Qi Qi wrote: Hello all, I wanted to have an account on hackageDB to upload a package. I followed http://hackage.haskell.org/packages/accounts.html, and sent an email to r...@soi.city.ac.uk for asking an account. It's been a couple days that I haven't

Re: Can't find interface-file declaration for type constructor or class integer-gmp:GHC.Integer.Type.Integer

2011-08-18 Thread Daniel Fischer
On Thursday 18 August 2011, 19:13:45, Johan Tibell wrote: On Thu, Aug 18, 2011 at 7:07 PM, Simon Peyton-Jones simo...@microsoft.com wrote: | I shouldn't have to modify PrelNames since I kept GHC.Integer.Type, | no? Or does PrelNames have to contain the name of the module that |

Re: [Haskell-cafe] how to read CPU time vs wall time report from GHC?

2011-08-14 Thread Daniel Fischer
On Sunday 14 August 2011, 21:53:21, Iustin Pop wrote: On Sun, Aug 14, 2011 at 08:32:36PM +0200, Wishnu Prasetya wrote: On 14-8-2011 20:25, Iustin Pop wrote: On Sun, Aug 14, 2011 at 08:11:36PM +0200, Wishnu Prasetya wrote: Hi guys, I'm new in parallel programming with Haskell. I made a

Re: [Haskell-cafe] how to read CPU time vs wall time report from GHC?

2011-08-14 Thread Daniel Fischer
On Sunday 14 August 2011, 22:42:13, Wishnu Prasetya wrote: On 14-8-2011 22:17, Daniel Fischer wrote: We don't know the times for a non-threaded run (or an -N1 run), so it could be anything from a slowdown to a 4× speedup (but it's likely to be a speedup by a factor 4×). Well

Re: [Haskell-cafe] Array and Ix for custom Graph ADT

2011-08-13 Thread Daniel Fischer
On Sunday 14 August 2011, 00:41:33, Mark Spezzano wrote: Hi Antoine, The first Int field is a unique index, beginning at 1 and increasing by 1 for each unique Node. Then you could use that for indexing, assuming the Ord instance matches. range (MyNode x _ _ _, MyNode y _ _ _) = [x .. y]

Re: [Haskell-cafe] Additional functions of GMP

2011-08-11 Thread Daniel Fischer
On Thursday 11 August 2011, 14:06:21, Artyom Kazak wrote: GMP has a lot of functions, such as extracting roots, primality test, Legendre symbol, I'm writing a package (arithmoi) that will include reasonably fast implementations of those, but I never find the time to finish it :( factorial

Re: [Haskell-cafe] Analyzing slow performance of a Haskell program

2011-08-08 Thread Daniel Fischer
On Monday 08 August 2011, 18:24:45, Chris Yuen wrote: Where is the `unsafeAt` function? Data.Array.Base I can't seem to find it ( http://haskell.org/hoogle/?hoogle=unsafeat). Data.Array.Base is not haddocked (there's a reason for that), so hoogle doesn't know about its functions. For

Re: [Haskell-cafe] Analyzing slow performance of a Haskell program

2011-08-07 Thread Daniel Fischer
On Sunday 07 August 2011, 10:52:20, Max Bolingbroke wrote: In short I don't see how to get further without changing the algorithm or doing some hacks like manual unrolling. Maybe someone else has some ideas? Well, the C# implementation uses arrays for lookup while the Haskell version uses

Re: integer-simple

2011-07-29 Thread Daniel Fischer
On Friday 29 July 2011, 18:51:23, Chris Dornan wrote: Hi All, I am still having difficulty getting a plain GHC build with INTEGER_LIBRARY = integer-simple. (I outlined my problem here yesterday http://www.haskell.org/pipermail/glasgow-haskell-users/2011-July/020631 .htm l .) RHEL 5

Re: [Haskell-cafe] Binding of an integer variable

2011-07-28 Thread Daniel Fischer
On Thursday 28 July 2011, 20:43:30, Paul Reiners wrote: I have a question about the following GHCi interaction: Prelude let x = 23 Prelude :show bindings x :: Integer = _ What is the meaning of the underscore in the third line? Why doesn't it say this, instead? x :: Integer = 23

Re: [Haskell-cafe] Diagnose stack space overflow

2011-07-08 Thread Daniel Fischer
On Friday 08 July 2011, 11:29:40, Ketil Malde wrote: Max Bolingbroke batterseapo...@hotmail.com writes: Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize -RTS' to increase it. I want to find out the culprit function and rewrite it tail-recursively. Is there a way to

Re: Profile: zero total time

2011-07-07 Thread Daniel Fischer
On Thursday 07 July 2011, 20:44:57, Matthew Farkas-Dyck wrote: I am trying to take a profile of a program, but when I run it, the total time (as given in the profiling report file) is zero! If you're on a Mac, it could be http://hackage.haskell.org/trac/ghc/ticket/5282

Re: [Haskell-cafe] Searching of several substrings (with Data.Text ?)

2011-07-05 Thread Daniel Fischer
On Tuesday 05 July 2011, 20:01:26, Tillmann Vogt wrote: Hi, For my font library I need A function that can handle ligatures. It can be explained best with an example: f [Th, ff, fi, fl, ffi] The fluffiest bunny should be evaluated to [Th, e, , fl, u, ffi, e, s, t, , b, u, n, n,

Re: [Haskell-cafe] Strange context reduction with partial application and casting

2011-07-03 Thread Daniel Fischer
On Sunday 03 July 2011, 09:19:11, dm-list-haskell-c...@scs.stanford.edu wrote: At Sat, 2 Jul 2011 17:23:50 -0400, Brent Yorgey wrote: On Sat, Jul 02, 2011 at 09:02:13PM +0200, Daniel Fischer wrote: - disabling the monomorphism restriction :set -XNoMonomorphismRestriction

Re: [Haskell-cafe] video for linux two (v4l2) bindings

2011-07-03 Thread Daniel Fischer
On Sunday 03 July 2011, 21:34:17, Christopher Done wrote: I just had a quick try with cabal-install and got the below. I'm not sure where linux/posix_types is supposed to come from. Is this error obvious to you? glibc-devel or the equivalent package for your distro, I think.

Re: [Haskell-cafe] Strange context reduction with partial application and casting

2011-07-02 Thread Daniel Fischer
On Saturday 02 July 2011, 20:23:48, Wonchan Lee wrote: Hi cafe, I found some strange phenomenon when I was hanging around with GHCi. Please see the following interaction: GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Daniel Fischer
On Wednesday 29 June 2011, 10:22:20, Yitzchak Gale wrote: Ryan Ingram wrote: So this is definitely a GHC bug, but I think the problem is probably triggered by this line: instance Serializable a b = IResource a I don't think this is a valid instance declaration without a

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Daniel Fischer
On Wednesday 29 June 2011, 11:37:39, Yitzchak Gale wrote: So it's the derived Read instance in this context that is causing the problem. Here is a slightly smaller test case that triggers the bug: {-# LANGUAGE MultiParamTypeClasses, UndecidableInstances #-} module Bug where class A a

Re: GHC HEAD broken on OS X

2011-06-26 Thread Daniel Fischer
On Monday 27 June 2011, 05:52:42, austin seipp wrote: After doing a 'git pull origin master ./sync-all pull origin master', I get the following build failure when stage1 attempts to compile the RTS code: http://paste.debian.net/121097/ A quick glance at the errors seem to indicate this

Re: [Haskell] ~ type operator

2011-06-24 Thread Daniel Fischer
On Friday 24 June 2011, 10:26:42, Guy wrote: What does the ~ type operator mean? I've sometimes seen types such as (a ~ b) in error messages, but can't understand what GHC is trying to tell me. Type equality, (a ~ b) means that a and b are the same type (rather, that the compiler can prove

Testsuite failures and some easy fixes

2011-06-21 Thread Daniel Fischer
92dbf9a5b4516d27fc0d389f842e21b4d3df5e5e Mon Sep 17 00:00:00 2001 From: Daniel Fischer daniel.is.fisc...@googlemail.com Date: Tue, 21 Jun 2011 14:32:13 +0200 Subject: [PATCH 1/7] DatatypeContexts for tcrun006 --- tests/ghc-regress/typecheck/should_run/tcrun006.hs |5 +++-- 1 files changed, 3

Re: GHC and Haskell 98

2011-06-17 Thread Daniel Fischer
On Friday 17 June 2011, 17:11:39, Jacques Carette wrote: I favour Plan A. +1 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: URL for GHC 7.0.3

2011-06-15 Thread Daniel Fischer
On Wednesday 15 June 2011, 16:53:37, Antoine Latter wrote: Does this page help? http://www.haskell.org/ghc/download_ghc_7_0_3 Take care, Antoine I would, however, recommend going for the new http://www.haskell.org/ghc/download_ghc_7_0_4 which fixes a couple of bugs in 7.0.3

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Daniel Fischer
On Tuesday 14 June 2011, 14:35:19, Johannes Waldmann wrote: Dear all, I am very puzzled by a program that contains an else branch that is never executed, but still seems to slow down the program. (When I replace it by undefined, the resulting program runs much faster.)

Re: [Haskell-cafe] Dead else branch does influence runtime?

2011-06-14 Thread Daniel Fischer
On Tuesday 14 June 2011, 15:51:57, Daniel Fischer wrote: On Tuesday 14 June 2011, 14:35:19, Johannes Waldmann wrote: With id, main1 jumps to foldb_cap, which contains a lot of code for the (cap 1)-branch, and - that's what causes the slowdown - a worker loop $s$wfoldlM'_loop_s3EE [Occ

Re: [Haskell-cafe] GHC handles badly with math formulas

2011-06-13 Thread Daniel Fischer
On Monday 13 June 2011, 17:46:23, Grigory Sarnitskiy wrote: I've noted several times that GHC doesn't evaluate formulas for Double values during compilation. That is using 4.2326514735445615 instead of (512 / 0.844)**(1/3) or 0.906179845938664 instead of (1/3) * sqrt(5 + 2 * sqrt(10 / 7))

Re: [Haskell-cafe] Data.List / Map: simple serialization?

2011-06-10 Thread Daniel Fischer
On Friday 10 June 2011, 13:49:23, Dmitri O.Kondratiev wrote: On Thu, Jun 9, 2011 at 11:31 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: If you want plain text serialization, writeFile output.txt . show and fmap read (readFile output.txt) should suffice... Max This code

Re: [Haskell-cafe] Data.List / Map: simple serialization?

2011-06-10 Thread Daniel Fischer
On Friday 10 June 2011, 14:25:59, Dmitri O.Kondratiev wrote: Two questions: 1) Why to use 'fmap' at all if a complete file is read in a single line of text? Well, it's a matter of taste whether to write foo - fmap read (readFile bar) stuffWithFoo or text - readFile bar let

Re: [Haskell-cafe] Errors installing 'Haskell Charts'

2011-06-10 Thread Daniel Fischer
On Friday 10 June 2011, 17:51:34, Dmitri O.Kondratiev wrote: Configuring cairo-0.12.0... setup.exe: The program pkg-config version =0.9.0 is required but it could not be found. You need the (non-Haskell) programme pkg-config, you should be able to get it from e.g.

Re: [Haskell-cafe] Plug space leak with seq. How?

2011-06-09 Thread Daniel Fischer
On Thursday 09 June 2011, 18:09:44, Yves Parès wrote: Is it not: noLeak :: State Int () noLeak = do a - get ** * let a' = (a + 1) a' `seq` put a'* noLeak ?? Alternatively, noLeak = do a - get a `seq` put (a+1) noLeak or noLeak = do a - get put $! a+1

Re: [Haskell-cafe] Plug space leak with seq. How?

2011-06-09 Thread Daniel Fischer
On Thursday 09 June 2011, 18:41:40, Alexey Khudyakov wrote: On 09.06.2011 20:09, Yves Parès wrote: Is it not: noLeak :: State Int () noLeak = do a - get ** *let a' = (a + 1) a' `seq` put a'* noLeak ?? Indeed. Now I understand. It didn't work for me

Re: [Haskell-cafe] Are casts required?

2011-06-06 Thread Daniel Fischer
On Montag, 6. Juni 2011, 09:45, Patrick Browne wrote: Are casts required to run the code below? If so why? Thanks, Pat -- Idetifiers for objects class (Integral i) = IDs i where startId :: i newId :: i - i newId i = succ i sameId, notSameId :: i - i - Bool -- Assertion is not

Re: [Haskell-cafe] Are casts required?

2011-06-06 Thread Daniel Fischer
On Montag, 6. Juni 2011, 11:08, Ryan Ingram wrote: Hi Pat. There aren't any casts in that code. There are type annotations, but this is different than the idea of a cast like in C. For example ((3 :: Integer) :: Int) is a compile error. What you are seeing is that 3 has

Re: [Haskell-cafe] Comment Syntax

2011-06-06 Thread Daniel Fischer
On Montag, 6. Juni 2011, 19:08, Albert Y. C. Lai wrote: Bearing in mind that the characters that have been used to begin end of line comments include *, /, ;, !, #, %, and $, it's not clear that there's anything _that_ regrettable about -- . Recall that the problem is not with isolated

Re: [Haskell-cafe] Comment Syntax

2011-06-06 Thread Daniel Fischer
On Monday 06 June 2011, 19:51:44, Albert Y. C. Lai wrote: On 11-06-06 01:34 PM, Daniel Fischer wrote: On Montag, 6. Juni 2011, 19:08, Albert Y. C. Lai wrote: Recall that the problem is not with isolated characters, but whole strings. -- a is a comment, --a is a comment

Re: [Haskell-cafe] *GROUP HUG*

2011-06-02 Thread Daniel Fischer
On Thursday 02 June 2011 01:12:37, Tom Murphy wrote: How about this: myFoldr :: (a - b - b) - b - [a] - b myFoldr f z xs = foldl' (\s x v - s (x `f` v)) id xs $ z Cheers, Ivan Great! Now I really can say Come on! It's fun! I can write foldr with foldl! Unfortunately, you

Re: [Haskell-cafe] *GROUP HUG*

2011-06-01 Thread Daniel Fischer
On Wednesday 01 June 2011 12:25:06, Adrien Haxaire wrote: On Wed, 01 Jun 2011 11:46:36 +0200, Henning Thielemann wrote: Really, you can write foldr in terms of foldl? So far I was glad I could manage the opposite direction. i didn't try it, that was just an example of how

Re: [Haskell-cafe] How on Earth Do You Reason about Space?

2011-06-01 Thread Daniel Fischer
On Wednesday 01 June 2011 12:13:54, John Lato wrote: From: Brandon Moore brandon_m_mo...@yahoo.com I was worried data sharing might mean your keys retain entire 64K chunks of the input. However, it seems enumLines depends on the StringLike ByteString instance, which just converts

Re: [Haskell-cafe] How on Earth Do You Reason about Space?

2011-06-01 Thread Daniel Fischer
On Wednesday 01 June 2011 12:28:28, John Lato wrote: There are a few solutions to this. The first is to make a copy of the bytestring so only the required data is retained. In my experiments this wasn't helpful, but it would depend on your corpus. The second is to start with smaller chunks.

Re: testsuite, failures galore

2011-05-31 Thread Daniel Fischer
On Tuesday 31 May 2011 12:31:36, Simon Marlow wrote: The ticket has low priority, but if anybody has an idea how to check whether libbfd depends on libz in the configure script, I'd appreciate it. Could you install a shared version of libbfd? I have one, $ locate libbfd

Re: testsuite, failures galore

2011-05-31 Thread Daniel Fischer
On Tuesday 31 May 2011 14:44:58, Simon Marlow wrote: What you need is libbfd.so, which is a symbolic link to the versioned library (libbfd-2.20.0.20100122-6.so). This is normally installed by the development version of the library (e.g. libbfd-dev on Debian-derived distros). Couldn't find

Re: testsuite, failures galore

2011-05-31 Thread Daniel Fischer
On Tuesday 31 May 2011 16:04:28, Simon Marlow wrote: On 31/05/2011 14:53, Daniel Fischer wrote: Well, compiling and running a simple test programme that calls bfd_init() works here without linking in libz, so I guess that test wouldn't detect the dependency even if it actually runs

Re: testsuite, failures galore

2011-05-31 Thread Daniel Fischer
On Tuesday 31 May 2011 16:39:19, Donn Cave wrote: Quoth Daniel Fischer daniel.is.fisc...@googlemail.com, ... calling bfd_openr alone produces tons of undefined references, I've no idea what libraries I'd have to link with also :( Try -lbfd -liberty -lz ? Donn Thanks

Re: testsuite, failures galore

2011-05-31 Thread Daniel Fischer
b7170be4f9d62e695316a70435919cc2769334d1 Mon Sep 17 00:00:00 2001 From: Daniel Fischer daniel.is.fisc...@googlemail.com Date: Wed, 1 Jun 2011 03:42:11 +0200 Subject: [PATCH] new test for libbfd --- configure.ac |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index

Re: [Haskell-cafe] Lazy Evaluation in Monads

2011-05-31 Thread Daniel Fischer
On Tuesday 31 May 2011 22:35:26, Yves Parès wrote: He intended to show that, indeed, it is not, or else side-effects would never be performed On the other hand, IO is lazy in the values it produces. Going with the IO a = State RealWorld a fiction, IO is state-strict but value-lazy. The

testsuite, failures galore

2011-05-29 Thread Daniel Fischer
So my last testsuite run (validate --slow) with a new HEAD produced 651 unexpected failures :( Okay, the thing is that I forgot to add EXTRA_HC_OPTS=-optl-lz, see http://hackage.haskell.org/trac/ghc/ticket/3756 So, unless I miscounted, 611 of those were in way threaded1 due to: Linking

Re: [Haskell-cafe] Haskell School of Expression (graphics)

2011-05-29 Thread Daniel Fischer
On Sunday 29 May 2011 19:14:57, Andrew Coppin wrote: As far as I'm aware, the Haskell Platform doesn't come with any graphics-related packages I thought OpenGL was in the platform. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Please help with double recursion

2011-05-28 Thread Daniel Fischer
On Saturday 28 May 2011 13:47:10, Dmitri O.Kondratiev wrote: Hello, I am trying to solve a simple task, but got stuck with double recursion - for some reason not all list elements get processed. Please advice on a simple solution, using plane old recursion :) *** Task: From a sequence of

Re: [Haskell-cafe] Please help with double recursion

2011-05-28 Thread Daniel Fischer
On Saturday 28 May 2011 14:19:18, Dmitri O.Kondratiev wrote: Thanks for simple and beautiful code to get all pairs. Yet, I need to get to the next step - from all pairs to build all chains, to get as a result a list of lists: [[abcde, acde, ade, ae,] [bcde, bde, be,] [cde, cd, ce,] de]]

Re: New libraries process

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 10:19:51, Johan Tibell wrote: On Thu, May 26, 2011 at 9:37 AM, Simon Peyton-Jones simo...@microsoft.com wrote: Friends Thanks to those who responded to the message below, about improving the process for developing the core Haskell libraries.

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 13:24:09, michael rice wrote: How do I compile and run this parallel program? Michael === import Control.Parallel nfib :: Int - Int nfib n | n = 1 = 1 | otherwise = par n1 (seq n2 (n1 + n2 + 1)) The 'seq' here should be a 'pseq'

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 14:35:41, Neil Brown wrote: foo is the function we want to apply, and eg shows how to apply it in do-notation with an argument on each line. I couldn't manage to remove the r$ at the beginning of each line, which rather ruins the whole scheme :-( On the plus side,

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 17:22:10, Jonas Almström Duregård wrote: Unfortunately it does not play nice with $. Yes. Also I'm not sure this can be used for defining trees or nested function application since a nesting of the operator inevitably require parenthesis. It can't be nested, like ($)

Re: Proposal: Make gcd total

2011-05-25 Thread Daniel Fischer
On Wednesday 18 May 2011 03:57:06 I wrote: Following http://hackage.haskell.org/trac/haskell-prime/wiki/Process#Proposals I hereby volunteer to become the proposal owner. So, how's this going to continue? It sparked a renewed go at simplifying the libraries proposal process, but since it

Re: [Haskell-cafe] GHC 7, Platform 2011.2 vs OS X 10.5, Ubuntu 11.04

2011-05-23 Thread Daniel Fischer
On Monday 23 May 2011 14:16:43, Jacek Generowicz wrote: From this, you should be able to build 7.0.3 yourself. That's interesting. I won't try that *right* now. It's easy, assuming you have installed alex and happy (and preferably hscolour), just download and unpack the source bundle,

Re: [Haskell-cafe] GHC 7, Platform 2011.2 vs OS X 10.5, Ubuntu 11.04

2011-05-23 Thread Daniel Fischer
On Monday 23 May 2011 15:08:41, Jacek Generowicz wrote: On 2011 May 23, at 14:42, Daniel Fischer wrote: On Monday 23 May 2011 14:16:43, Jacek Generowicz wrote: If by cabal install you mean use the command cabal ... yeah, that would be great, if only I could install cabal-install, which

Re: [Haskell-cafe] ScopedTypeVariables in let-bindings (not where-bindings!) and bug 4347

2011-05-21 Thread Daniel Fischer
On Saturday 21 May 2011 14:55:54, Paolo G. Giarrusso wrote: However, it turns out that Prelude let id2 :: Int - Int = \x - x works but there's no way whatsoever to make the following work: Prelude let (id2 :: forall t. t - t) = \x - x Works without problems or extensions in the form Prelude

Re: [Haskell-cafe] ScopedTypeVariables in let-bindings (not where-bindings!) and bug 4347

2011-05-21 Thread Daniel Fischer
On Saturday 21 May 2011 16:17:53, Paolo G. Giarrusso wrote: Moreover, the proposed solution not always works. Neither of these work: let f :: x - x; g :: y - y; (f, g) = (id, id) let f :: x - x; g :: y - y; (f, g) = (f, g) Requires -XNoMonoPatBinds

Re: [Haskell-cafe] ScopedTypeVariables in let-bindings (not where-bindings!) and bug 4347

2011-05-21 Thread Daniel Fischer
On Saturday 21 May 2011 16:17:53, Paolo G. Giarrusso wrote: As I said, I'm convinced that the argument of let is a pattern, on which a signature is allowed, and GHC correctly understands that, so that this declaration work: let (id :: Int - Int) = \x - x I don't think that Prelude let a ::

Re: [Haskell-cafe] No fish, please

2011-05-19 Thread Daniel Fischer
On Thursday 19 May 2011 20:27:16, Andrew Coppin wrote: This is basically the reason I asked. Currently Cabal assumes that Haddock is the only tool of its kind. If somebody built a better Haddock, you wouldn't be able to use it. (Unless you named the executable haddock and made it accept

Re: [Haskell-cafe] Reverse Show instance

2011-05-19 Thread Daniel Fischer
On Thursday 19 May 2011 23:15:06, Andrew Coppin wrote: On 19/05/2011 10:11 PM, Artyom Kazak wrote: And I can declare an instance for (x, y) which does NOT implies (Show x): instance Show (x, y) where show _ = I'm tuple! Hooray! Ah. So it's a feature. Fortunately I refactored the

Re: [Haskell-cafe] No fish, please

2011-05-18 Thread Daniel Fischer
On Wednesday 18 May 2011 23:39:47, Andrew Coppin wrote: On 18/05/2011 05:28 AM, Don Stewart wrote: I'm intrigued by the idea of Hackage docs that don't use Haddock. This is basically the reason I asked. Currently Cabal assumes that Haddock is the only tool of its kind. If somebody built a

Re: [Haskell-cafe] ErrorT vs Either

2011-05-17 Thread Daniel Fischer
On Tuesday 17 May 2011 01:40:41, Gracjan Polak wrote: Daniel Fischer daniel.is.fischer at googlemail.com writes: On Monday 16 May 2011 23:41:44, Gracjan Polak wrote: Thanks Daniel, Yves and Edward for explanation. Two things come to my mind now. 1. It should be unified

Re: testsuite results

2011-05-16 Thread Daniel Fischer
Continuing with today's HEAD's results: 7506 expected passes 235 expected failures 0 unexpected passes 9 unexpected failures More failures than Friday, with fewer tests run (no profiling). But what's the actual difference? We have our old acquaintances T3064(normal)

Re: [Haskell-cafe] = definition for list monad in ghc

2011-05-16 Thread Daniel Fischer
On Monday 16 May 2011 11:07:15, Michael Vanier wrote: Usually in monad tutorials, the = operator for the list monad is defined as: m = k = concat (map k m) -- or concatMap k m but in the GHC sources it's defined as: m = k = foldr ((++) . k) [] m As far as I can tell, this

Re: [Haskell-cafe] = definition for list monad in ghc

2011-05-16 Thread Daniel Fischer
On Monday 16 May 2011 20:49:35, austin seipp wrote: Looking at the Core for an utterly trivial example (test x = concatMap k x where k i = [i..i*2]), the foldr definition seems to cause a little extra optimization rules to fire, but the result seems pretty big. The definition using concatMap

Re: [Haskell-cafe] = definition for list monad in ghc

2011-05-16 Thread Daniel Fischer
On Monday 16 May 2011 20:49:35, austin seipp wrote: As you can see, with the foldr definition, GHC is able to fuse the iteration of the input list with the generation of the result - note the 'GHC.Base.++' call with the first argument being a list from [x..x*2], and the second list to append

Re: [Haskell-cafe] = definition for list monad in ghc

2011-05-16 Thread Daniel Fischer
On Monday 16 May 2011 22:26:18, I wrote: On Monday 16 May 2011 20:49:35, austin seipp wrote: As you can see, with the foldr definition, GHC is able to fuse the iteration of the input list with the generation of the result - note the 'GHC.Base.++' call with the first argument being a list

Re: [Haskell-cafe] ErrorT vs Either

2011-05-16 Thread Daniel Fischer
On Monday 16 May 2011 23:05:22, Yves Parès wrote: Probably because in the instance of Monad Either, fail has not been overloaded, and still has its default implementation: fail = error Right. It used to be different in mtl-1.*, when there was an instance Error e = Monad (Either e) where

Re: [Haskell-cafe] ErrorT vs Either

2011-05-16 Thread Daniel Fischer
On Monday 16 May 2011 23:41:44, Gracjan Polak wrote: Thanks Daniel, Yves and Edward for explanation. Two things come to my mind now. 1. It should be unified. The (Either e) Monad instance was recently changed after people have long complained that there shouldn't be an (Error e) constraint.

Re: [Haskell-cafe] Exception for NaN

2011-05-16 Thread Daniel Fischer
On Tuesday 17 May 2011 00:22:02, Alexey Khudyakov wrote: On 16.05.2011 22:51, Casey McCann wrote: How so? Equality on floating point values other than NaN works just fine and behaves as expected. It's just that they violate all sorts of algebraic laws when arithmetic is involved so

Re: [Haskell-cafe] sort . nub (was Re: how to generate source code from TH Exp?)

2011-05-15 Thread Daniel Fischer
On Sunday 15 May 2011 15:32:03, Herbert Valerio Riedel wrote: On Thu, 2011-05-12 at 19:31 +0200, Daniel Fischer wrote: Minor nitpick: instead of doing 'sort . nub', please use 'import qualified Data.Set as S' and do 'S.toAscList . S.fromList'. This should be a lot faster. Or `map

Re: [Haskell-cafe] cannot install base-4.3.1.0 package

2011-05-15 Thread Daniel Fischer
On Sunday 15 May 2011 16:35:35, Immanuel Normann wrote: Hi, how can I install the base-4.3.1.0 package. I tried first No. That can't work (at least with GHC). The base package is one of the packages that the compiler was built with, it is impossible to replace it and have a working compiler

Re: Linking in Dead Code

2011-05-14 Thread Daniel Fischer
On Friday 13 May 2011 13:04:14, Guy wrote: If only 1% of an imported module is used, GHC will link in the entire module. With split-objs, as far as I know, GHC only links in what you use (plus the module initialiser). split-objs was disabled for some GHC/OS X combinations recently,

Re: Linking in Dead Code

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 21:06:50, Guy wrote: On 14/05/2011 21:12, Don Stewart wrote: When compiled with split objs GHC makes it possible for the linker to do dead code stripping. Make sure your GHC has split-objs on. Thank you, I hadn't realised that the imported library could be built

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Daniel Fischer
On Friday 13 May 2011 23:41:34, Casey McCann wrote: On Fri, May 13, 2011 at 4:48 PM, Luke Palmer lrpal...@gmail.com wrote: On Thu, May 12, 2011 at 5:50 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: Prelude Data.List maximum [0,-1,0/0,-5,-6,-3,0/0,-2] 0.0 Prelude

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 15:14:31, Ketil Malde wrote: Daniel Fischer daniel.is.fisc...@googlemail.com writes: Not having Eq and Ord instances for Double and Float would be extremely inconvenient (too inconvenient to seriously consider, I think), so one can a) do what's done now b) make

Re: [Haskell-cafe] Division: Is there a way to simultaneously find the quotient and remainder?

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 15:55:15, Henning Thielemann wrote: Chris Smith schrieb: Sure... see quotRem in the prelude. http://www.haskell.org/haskellwiki/Haskell_programming_tips#Forget_about _quot_and_rem No, don't, just know when you want which. quot and rem are what you get from the

Re: [Haskell-cafe] Is there an efficient way to generate Euler's totient function for [2, 3..n]?

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 19:38:03, KC wrote: Instead of finding the totient of one number, is there a quicker way when processing a sequence? For some sequences. For [1 .. n] (you asked about [2 .. n], but it may be better to include 1), it can efficiently be done, O(n*log log n), iirc.

testsuite results

2011-05-12 Thread Daniel Fischer
Running the testsuite with today's HEAD (perf build, but without profiling to keep time bearable) resulted in: OVERALL SUMMARY for test run started at Do 12. Mai 13:34:13 CEST 2011 2765 total tests, which gave rise to 9300 test cases, of which 0 caused

Re: testsuite results

2011-05-12 Thread Daniel Fischer
On Thursday 12 May 2011 17:49:16, Simon Peyton-Jones wrote: |hpc_markup_multi_001(normal) |hpc_markup_multi_002(normal) |hpc_markup_multi_003(normal) | | Unexpected passes: |mc01(hpc,ghci) |mc06(hpc,ghci) |mc08(hpc,ghci) |mc11(hpc) |mc16(hpc) |

Re: [Haskell-cafe] how to generate source code from TH Exp?

2011-05-12 Thread Daniel Fischer
On Thursday 12 May 2011 19:14:09, Felipe Almeida Lessa wrote: On Thu, May 12, 2011 at 2:04 PM, Stefan Kersten s...@k-hornz.de wrote: extractModules = sort . nub . everything (++) ([] `mkQ` f) where f (NameQ x) = [modString x] f (NameG _ _ x) = [modString x] f _ =

Re: [Haskell-cafe] Exception for NaN

2011-05-12 Thread Daniel Fischer
On Friday 13 May 2011 01:19:52, Ganesh Sittampalam wrote: On 12/05/2011 19:41, Nick Bowler wrote: On 2011-05-12 21:14 +0400, Grigory Sarnitskiy wrote: I don't want NaN to propagate, it is merely stupid, it should be terminated. NaN propagation is not stupid. Frequently, components of

Re: [Haskell-cafe] need help on building a huge graph

2011-05-11 Thread Daniel Fischer
On Wednesday 11 May 2011 09:25:05, Bin Jin wrote: sorry, it's 15 seconds. It's a typo It's less for me, something like 5.8s compiled without optimisations, 3.6s with -O2 (Pentium4, 3.06GHz). The overwhelming part of that is spent in GC: MUT time0.69s ( 0.73s elapsed) GCtime

<    1   2   3   4   5   6   7   8   9   10   >