Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-10 Thread Felipe Lessa
On Mon, Aug 10, 2009 at 03:24:36PM +0200, Ketil Malde wrote: > John Van Enk writes: > > EnumMap is a generalization of IntMap that constrains the key to Enum > > rather than forcing it to be Int. I have no idea what impact this has > > on performance, > > Will it have an impact on correctness? Th

Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-08 Thread Felipe Lessa
On Sat, Aug 08, 2009 at 04:14:15PM -0700, Thomas DuBuisson wrote: > There exists a small but measurable performance hit for at least one > test case (using Int as keys, obviously). Perhaps the bias would be > the other way if we were comparing EnumMap to an IntMap wrapped with > to/from Enum. Per

Re: [Haskell-cafe] Hugs faster and more reliable than GHC for large list monad 'do' block

2009-08-06 Thread Felipe Lessa
On Thu, Aug 06, 2009 at 04:25:07PM -0700, Dan Weston wrote: > > ghc --version > The Glorious Glasgow Haskell Compilation System, version 6.10.4 Confirmed on Gento amd64 with custom-built GHC from Haskell overlay: $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.10.4 $ u

Re: [Haskell-cafe] Request for Changelogs

2009-08-06 Thread Felipe Lessa
On Thu, Aug 06, 2009 at 04:27:56PM +0200, Joachim Breitner wrote: > And cabal/hackage guys: Llease introduce a standard Changes format for > cabal packages so that http://hackage.haskell.org/package/hlint readily > lists (or links to) changes. I second that! +1 -- Felipe.

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGL 2.3.0.0

2009-07-29 Thread Felipe Lessa
On Wed, Jul 29, 2009 at 10:24:23PM -0300, Rafael Gustavo da Cunha Pereira Pinto wrote: > mapAccumL was added to Data.Traversable in package base-4. GHC 6.8.2 uses > base-3... But this means that Tensor's dependencies should be on base >= 4, not 3. -- Felipe. _

[Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGL 2.3.0.0

2009-07-29 Thread Felipe Lessa
On Wed, Jul 29, 2009 at 06:26:30PM +0200, Sven Panne wrote: > Apart from that, a bug in vertexAttribPointer has been fixed. ...and the new ObjectName, StateVar and Tensor packages are being used, and this is great! Thanks for the release. -- Felipe. __

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

2009-07-28 Thread Felipe Lessa
Small tips: - Use swap and avoid those if's. - [a] ++ b is the same as a : b. - Factor out the first point that is always there. - Factor out line' arguments that don't change with the recursion. Untested: > swap :: Bool -> (a,a) -> (a,a) > swap False = id > swap True = \(x,y) -> (y,x) > > li

Re: [Haskell-cafe] powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-28 Thread Felipe Lessa
On Tue, Jul 28, 2009 at 10:58:53AM +0200, Sebastian Fischer wrote: > tails = dropWhileM (const [True,False]) Actually this should be tails = dropWhileM (const [False, True]) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://w

Re: [Haskell-cafe] A Question of Restriction

2009-07-26 Thread Felipe Lessa
On Sun, Jul 26, 2009 at 09:01:22PM -0700, Brian Troutwine wrote: > Hello all. > > I would like to define a data type that is the super-set of several > types and then each of the proper subset types. For example: > data Foo = O !Odd | E !Even >data Odd = One | Three >data Even = Two | Fou

Re: [Haskell-cafe] Memoized game-tree evaluation

2009-07-25 Thread Felipe Lessa
On Sat, Jul 25, 2009 at 10:08:20AM -0400, Matthew wrote: > I'm working on defining a data type for representing game-trees > for chess or other two-person board games. My plan is to > memoize the evaluations of a game-state at each depth so that > values don't need to be recomputed for future moves

Re: [Haskell-cafe] QuickCheck behaving strange

2009-07-24 Thread Felipe Lessa
On Fri, Jul 24, 2009 at 08:11:12PM +0200, Tobias Olausson wrote: > prop_schedule :: Ord t => [Interval a t] -> Bool > prop_schedule []= True > prop_schedule [a] = True > prop_schedule (x:y:ys) = end x <= begin y && prop_schedule (y:ys) [..] > How come QuickCheck passes 100 tests of r

Re: [Haskell-cafe] Generalizing takeWhile

2009-07-22 Thread Felipe Lessa
On Thu, Jul 23, 2009 at 07:28:55AM +0200, Matthias Görgens wrote: ] I often want to take one more element than takeWhile does, or only > takeWhileMore n p x | p x = Just . F $ takeWhileMore n p > | otherwise = Just . F $ takeN n ] start checking the predicate after takin

Re: [Haskell-cafe] Generalizing takeWhile

2009-07-22 Thread Felipe Lessa
On Wed, Jul 22, 2009 at 06:00:38PM +0200, Matthias Görgens wrote: ] I need to take some elements from the front of a list.  However the ] criteria are somewhat complex. ] ] > walk f [] = [] ] > walk f (x:xs) = case f x ] > of Just g -> x : walk g xs ] >Nothing ->

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

2009-07-21 Thread Felipe Lessa
On Tue, Jul 21, 2009 at 12:29:18PM -0700, Dan Weston wrote: > This would mean that > > [ | c ] = concat $ do { c; return [] } > > The right is legal Haskell and gives []. The left is (not yet) > legal. Should it be? Please, please, do not allow that. People wanting [] should write []. Thanks!

[Haskell-cafe] Re: [Haskell] TABI 0.1: a typeful tagged cross-language calling convention

2009-07-21 Thread Felipe Lessa
On Tue, Jul 21, 2009 at 08:11:47PM +0400, Bulat Ziganshin wrote: > if you have any specific needs, we can discuss it. my own needs is > mainly combination of first and third clauses of quoted list, so > second claim is somewhat artificial :) it is possible but only > partially implemented I was j

Re: [Haskell-cafe] ANN: cautious-file 0.1.1: Ways to write a file cautiously, to avoid data loss

2009-07-20 Thread Felipe Lessa
Nice library! On Sun, Jul 19, 2009 at 11:35:34PM +0100, Robin Green wrote: > A variant, writeFileWithBackup, also allows you to supply a custom > backup computation to backup old copy(ies) of the destination file It would be nice to have the backup action receive the file name as a parameter, so

Re: [Haskell-cafe] Plot data reconstruction reading pixel colors from image files

2009-07-17 Thread Felipe Lessa
On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote: > How can I open and read colors of specific pixels of an image file in > Haskell? Which packages, functions do you recommend? You could try DevIL, SDL-image or Gtk, I guess. -- Felipe. ___ Has

Re: [Haskell-cafe] Pattern matching does not work like this?

2009-07-15 Thread Felipe Lessa
On Wed, Jul 15, 2009 at 08:09:37AM -0400, Andrew Wagner wrote: > Err, technically, aren't functions and constructors mutually exclusive? So > if something is a function, it's, by definition, not a constructor? I guess what Eugene Kirpichov meant was that not being a function (and being a construct

Re: [Haskell-cafe] Circular pure data structures?

2009-07-14 Thread Felipe Lessa
On Wed, Jul 15, 2009 at 08:27:04AM +1000, John Ky wrote: > a :: Data > > let b = getNext a > let c = getNext b > > c == a -- Gives True What do you mean? This works type Data = () getNext = id but I guess this is not what you meant ;). -- Felipe.

[Haskell-cafe] Re: [Haskell] ANNOUNCE: StateVar 1.0.0.0

2009-07-14 Thread Felipe Lessa
On Tue, Jul 14, 2009 at 07:16:41PM +0200, Sven Panne wrote: > To further modularize the OpenGL/OpenAL packages, a new > StateVar package has been released to Hackage. It contains > state variables, which are references in the IO monad, like > IORefs or parts of the OpenGL state. That's just great,

Re: [Haskell-cafe] Documentation design

2009-07-05 Thread Felipe Lessa
I would also like some sort of "combo" mode for Hackage where the docs are shown the same way that they are now but with a link to "Internals" showing the view that you propose, perhaps showing only internals or highlighting them. Then we would be able to have the internal documentation on Hackage

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

2009-07-04 Thread Felipe Lessa
On Sat, Jul 04, 2009 at 06:56:44PM +0100, Andrew Coppin wrote: > http://hackage.haskell.org/package/AC-Colour-1.1.1 Why don't you use colour[1]? [1] http://hackage.haskell.org/package/colour -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell

Re: [Haskell-cafe] ANN: HalfInteger-1.1.1

2009-07-04 Thread Felipe Lessa
On Sat, Jul 04, 2009 at 12:37:21PM +0100, Andrew Coppin wrote: > It's on Hackage: > > http://hackage.haskell.org/package/AC-HalfInteger-1.1.1 > > It'll be interesting to see if I uploaded it right... o_O I guess you did, congrats! :) ...on the Haddock comments of halve and double, it should be

Re: [Haskell-cafe] Suggestions for simulating Object ID

2009-06-30 Thread Felipe Lessa
On Tue, Jun 30, 2009 at 07:57:07PM +0530, Hemanth Kapila wrote: > Can't we come up with something like this staying within the > limits of purity? No, because that would break referential transparency :(. I.e., it would be possible to distinguish things that should be "equal", such as '3' from '1

Re: [Haskell-cafe] Suggestions for simulating Object ID

2009-06-30 Thread Felipe Lessa
On Tue, Jun 30, 2009 at 03:25:26PM +0530, Hemanth Kapila wrote: > Can some one please suggest something on simulating some sort of > "object-Ids" in Haskell? Data.Unique[1]? [1] http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Unique.html -- Felipe.

Re: [Haskell-cafe] ANN: TernaryTrees-0.1.1.1 - An efficient ternary tree implementation of Sets and Maps

2009-06-29 Thread Felipe Lessa
On Tue, Jun 30, 2009 at 03:29:45AM +1000, Alex Mason wrote: > (being able to insert 230,000+ words, check that all those > words are actually in the set, write the set out to disk using > the Data.Binary instance, reading them back in, and checking > the old and new sets are equal takes about 3.5 s

Re: [Haskell-cafe] XMonad and NetworkManager?

2009-06-29 Thread Felipe Lessa
On Mon, Jun 29, 2009 at 01:28:47PM +0400, Alexey Khudyakov wrote: > I use wicd to manage wireless connections for about three month and > I'm pretty happy with it. It seems to be much saner than network manager. > Didn't any serious problems with it. I second that. I've gone away from NM because

Re: [Haskell-cafe] Re: test-framework success

2009-06-28 Thread Felipe Lessa
On Sun, Jun 28, 2009 at 11:07:27AM +0100, Max Bolingbroke wrote: > Awesome! I'm really glad to hear you are having success with the package! BTW, thanks for fixing the spacing issue with nested tests! :) -- Felipe. ___ Haskell-Cafe mailing list Haskell-

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Felipe Lessa
On Sun, Jun 28, 2009 at 02:24:30PM +0100, Andrew Coppin wrote: > Now, the question is... Is this useful enough to be worth putting on > Hackage? Why not? :) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailma

Re: [Haskell-cafe] "shadowing" keywords like "otherwise"

2009-06-28 Thread Felipe Lessa
On Sun, Jun 28, 2009 at 12:49:12AM -0700, Kim-Ee Yeoh wrote: > This isn't really a shadowing/redefinition issue. Here's > a perfectly legitimate snippet that compiles fine: > > f 0 = 0 > f otherwise = 1+otherwise What? It is a redefinition issue *as well*, but this kind of warning isn't active by

Re: [Haskell-cafe] Could FFI support pass-by-value of structs?

2009-06-23 Thread Felipe Lessa
On Tue, Jun 16, 2009 at 10:48:19AM -0300, Maurí­cio wrote: > /*/ > struct ex { > int x; > int y; > int z; > }; > > ex example_functions (ex p) > { > (...) > } > /*/ You may adopt the approach I used with Hipmunk[1] where there is a wrapper library written in C. For your exam

[Haskell-cafe] Re: [Haskell] ANN: Reusable Corecursive Queues via Continuations

2009-06-23 Thread Felipe Lessa
On Mon, Jun 22, 2009 at 10:31:34PM -0400, Leon Smith wrote: > Also, a substantially revised draft of the associated paper, "Lloyd > Allison's Corecursive Queues: Why Continuations Matter" is now available. > [3] This paper will appear in the upcoming Monad Reader issue 14, and > comments would

Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-22 Thread Felipe Lessa
On Tue, Jun 23, 2009 at 02:02:25AM +0200, Eric wrote: > It seems that an extension is required: > > Non type-variable argument in the constraint: MonadState [a] m > (Use -XFlexibleContexts to permit this) > In the type signature for `play3': > play3 :: (MonadState [a] m, Eq a) =>

Re: [Haskell-cafe] Wiki user accounts

2009-06-12 Thread Felipe Lessa
On Fri, Jun 12, 2009 at 07:53:41PM +0200, Thomas ten Cate wrote: > This runs on MediaWiki, right? How about adding a CAPTCHA for account > registrations? What do we avoid at all costs? ___ |___| -- Felipe.

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGLRaw 1.0.0.0

2009-06-11 Thread Felipe Lessa
On Thu, Jun 11, 2009 at 07:55:23PM +0200, Krzysztof Skrzętnicki wrote: > On my machine I get: > > $ glxinfo | grep -i version > server glx version string: 1.4 > client glx version string: 1.4 > GLX version: 1.3 > OpenGL version string: 3.0.0 NVIDIA 180.51 > OpenGL shading language version string: 1

[Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGLRaw 1.0.0.0

2009-06-11 Thread Felipe Lessa
On Thu, Jun 11, 2009 at 06:56:01PM +0200, Sven Panne wrote: > Version 1.0.0.0 covers the OpenGL 3.1 core, all ARB extensions > and all EXT extensions. What about OpenGL 2.1? As I understand, Linux won't have OpenGL 3.0 or 3.1 for at least some months, $ glxinfo | grep 'OpenGL version' OpenGL ver

Re: [Haskell-cafe] RE: Nested Lists

2009-06-04 Thread Felipe Lessa
On Thu, Jun 04, 2009 at 05:09:29PM +0100, Paul Keir wrote: > Thanks. I don't know Type Families, but take the point that > the input can be parameterised with something something other > than a list. i.e. (8 :+: 4 :+: 2 :+: ()) presumably has the > same type as (4 :+: 2 :+: ()). In fact, no. (4 :

Re: [Haskell-cafe] Nested Lists

2009-06-04 Thread Felipe Lessa
How about... *Main> bunch () [1..16] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] *Main> bunch (8 :+: ()) [1..16] [[1,2,3,4,5,6,7,8],[9,10,11,12,13,14,15,16]] *Main> bunch (8 :+: 4 :+: ()) [1..16] [[[1,2,3,4],[5,6,7,8]],[[9,10,11,12],[13,14,15,16]]] *Main> bunch (8 :+: 4 :+: 2 :+: ()) [1..16] 1,2]

[Haskell-cafe] HPC and derived instances

2009-05-30 Thread Felipe Lessa
Hello! Why isn't there an option to control whether HPC, the Haskell Program Coverage, will consider derived instances "coverable". I'm using it and my top level coverage is 52% while my expression coverage is at 92%. Looking carefully we see that most non-tested top level definitions are derived

Re: [Haskell-cafe] Haskell programmers in São Carlos - SP - Brazil?

2009-05-26 Thread Felipe Lessa
On Tue, May 26, 2009 at 12:42:12PM -0300, Andrei Formiga wrote: > I don't think there's one, but I would subscribe to it. I would as well, but what would we gain with it? Wouldn't it rot because every message one of us wanted to post was general enough to just post on haskell-cafe? Would it be a

Re: [Haskell-cafe] How i use GHC.Word.Word8 wit Int ?

2009-05-19 Thread Felipe Lessa
On Wed, May 20, 2009 at 08:40:15AM +0800, z_a...@163.com wrote: > I know "length [1..33]" is Int not Word8, but Word8 is enough here. Just saying '33' is enough here. :) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskel

Re: [HOpenGL] Re: [Haskell-cafe] Decoupling OpenAL/ALUT packages from OpenGL

2009-05-10 Thread Felipe Lessa
On Sun, May 10, 2009 at 01:50:08PM +0200, Sven Panne wrote: > Nevertheless, having a common set of (strict) data types for > vector math will probably be very useful, even if it won't > fulfill everybody's needs. I can say that it would be useful at least for Hipmunk, specially being able to pass

Re: [Haskell-cafe] applicative challenge

2009-05-04 Thread Felipe Lessa
On Mon, May 04, 2009 at 10:49:56PM +0100, Conor McBride wrote: > The effect of > > iffy askPresident launchMissiles seekUNResolution > > is to ask the President, then launch the missiles, then lobby the > UN, then decide that the result of seeking a UN resolution is > preferable. > > Remember fol

Re: [Haskell-cafe] ANN: Silkworm game

2009-05-03 Thread Felipe Lessa
On Sun, May 03, 2009 at 02:07:23PM +0200, Sven Panne wrote: > As a side note, I get a very bad feeling when Hipmunk gets compiled on my > x86_64 box: [...] > This can't be correct, but I'll probably have to take a look at that. Or is it > a know bug that Hipmunk ist not 64bit-clean? My machine is

Re: [Haskell-cafe] Combining computations

2009-05-03 Thread Felipe Lessa
I don't know if I understood your intentions, but let's go. The problem is that you're trying to combine different monads. We have mplus :: MonadPlus m => m a -> m a -> m a, so you never leave 'm', but you want mplus' :: ??? => n a -> m a -> m a where 'n' could be a different monad. In s

Re: [Haskell-cafe] ANN: Silkworm game

2009-05-02 Thread Felipe Lessa
Hi! On Sat, May 02, 2009 at 01:00:23PM -0600, Duane Johnson wrote: > Silkworm combines the Hipmunk binding to Chipmunk 2D Game > Dynamics with OpenGL, and GLFW (an alternative to GLUT). It's great to see Hipmunk being useful to someone :). I've written the binding to turn some of my ideas into c

Re: [Haskell-cafe] The essence of my monad confusion

2009-05-02 Thread Felipe Lessa
On Sat, May 02, 2009 at 05:31:03PM +0100, Paul Keir wrote: > An example immediately follows that quotation on the wiki: > > do text <- getLine >if null text > then putStrLn "You refuse to enter something?" > else putStrLn ("You entered " ++ text) Then, how about getMyLine = getL

Re: [Haskell-cafe] Generating random enums

2009-05-01 Thread Felipe Lessa
On Fri, May 01, 2009 at 01:08:26PM -0500, Thomas Hartman wrote: > For quickchecking, the code below "cheats" by not defining the > coarbitrary funciton, which I confess I don't really understand and > never use. FWIW, QuickCheck 2 separates 'coarbitrary' in a different class. -- Felipe. _

Re: [Haskell-cafe] Runge-Kutta and architectural style

2009-04-28 Thread Felipe Lessa
On Mon, Apr 27, 2009 at 04:34:27PM +1200, Richard O'Keefe wrote: > (5) A generator that generates native code to > be called through FFI. It may be interesting to see the LLVM package, it's pretty much straightforward to use it with numerical calculations. -- Felipe. _

Re: [Haskell-cafe] createProcess problem

2009-04-27 Thread Felipe Lessa
On Mon, Apr 27, 2009 at 06:00:52PM -0500, Vasili I. Galchin wrote: > I feel that it has something to do with double quotes in Haskell ... > probably something obviously silly that I am doing. The problem is that ["-p blastn"] means that there's only one argument, while ["-p", "blastn"] means what

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Felipe Lessa
On Sat, Apr 25, 2009 at 07:38:59PM +0400, Miguel Mitrofanov wrote: >> Also, I don't mistake the transformers as different >> parameters because of the parenthesis > > You should really try Lisp. In my opinion, parenthesis are a kind of > noise - too small, too many. I don't try lisp because I don'

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Felipe Lessa
On Sat, Apr 25, 2009 at 10:34:05AM -0400, Xiao-Yong Jin wrote: > You don't write lisp, do you? Or probably it is just me. > But I would prefer to write the line as > > newtype MyCoolMonad = MyCoolMonad (FirstTransformer >(SecondTransformer >

Re: [Haskell-cafe] Re: ANN: list-tries-0.0 - first release

2009-04-21 Thread Felipe Lessa
On Wed, Apr 22, 2009 at 12:29:05AM +0300, Matti Niemenmaa wrote: > Good to hear that it works for someone else, too. (I don't have a new > enough version of containers installed myself, after upgrading to > 6.10.2.) Just bear in mind that some functions won't work. What exactly don't work? What is

Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Felipe Lessa
On Thu, Apr 02, 2009 at 09:54:16PM +0300, Michael Snoyman wrote: > Interesting alternative. However, I think the ScopedTypeVariables looks a > little bit cleaner. I'll keep the asTypeOf in mind for the future though. That is a matter of taste. However 'asTypeOf' has a clear advantage: it is Haske

Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Felipe Lessa
On Thu, Apr 02, 2009 at 08:18:27PM +0200, Peter Verswyvelen wrote: > The type inferer seems to struggle to find the type of minBound and > maxBound, and GHC asks to use a type annotation. > To only way I see how to add a type annotation here is to use a GHC > extension: > > {-# LANGUAGE ScopedTypeV

Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Felipe Lessa
On Thu, Apr 02, 2009 at 11:53:00AM -0400, Jeff Heard wrote: > and so forth to be compatible with Bus [EData a], but I think that in > the end so many widgets will reuse the EData type that it's just as > well to make it part of the Event rather than force the user to be > explicit about it every ti

Re: [Haskell-cafe] Internationalization of Haskell code

2009-03-27 Thread Felipe Lessa
On Sat, Mar 28, 2009 at 12:20:04AM +0200, Vasyl Pasternak wrote: > In my blog http://progandprog.blogspot.com/2009/03/i18n-and-haskell.html, > I've described > process of internationalization Haskell programms using GNU GetText. I > wrote hgettext tool and > Text.I18N.GetText library to help with i

Re: [Haskell-cafe] Re: Sometimes I wish there was a global variable

2009-03-22 Thread Felipe Lessa
On Sun, Mar 22, 2009 at 08:10:28PM -0300, Rafael Cunha de Almeida wrote: > Doing it like that I could have all the definitions in one module, but > it doesn't solve another important problem: keyboardMouse and display > functions have to have as many parameters as there are IORefs. You may always

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-03-20 Thread Felipe Lessa
On Fri, Mar 20, 2009 at 07:42:28PM +0100, Nicolas Pouillard wrote: > We have good news (nevertheless we hope) for all the lazy guys standing there. > Since their birth, lazy IOs have been a great way to modularly leverage all > the > good things we have with *pure*, *lazy*, *Haskell* functions to

[Haskell-cafe] ANNOUNCE: dzen-utils 0.1

2009-03-15 Thread Felipe Lessa
Hello! I'm please to announce dzen-utils 0.1. I don't feel like it is ready to be released, but let's see how everything goes. :) == WHAT == dzen-utils contains various utilities for creating dzen input strings in a type-safe way using some combinators, including the ability to apply colors loca

Re: [Haskell-cafe] Parsing floating point numbers

2009-03-08 Thread Felipe Lessa
On Sun, Mar 8, 2009 at 9:34 PM, Bjorn Buckwalter wrote: > (For my current needs the formats accepted by "read" are sufficient, > but I want reasonable error handling (Maybe or Either) instead of an > exception on bad inputs.) Why not readM :: (Monad m, Read a) => String -> m a readM str = case [

Re: [Haskell-cafe] FRP + physics / status of hpysics

2009-03-07 Thread Felipe Lessa
2009/3/6 Peter Verswyvelen : > Do alternatives exist? Maybe good wrappers (hopefully pure...)  around > existing engines? There's Hipmunk, but it is not pure and not that good ;). But if you don't mess with the global variables (which you normally wouldn't mess anyway) then you can wrap everything

Re: [Haskell-cafe] Strict version of Data.Map.map

2009-02-26 Thread Felipe Lessa
On Thu, Feb 26, 2009 at 2:13 PM, Edsko de Vries wrote: > On Thu, Feb 26, 2009 at 12:45:09PM -0300, Felipe Lessa wrote: >> I'd advise you to see Control.Parallel.Strategies, specially the >> NFData class and the rnf function. > > What is the time complexity of running rnf

Re: [Haskell-cafe] Performance question

2009-02-26 Thread Felipe Lessa
2009/2/26 Tracy Wadleigh : > On Thu, Feb 26, 2009 at 7:17 AM, Lennart Augustsson > wrote: >> >> You can implement a reasonable split if you can fast-forward the >> generator. >> There's no known method to fast-forward the MT, but other generators >> like MRG32k3a can handle it. > > Are you aware o

Re: [Haskell-cafe] Strict version of Data.Map.map

2009-02-26 Thread Felipe Lessa
I'd advise you to see Control.Parallel.Strategies, specially the NFData class and the rnf function. HTH, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Performance question

2009-02-26 Thread Felipe Lessa
On Thu, Feb 26, 2009 at 7:56 AM, Eugene Kirpichov wrote: > Here is a variant that uses mersenne-random-pure64 and works less than > 2x slower than C++: And I would like to notice that rand() is incredibly dumber than the Mersenne twister, so probably if we took rand()'s code from glibc and rewrot

Re: [Haskell-cafe] Data.Binary, strict reading

2009-02-25 Thread Felipe Lessa
On Wed, Feb 25, 2009 at 2:15 PM, Neil Mitchell wrote: >        src <- decodeFile "_make/_make" >        Map.size mp `seq` performGC Shouldn't you use rnf[1]? Also, there seems to be binary-strict on Hackage, but I don't know if it is being maintained anymore. HTH, [1] http://www.haskell.org/gh

Re: [Haskell-cafe] Data.Binary poor read performance

2009-02-24 Thread Felipe Lessa
On Tue, Feb 24, 2009 at 7:42 PM, jutaro wrote: > instance Eq Object where >    (ObjC a) ≡ (ObjC b) = if typeOf a ≠ typeOf b >                                then False >                                else (Just a) ≡ cast b -- can someone explain > to me why this works? In fact, can't you just s

Re: [Haskell-cafe] Cabal: local documentation

2009-02-24 Thread Felipe Lessa
Just pass '--enable-documentation' to 'cabal install'. On *nix they're generated at ~/.cabal/share/doc. HTH, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Pickling a finite map (Binary + zlib) [was: [Haskell-cafe] Data.Binary poor read performance]

2009-02-24 Thread Felipe Lessa
On Tue, Feb 24, 2009 at 5:36 AM, Don Stewart wrote: > This idea was the motivation for the new Seq instance, which uses > internals to build quickly. The problem is that fromDistinctAscList is the best we can do right now. We don't have something like (|>) that runs in O(1) time, and trying to in

Re: Pickling a finite map (Binary + zlib) [was: [Haskell-cafe] Data.Binary poor read performance]

2009-02-24 Thread Felipe Lessa
On Tue, Feb 24, 2009 at 4:59 AM, Don Stewart wrote: > Looks like the Map reading/showing via association lists could do with > further work. > > Anyone want to dig around in the Map instance? (There's also some patches for > an alternative lazy Map serialisation, if people are keen to load maps --

Re: [Haskell-cafe] advancePtr for ForeignPtr

2009-02-23 Thread Felipe Lessa
On Mon, Feb 23, 2009 at 10:12 AM, Henning Thielemann wrote: > Is still someone on haskell.org ? Sorry, I don't know :). > I want to have an advancePtr on ForeignPtr in order create a subarray. > Is this reasonable and possible? I don't think so. For example, http://www.haskell.org/ghc/docs/late

Re: [Haskell-cafe] Error on instance of Control.Exception.Exception

2009-02-22 Thread Felipe Lessa
On Sun, Feb 22, 2009 at 9:41 PM, Maurí­cio wrote: > www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html These are the docs for the latest GHC version. > Type constructor `Exception' used as a class > In the instance declaration for `Exception DbError' What GHC version do

Re: [Haskell-cafe] Stacking StateTs

2009-02-22 Thread Felipe Lessa
On Sun, Feb 22, 2009 at 3:17 PM, Daniel Fischer wrote: > test5b :: (Monad (StateT [Char] (StateT s m)), > MonadState s (StateT s m), > Num s, > Monad m) => > m s Doesn't 'Monad m' imply 'MonadState s (StateT s m)' which implies 'Monad (StateT s m)' which imp

[Haskell-cafe] Re: [Haskell] ANNOUNCE: X Haskell Bindings 0.2

2009-02-21 Thread Felipe Lessa
On Sun, Feb 22, 2009 at 2:08 AM, Antoine Latter wrote: > The goal of XHB is to provide a Haskell implementation of the X11 wire > protocol, similar in spirit to the X protocol C-language Binding > (XCB). [snip] > Related projects: > > X C Bindings: http://xcb.freedesktop.org/ I wonder how XHB is

Re: [Haskell-cafe] Array use breaks when I make it unboxed?

2009-02-21 Thread Felipe Lessa
On Sat, Feb 21, 2009 at 10:26 PM, Phil wrote: > Thanks for the tip - I got it to work using: > > a :: UArray Int Double > > And so on. That's nice. I should have noted as well that you may say just a, b, c, d :: UArray Int Double or, even better, type DataArray = UArray Int Double a, b, c

Re: [Haskell-cafe] Array use breaks when I make it unboxed?

2009-02-21 Thread Felipe Lessa
2009/2/21 Phil : > InverseNormal.hs:28:38: > No instance for (IArray a1 Double) > arising from a use of `!' at InverseNormal.hs:28:38-40 > Possible fix: add an instance declaration for (IArray a1 Double) > In the first argument of `(*)', namely `c ! 1' > In the first argument

Re: [Haskell-cafe] Showing >100% CPU usage of parallel code

2009-02-21 Thread Felipe Lessa
On Sat, Feb 21, 2009 at 12:17 PM, Jim Burton wrote: > $ time ./Par +RTS -N2 > 1405006117752879898543142606244511569936384005711076 > 1.504 real,2.316 user,0.016 sys, 100.00 cpu I don't know why it is only 100%, but you can see that the user time is greater than real time, so everything is working

Re: Re[2]: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Felipe Lessa
Hey guys, what about the LLVM bindings? They seem nice for tight loops this one. -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] StableFunPtr?

2009-02-17 Thread Felipe Lessa
On Tue, Feb 17, 2009 at 7:07 AM, Maurí­cio wrote: > Are all FunPtrs stable? Yes, because you are forced to call freeHaskellFunPtr when you don't need them anymore. -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.or

Re: [Haskell-cafe] ANN: The Typeclassopedia, and request for feedback

2009-02-16 Thread Felipe Lessa
On Mon, Feb 16, 2009 at 11:53 AM, Daniel Fischer wrote: > Hah, seems I'm the first to point out a flaw in it: > > Bottom of page 13: > "Also, note that although _ >> m = m would be a type-correct implementation > of (>>), it" > The remainder of the sentence is missing. Sorry, I've already reporte

Re: [Haskell-cafe] Re: permuting a list

2009-02-15 Thread Felipe Lessa
On Sun, Feb 15, 2009 at 9:47 AM, Heinrich Apfelmus wrote: > It's fair, but may duplicate elements, i.e. it doesn't necessarily > create a permutation. For example, rs could be something like > > rs = [5,3,3,3,2,4] > But our sort doesn't discard values when the keys are the same. For example,

Re: [Haskell-cafe] Amazing

2009-02-14 Thread Felipe Lessa
As this topic popped out, my secrets for programming in Haskell are three words: assert, HUnit, QuickCheck. - Create internal functions that verify the results of the exported ones, or maybe an easier to verify implementation that is slower, and put them on assert's. This has saved me a few times.

Re: [Haskell-cafe] Re: space leak with 'concat' ?

2009-02-14 Thread Felipe Lessa
On Sat, Feb 14, 2009 at 3:18 PM, Peter Verswyvelen wrote: > Do you think this is something to report as a bug to Microsoft? > But this is a bit off topic in Haskell Cafe :-) I don't know how MS treats bug reports, but if you can make a small test case, then you should. It would also be nice to do

[Haskell-cafe] HaskellDB is alive?

2009-02-14 Thread Felipe Lessa
Hello! There was a new HaskellDB release, but I didn't see any announcement here. Is it back alive? What happened to 0.11? Thanks =) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: space leak with 'concat' ?

2009-02-12 Thread Felipe Lessa
2009/2/12 Peter Verswyvelen : > It is funny that recently I had a strange problem in C# (I tried to write > parts of Reactive in C#) where the garbage collector freed data that was > actually needed by my program! I had to fix that by putting a local variable > on the stack, passing the constructed

Re: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009

2009-02-12 Thread Felipe Lessa
2009/2/12 Matthew Elder : > would love to see this. > > basic features first i suppose. here are some of my ideas: meld-like diff view would be great too. http://meld.sourceforge.net/ -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org ht

Re: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009

2009-02-11 Thread Felipe Lessa
Do we already have enough information to turn http://okmij.org/ftp/Haskell/Iteratee/ into a nice, generic, cabalized package? I think Iteratees may prove themselves as useful as ByteStrings. -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.

Re: [Haskell-cafe] GLUT (glutGet undefined reference)

2009-01-19 Thread Felipe Lessa
2009/1/19 Paul Keir : > I was hoping to introduce my old pal OpenGL > with my new chum, Haskell. I used cabal to > install GLUT on my 64-bit Ubuntu machine with > GHC 6.8.2 (installed via apt-get/synaptic). I'm sorry, I can't help you with your problem. But I'd recommend you using GLFW, it's a lot

Re: [Haskell-cafe] Generalized partial application (again)

2009-01-12 Thread Felipe Lessa
How about using "let"s? 2009/1/12 Peter Verswyvelen : > e = trace "e" > op = (+) > a1 = let f = (op (e 1)) in (f 10, f 100) > a2 = let f = (\x -> op (e 1) x) in (f 10, f 100) > a1 and a2 are operationally not the same: a1 will evaluate (e 1) once, a2 a3 = let f = (let y = e 1 in (\x -> op y x)) i

Re: Re[2]: [Haskell-cafe] Re: [Haskell] ANN: HLint 1.0

2008-12-20 Thread Felipe Lessa
On Sat, Dec 20, 2008 at 12:28 PM, Bulat Ziganshin wrote: > Saturday, December 20, 2008, 4:38:10 PM, you wrote: >> Why not: >> (4 == length "TAG ") && ("TAG " `isPrefixOf` just_name pinfo) > >> I assume the (==) referred to in the name of the fix is the one in the >> suggestion. Why doesn't the sug

Re: [Haskell-cafe] forkIO on multicore

2008-12-19 Thread Felipe Lessa
On Fri, Dec 19, 2008 at 3:16 PM, Paul Keir wrote: > can I not expect each thread to run on a separate core? Try moving 'fibs' inside 'heavyTask', like heavytask m = putMVar m $! (let fibs = 0 : 1 : zipWith (+) fibs (tail fibs) in (fibs !! 10)) Maybe this may trick the compiler into not shar

Re: [Haskell-cafe] forkIO on multicore

2008-12-19 Thread Felipe Lessa
On Fri, Dec 19, 2008 at 2:27 PM, Paul Keir wrote: > I'm seeing no performance increase with a simple coarse-grained > 2-thread code using Control.Concurrent. I compile with: I didn't test your code, but [...] > fibs = 0 : 1 : zipWith (+) fibs (tail fibs) > heavytask m = putMVar m (fibs !! 10

Re: [Haskell-cafe] Logos of Other Languages

2008-12-19 Thread Felipe Lessa
On Fri, Dec 19, 2008 at 11:00 AM, Ketil Malde wrote: > I agree with this, but would also add that referring to foundations, history > or > theory (lambda) is better than referring to syntax (>>). I don't know > if it was proposed as a serious option, but I quite like the idea of using > _|_ as a

Re: [Haskell-cafe] How to think about this? (profiling)

2008-12-16 Thread Felipe Lessa
2008/12/16 Magnus Therning : > That is, where each value depends on _all_ preceding values. AFAIK > list access is linear, is there a type that is a more suitable state > for this changed problem? > > I realise this particular function can be written using scanl: [...] > but I guess it's not alway

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-28 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 6:15 PM, Bart Massey <[EMAIL PROTECTED]> wrote: > BTW, in case anyone is unclear, IEEE 854 supports a large > variety of required and optional rounding modes; it takes no > strong position on a "correct" rounding strategy. In > particular, round-up ("round-half-up") and roun

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 10:20 AM, Achim Schneider <[EMAIL PROTECTED]> wrote: > Hmmm... I'm wondering whether there's a standard C way to set the > rounding direction. nearbyint() and rint() may be used, and the rounding mode can be set by fesetround(). IIRC, this is C99. -- Felipe. _

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 8:30 AM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: > Well, of course I did not learn to round to odd. I learned to round .5 > to above, but not to do repeated rounding. Nobody rounds in passes, of course =). I was talking about two successive rounds. > In fact, by your

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Felipe Lessa
(Janis, sorry for e-mailiing just for you on the first time.) On Mon, Oct 27, 2008 at 8:15 AM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: > That is of course true (and was the topic of heated discussion with my > fourth grade math teacher), but does not explain 2.5 -> 2. If you round to odd in

Re: [Haskell-cafe] Re: External Sort: Sort a 10-million integer file with just 256M of ram.

2008-10-27 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 6:47 AM, Achim Schneider <[EMAIL PROTECTED]> wrote: > Don't you slam pointless style! main = mapM_ (($ [1..10^8::Int]) . (.) (putStrLn . show)) [last, head] =) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org h

<    1   2   3   4   5   >