Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-23 Thread Isaac Dupree
On 12/23/10 16:43, Mario Blažević wrote: Cofunctor and Comonad IMHO, as you say, there is only one design of cofunctor. class Cofunctor cf where cofmap :: (a - b) - cf b - cf a The only question is capitalization and spelling.* Since there are multiple designs of Comonad floating around,

Re: [Haskell-cafe] Functor = Applicative = Monad

2010-12-14 Thread Isaac Dupree
On 12/14/10 03:13, John Smith wrote: I would like to formally propose that Monad become a subclass of Applicative, with a call for consensus by 1 February. The change is described on the wiki at http://haskell.org/haskellwiki/Functor-Applicative-Monad_Proposal, That page isn't written as a

[Haskell-cafe] Re: Rewriting a famous library and using the same name: pros and cons

2010-06-08 Thread Isaac Dupree
On 06/08/10 11:08, Don Stewart wrote: Are there any other arguments I'm missing? Also parsec3 had an issue as an upgrade that it was slower at runtime (at least for a few years). (and some people were using parsec in the real world for performance-critical applications.) -Isaac

Re: [Haskell-cafe] Re: Proposal to solve Haskell's MPTC dilemma

2010-05-29 Thread Isaac Dupree
On 05/29/10 21:24, Carlos Camarao wrote: The situation is as if we a FD: Well, that is indeed equivalent here in the second argument of class F, but I constructed the example to show an issue in the class's *first* argument. Notice you needed to add type-signatures, on the functions you

[Haskell-cafe] Re: Proposal to solve Haskell's MPTC dilemma

2010-05-27 Thread Isaac Dupree
On 05/27/10 17:42, Carlos Camarao wrote: On Thu, May 27, 2010 at 5:43 PM, David Menendezd...@zednenem.com wrote: On Thu, May 27, 2010 at 10:39 AM, Carlos Camarao carlos.cama...@gmail.com wrote: Isaac Dupree: Your proposal appears to allow /incoherent/ instance selection. This means

[Haskell-cafe] Re: Proposal to solve Haskell's MPTC dilemma

2010-05-26 Thread Isaac Dupree
On 05/26/10 15:42, Carlos Camarao wrote: What do you think? I think you are proposing using the current set of instances in scope in order to remove ambiguity. Am I right? ..I read the haskell-cafe thread so far, and it looks like I'm right. This is what I'll add to what's been said so

Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-20 Thread Isaac Dupree
On 04/20/10 06:56, Simon Marlow wrote: On 09/04/2010 12:14, Bertram Felgenhauer wrote: Simon Marlow wrote: On 09/04/2010 09:40, Bertram Felgenhauer wrote: timeout t io = mask $ \restore - do result- newEmptyMVar tid- forkIO $ restore (io= putMVar result) threadDelay t `onException` killThread

[Haskell-cafe] Re: Move MonadIO to base

2010-04-19 Thread Isaac Dupree
On 04/19/10 02:15, Anders Kaseorg wrote: I would be very happy to get the simpler interface to work, because it’s Haskell 98. However, if I write joinIO m = morphIO (\w - m= w) morphIO' f = joinIO (f return) and define catch using morphIO' instead of morphIO: m `catch` h =

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-08 Thread Isaac Dupree
On 04/08/10 04:23, Simon Marlow wrote: On 07/04/2010 18:54, Isaac Dupree wrote: On 04/07/10 11:12, Simon Marlow wrote: It's possible to mis-use the API, e.g. getUnmask = mask return ...incidentally, unmask a = mask (\restore - return restore) = (\restore - restore a) That doesn't work

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-08 Thread Isaac Dupree
On 04/07/10 17:50, Simon Marlow wrote: On 07/04/10 21:23, Bas van Dijk wrote: On Wed, Apr 7, 2010 at 5:12 PM, Simon Marlowmarlo...@gmail.com wrote: Comments? I really like this design. One question, are you planning to write the MVar utility functions using 'mask' or using

Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-08 Thread Isaac Dupree
On 04/08/10 19:56, Bas van Dijk wrote: Control.Concurrent.Thread.fork is a similar and simpler example of why nonInterruptibleMask is needed: http://hackage.haskell.org/packages/archive/threads/0.1/doc/html/src/Control-Concurrent-Thread.html#fork If an asynchronous exception is thrown during

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-07 Thread Isaac Dupree
On 04/07/10 11:12, Simon Marlow wrote: It's possible to mis-use the API, e.g. getUnmask = mask return ...incidentally, unmask a = mask (\restore - return restore) = (\restore - restore a) mask :: ((IO a - IO a) - IO b) - IO b It needs to be :: ((forall a. IO a - IO a) - IO b) - IO b so

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-26 Thread Isaac Dupree
On 03/25/10 12:36, Simon Marlow wrote: I'd also be amenable to having block/unblock count nesting levels instead, I don't think it would be too hard to implement and it wouldn't require any changes at the library level. Wasn't there a reason that it didn't nest? I think it was that operations

[Haskell-cafe] Documentation design

2009-07-05 Thread Isaac Dupree
(for reference, here's the blog-post I wrote that inspired me to ask this list for advice. I'll explain everything in this email anyway though. http://haddock2009.wordpress.com/2009/06/23/how-to-navigate-your-code/ ) My challenge: getting to know an existing code-base quickly and easily, so

Re: [Haskell-cafe] Definition of tail recursive wrt Folds

2009-03-28 Thread Isaac Dupree
Tillmann Rendel wrote: Now consider a variant: if' a b c = if a then b else c variant x = if' (p x) (f x) (g x) I would say that if' has the same operational behavior as an if-then-else expressions, and therefore, (f x) and (g x) are still tail cails, even if they now appear in the

[Haskell-cafe] Re: Haddock GSoC project

2009-03-27 Thread Isaac Dupree
Okay, I've written a draft Haddock-GSOC application: would any of you like to review it / suggest how it could be improved? (or should I just submit it to Google?) I'm particularly wondering whether my proposed time-line seems realistic. -Isaac * What is the goal of the project you

[Haskell-cafe] Haddock GSoC project

2009-03-25 Thread Isaac Dupree
I'm interested in being a GSoC student, and the Haddock-related tickets looked like a good place to start http://hackage.haskell.org/trac/summer-of-code/ticket/1567 http://hackage.haskell.org/trac/summer-of-code/ticket/1568 http://hackage.haskell.org/trac/summer-of-code/ticket/1569 ... haddock

[Haskell-cafe] Re: Haddock GSoC project

2009-03-25 Thread Isaac Dupree
Simon Marlow wrote: Obviously I think these tickets are important, since I wrote them :-) In terms of priority, I think #1567 is at the top: not having this harms our ability to reorganise and abstract things, it puts an arbitrary barrier between packages. It's possible my perspective is

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

2009-02-16 Thread Isaac Dupree
Natural numbers under min don't form a monoid, only naturals under max do (so you can have a zero element) Brent Yorgey wrote: Hi all, If you've noticed the lack of a HWN this week, that's because I've been doggedly finishing my article entitled 'The Typeclassopedia', which I have just

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

2009-02-16 Thread Isaac Dupree
I'm really confused that when I replied (not reply-to-all, not reply-to-list, just reply) to that message, it went to the lists and not to you Brent! (KMail 1.10.3) -- so I totally edited the To lines, to send this message... Brent Yorgey wrote: Hi all, If you've noticed the lack of a HWN

Re: [Haskell-cafe] Use of abbreviations in Haskell

2009-01-03 Thread Isaac Dupree
Ketil Malde wrote: A module may be defined in a file with a name corresponding to the module name, or any dot-separated prefix of it? I.e. the file Foo/Bar.hs will define module Foo.Bar and optionally Foo.Bar.Baz as well? GHC should then be able to find it, and I believe it already has a

Re: [Haskell-cafe] Use of abbreviations in Haskell

2009-01-02 Thread Isaac Dupree
Derek Elkins wrote: I haven't been able to find any semantic difficulties with this addition. I like it too... what I run into is that there's an implicit assumption that module of name Foo.Bar.Baz *must* be found in a file Foo/Bar/Baz.[l]hs . module Main seems to be the only one exempted

Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-22 Thread Isaac Dupree
(responding with just a bit of possibly relevant context, not always directly) Paul Johnson wrote: I've lived through a couple of corporate rebranding exercises in my time, and I've read about some others. They follow a pattern: ... 2. The new branding is released with as much fanfare as

Re: Fwd: [Haskell-cafe] Haskell as a religion

2008-12-18 Thread Isaac Dupree
Henning Thielemann wrote: Alberto G. Corona schrieb: But many features need other features. For example, the option to use referential transparency will be common in future languages for multicore programming purposes. This creates the problem of separating side-effect-free code from

Re: [Haskell-cafe] Time for a new logo?

2008-12-15 Thread Isaac Dupree
okay, I want a t-shirt like this (but with all the greek letters and formatting) back: \t. 2^-t kg is equally[or: sometimes] bothered by math front: \gbtq is [sometimes] bothered by acronyms :-) or, sometimes likes each of them :-) -Isaac ___

[Haskell-cafe] Re: [Haskell] Wait for *either* MVar to be set

2008-11-26 Thread Isaac Dupree
Peter Verswyvelen wrote: ... by spawning and killing two threads (which might be an expensive operation, I'm not sure) pretty cheap in GHC -- they're not system threads Am I wrong in this? If so, is this something that might be considered as a future enhancement in the GHC libraries and

Re: [Haskell-cafe] Prototype of a syntax reference

2008-08-25 Thread Isaac Dupree
Maurí­cio wrote: • It should be an example of valid code, not good one. The idea is to show what can be done, not what should :) then put lots of semicolons somewhere: while they are at minimum a separator, it's generally allowed to insert as many extra semicolons as you want at the

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-12 Thread Isaac Dupree
C.M.Brown wrote: I don't really see this as being any kind of real issue at all. Surely all GHC needs to do is to concatenate all the modules together, alpha-reduce the import/export relations and do a compile/type check over the concatenated module. FWIW, I agree (in principle -- I haven't

Re: [Haskell-cafe] Fw: patch applied (ghc): Remove the OpenGL family of libraries fromextralibs

2008-07-29 Thread Isaac Dupree
Malcolm Wallace wrote: As a package author (rather than a user), I would see this as a primary benefit of having my packages added to the Platform. And as a package user (rather than author), there is the corresponding antibenefit of removing a package like HOpenGL from the Platform: a

Re: [Haskell-cafe] ansi2html - one program, several issues

2008-07-20 Thread Isaac Dupree
Dan Doel wrote: On Sunday 20 July 2008, John Meacham wrote: I do not believe that is the case, since the return type of runParser Either ParseError a means that before you can extract the result of the parse from the 'Right' branch, it must evaluate whether the result is 'Left' or 'Right'

Re: [Haskell-cafe] Searchig for modules

2008-07-17 Thread Isaac Dupree
fero wrote: Actually I have already found the way how to do it but not in eclipsefp. Either I run ghci and when both modules are in the same dir it works or I use -idirs but in eclipsefp it doesn't. Can somebody help me how to configure eclipsefp. I don't want to go to command prompt every time

Re: [Haskell-cafe] uvector and the stream interface

2008-07-17 Thread Isaac Dupree
Evan Laforge wrote: An abstraction stack: Impure Pure How about strict vs. lazy? I ask because I assumed there were lazy variants of uvector or storablevector, using the bytestring list of chunks approach, but apparently not? wait list of chunks makes something that

Re: [Haskell-cafe] Human-friendly compiler errors for GHC

2008-07-13 Thread Isaac Dupree
wren ng thornton wrote: Max Bolingbroke wrote: Agreed: I've implemented this too. I've also added fuzzy matching to package search: $ stage2/ghc-inplace --make ../Test1.hs ../Test1.hs:3:7: Could not find module `Data.Lost': Use -v to see a list of the files searched for.

Re: [Haskell-cafe] Human-friendly compiler errors for GHC

2008-07-13 Thread Isaac Dupree
Marc Weber wrote: There is a friendlier shell (don't remember it's name) which takes another approach: Change color if the word is known.. In case of ghci the commandline could switch color to green before pressing enter to indicate there are no errors left.. fish, the friendly interactive

Re: [Haskell-cafe] Qualified import syntax badly designed (?)

2008-07-09 Thread Isaac Dupree
Neil Mitchell wrote: Hi declaration with a regular syntax. For example: import Data.Map as Map unqualified (Map, (\\)) qualified (lookup, map, null) hiding (filter) I think I prefer this to my proposal, plus its closer to the current syntax. I think its

Re: [Haskell-cafe] http://www.haskell.org/ghc/reportabug

2008-06-30 Thread Isaac Dupree
Galchin, Vasili wrote: Isaac, which different trac page? I have tried several times to no avail! any one that says you're not logged in. Probably you're having a different problem than I was, if it's that hard to solve... -Isaac ___

Re: [Haskell-cafe] http://www.haskell.org/ghc/reportabug

2008-06-30 Thread Isaac Dupree
Galchin, Vasili wrote: I am logging in as a client running Ubuntu Linux. Is this a problem? (I think not ). no, I use Ubuntu. If you have cookies disabled (am I one of the few people who sets this option?) without having an exception for hackage.haskell.org, that would cause trouble.

Re: [Haskell-cafe] history of tuples vs pairs

2008-06-26 Thread Isaac Dupree
Lennart Augustsson wrote: Yes, early ML had nested pairs. We introduced n-tuples in Lazy ML because in a lazy language n-tuples are not isomorphic to nested pairs (whereas they are in a strict language). So n-tuples are nasty because they are not inductive, but they are in many ways much more

Re: [Haskell-cafe] ANNOUNCE: Pipe 1.0

2008-06-23 Thread Isaac Dupree
Don Stewart wrote: Interesting. Does it depend on an unreleased version of the process library? by the way, is there a policy for when new versions of packages maintained by [EMAIL PROTECTED] are *released*? Or do patches just collect in the darcs repository until they're picked up by some

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-16 Thread Isaac Dupree
Henning Thielemann wrote: On Mon, 9 Jun 2008, Duncan Coutts wrote: On Mon, 2008-06-09 at 16:04 +0200, Ketil Malde wrote: And - is there a way to make GHCi use aliased qualification? I find my self typing detailed taxonomies all the time there. The ghci syntax currently is: :m Data.Set

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-16 Thread Isaac Dupree
Duncan Coutts wrote: Right. That's exactly why we've not done something like that. With 100+ modules in the Gtk package it's totally infeasible to do qualified imports of them all. If we get a proper way to export a non-flat namespace then Gtk2Hs will certainly switch to using it. Using

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Isaac Dupree
Sebastiaan Visser wrote: Hi, I've got a question about lazy IO in Haskell. The most well known function to do lazy IO is the `hGetContents', which lazily reads all the contents from a handle and returns this as a regular [Char]. The thing with hGetContents is that is puts the Handle in a

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Isaac Dupree
Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote:

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Isaac Dupree
Neil Mitchell wrote: * abort - deliberate aborting because the user made some mistake. This is an exception. The signature of a function must reflect this by a Maybe, Either type etc. Disagree. I mean more like: when (Delete `elem` flags Keep `elem` flags) $ abort User cannot pick both

[Haskell-cafe] Re: [Haskell] ANN: random-access-list-0.1

2008-06-13 Thread Isaac Dupree
Stephan Friedrichs wrote: Isaac Dupree wrote: [...] Great to see it, it deserved implementing, IIRC! I don't remember enough about it.. (and don't have Okasaki anywhere handy). Can it be lazy or infinitely long? No, it has to be finite as it's actually a list of complete binary trees

Maybe-summary was: Re: [Haskell-cafe] Re: [Haskell] ANN: random-access-list-0.1

2008-06-13 Thread Isaac Dupree
Claus Reinke wrote: To summarize: Monad isn't the proper abstraction for failable/Maybe. Maybe is an algebraic data type that *exactly* represents the spirit of what you're trying to do: e.g. Conor McBride said: Maybe is the most general abstraction. Requiring (=), or even (*) seems

[Haskell-cafe] Re: [Haskell] ANN: random-access-list-0.1

2008-06-12 Thread Isaac Dupree
Henning Thielemann wrote: On Wed, 11 Jun 2008, Isaac Dupree wrote: extractHead is an ugly name for a nevertheless standardish-meaning function... what is it usually called? uncons? headTail? (Data.Sequence, which is meant to be left-right symmetric, calls it viewr... except your version

Re: [Haskell-cafe] Re: [Haskell] ANN: random-access-list-0.1

2008-06-12 Thread Isaac Dupree
Henning Thielemann wrote: On Thu, 12 Jun 2008, Isaac Dupree wrote: Henning Thielemann wrote: On Wed, 11 Jun 2008, Isaac Dupree wrote: extractHead is an ugly name for a nevertheless standardish-meaning function... what is it usually called? uncons? headTail? (Data.Sequence, which is meant

[Haskell-cafe] Re: [Haskell] ANN: random-access-list-0.1

2008-06-11 Thread Isaac Dupree
Stephan Friedrichs wrote: Hello, I've implemented Chris Okasaki's random-access list[1] which provides typical list operations (cons, head, tail) in O(1) and yet offers indexed random-access in O(log n). It's uploaded on hackage[2]. It's still an early version which I'll extend, but

Re: [Haskell-cafe] Implementing ParseChart with Data.Map

2008-06-03 Thread Isaac Dupree
Duncan Coutts wrote: modify :: k - Map k e - (e, Maybe e - Map k e) so it's a lookup that returns the element at k and also a continuation that lets you rebuild a new map with an altered element. I guess that doesn't account for the element not existing. There's probably a generalisation that

Re: [Haskell-cafe] Mutually Recursive Modules

2008-06-02 Thread Isaac Dupree
Richard Giraud wrote: Hello I'm using GHC 6.8.2 with mutally recursive modules. I'm familiar with how to do simple cases in GHC ({-# SOURCE #-} and .hs-boot files) but I can't figure out how to get it to work for a particular set of modules. Is it known (i.e., proven) that GHC 6.8.2 can

Re: [Haskell-cafe] Default definitions for associated type synonyms

2008-06-02 Thread Isaac Dupree
Dreixel wrote: Hello, Does anyone know if it is possible to specify a default definition for an associated type synonym? When I tried: class A a where type B a = a GHC (version 6.9.20080309) told me: Type declaration in a class must be a kind signature or synonym default. However, when I

Re: [Haskell-cafe] Copying Arrays

2008-05-30 Thread Isaac Dupree
it makes me wonder: can we support concatenation with sharing (e.g. the rope data structure) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] type-level integers using type families

2008-05-29 Thread Isaac Dupree
Peter Gavin wrote: Has anyone else tried implementing type-level integers using type families? I tried using a couple of other type level arithmetic libraries (including type-level on Hackage) and they felt a bit clumsy to use. I started looking at type families and realized I could pretty

Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Isaac Dupree
Evan Laforge wrote: I have two related questions: #1 I'm getting some annoying type errors that I don't fully understand, and wind up having to do a workaround that I don't totally like. Here's a simplified version of my situation: data Ambi m = Ambi { ambi_monad :: m Int , ambi_int

Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Isaac Dupree
Another valid type for foo can be done AFAICS with intersection types: foo :: (Char - a /\ Bool - b) - (a,b) But I can not comment about their inference, or usefulness in practice. Again, undecidable :) In fact, I believe that an inference algorithm for intersection types is equivalent to

Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Isaac Dupree
foo :: (Char - a /\ Bool - b) - (a,b) a.k.a. find some value that matches both Char-a and Bool-b for some a and b. Could use type-classes to do it. Uhmm... you mean something like (neglecting TC-related issues here) class C a b where fromChar :: Char - a fromBool :: Bool - b

Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Isaac Dupree
Evan Laforge wrote: get_int sym = fmap ambi_int (lookup sym ambi_table :: Maybe (Ambi Maybe)) Of you and the type system you're the only one who knows that that value is not used. The type system doesn't use (all) the rules you have in your mind. It follows more simple ones. You judge by

Re: [Haskell-cafe] Re: Aren't type system extensions fun? [Further analysis]

2008-05-27 Thread Isaac Dupree
Chaddaï Fouché wrote: - Why are top-level variables and function arguments treated differently by the type system? They aren't In a sense, they are. id :: (forall a. a - a) useId :: (forall a. a - a) - (Int,Bool) brokenUseId :: (forall a. (a - a) - (Int,Bool)) brokenUseId :: (a - a) -

Re: [Haskell-cafe] relational data representation in memory using haskell?

2008-05-22 Thread Isaac Dupree
Marc Weber wrote: On Thu, May 22, 2008 at 03:34:36PM +0200, Marc Weber wrote: On Thu, May 22, 2008 at 09:11:28AM -0400, Isaac Dupree wrote: to whoever in this thread hasn't realized it: Map String (Map Int Foo) == Map (String,Int) Foo (at least to an approximation) There is another

Re: [Haskell-cafe] Re: MD5 performance optimizations, and GHC -via-C producing segfaulting binary

2008-05-22 Thread Isaac Dupree
Simon Peyton-Jones wrote: | [1] I'm not sure if this is true... if it has to rebox the Int, you get | another copy floating around, not the original, right? Correct. If you have data T = MkT {-# UNPACK #-} !Int then given case x of { MkT y - h y } then GHC must re-box the 'y'

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-19 Thread Isaac Dupree
Evan Laforge wrote: To threadjack a little bit, I've been interfacing haskell with c++. It gets awkward when the c++ structures use STL types like string and vector. Of course those are too complex for haskell to marshal to. What I've been doing is defining an XMarshal variant of the X c++

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-19 Thread Isaac Dupree
you could write a C++ function to marshal a Sequence (or any Container IIRC, maybe Forward Container) to a vector (or whatever you wanted -- there are choices), and then okay let's see if I remember C++ well enough This design has extra copying. but anyway templatetypename Container

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-18 Thread Isaac Dupree
, 2008 at 9:16 PM, Isaac Dupree [EMAIL PROTECTED] wrote: perhaps haskell: foreign export foo_func foo :: Int - IO Int -- I forget the rest of the syntax here C++: extern C { int foo_func(int i); } int some_cplusplus_function() { int bat = 3; int blah = foo_func(bat); return blah

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-16 Thread Isaac Dupree
perhaps haskell: foreign export foo_func foo :: Int - IO Int -- I forget the rest of the syntax here C++: extern C { int foo_func(int i); } int some_cplusplus_function() { int bat = 3; int blah = foo_func(bat); return blah; } Is that all you need to do? Miguel Lordelo wrote: Hi

Re: [Haskell-cafe] naming a data structure for weighted random selection without replacement

2008-02-18 Thread Isaac Dupree
Michał Pałka wrote: On Mon, 2008-02-18 at 11:37 +, Luke Palmer wrote: On Feb 18, 2008 5:11 AM, Stuart Cook [EMAIL PROTECTED] wrote: A while ago I wrote a little data structure that allows weighted random selection-without-replacement from a collection of values in O(log n) time.[1] I'm now

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-11 Thread Isaac Dupree
Alfonso Acosta wrote: So type-level + parametrized-data is my vote. But don't let's spend too much time discussing the name. ;-) Fair enough. type-level + parameterized-data it is then (unless someone else has a better suggestion). I'm going to begin coding now. hang on, parametrized or

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Isaac Dupree
Wolfgang Jeltsch wrote: Am Freitag, 1. Februar 2008 05:11 schrieben Sie: Wolfgang Jeltsch wrote: Well, the representation (D1,D2,D9) might be considered more readable. It has the disadvantage of a fixed maximum size for the numbers. Which takes me to a point I had already considered some

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Isaac Dupree
Wolfgang Jeltsch wrote: Well, the representation (D1,D2,D9) might be considered more readable. It has the disadvantage of a fixed maximum size for the numbers. Which takes me to a point I had already considered some time ago: Wouldn’t it be good if we had just a type data Pair val1

Re: Fwd: Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Isaac Dupree
You could solve it this way: data PairL a b = PairL a !b where (a,b,c) is syntactic sugar for PairL a (PairL b (PairL c ())) There are still potential efficiency issues, although this could be worked out in the compiler; right now it's a single operation to get from a tuple to any member,

Re: [Haskell-cafe] Poor libraries documentation

2008-01-30 Thread Isaac Dupree
Johan Tibell wrote: I imagine the laziness here was because these all match their names in the traditional libc, accessable via manpages. You may not consider that an excuse :) I don't! To do something about it I'll adopt Network.Socket and document that (I did the same with some other base

Re: [Haskell] Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Isaac Dupree
Michael Reid wrote: The power of Haskell's type system makes it feel like you are programming in a dynamic language to some degree, yet all of it is type-checked, and that is just *really* cool. to some degree, (in current Haskell compilers), it *is* more like a dynamic than a static

Re: [Haskell] Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Isaac Dupree
Derek Elkins wrote: On Sat, 2008-01-26 at 20:49 -0500, Isaac Dupree wrote: Michael Reid wrote: The power of Haskell's type system makes it feel like you are programming in a dynamic language to some degree, yet all of it is type-checked, and that is just *really* cool. to some degree

Re: [Haskell-cafe] Fwd: ByteString Parsec clone

2008-01-25 Thread Isaac Dupree
Johan Tibell wrote: I tried to get Dan's thoughts on cloning parts of the Parsec interface and some of the documentation but none of the emails addresses I've tried seem to work. What's allowed when it comes to duplicating something like an API? What about the documentation? I intend it to be

Re: [Haskell-cafe] Re: Why functional programming matters

2008-01-24 Thread Isaac Dupree
fewer frustratingly unsolvable bugs down-the-road? When I have bugs in my Haskell programs (and usually I get type errors instead), I've always found them eventually and they're either a silly mistake or I realize that I misunderstood the problem I was trying to solve (it needs to be solved a

Re: [Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Isaac Dupree
Adam Langley wrote: Since CPP mode removes newlines in the out macro expansion. It appears to be impossible to have a macro expand to a function with an INLINE pragma since it appears to need to be in its own line. that's because INLINE uses layout like everything else, so you can use

Re: [Haskell-cafe] Filter by several predicates at once

2008-01-17 Thread Isaac Dupree
Neil Mitchell wrote: Hi passall, passany :: [a - Bool] - a - Bool passall ps v = and $ map ($v) ps passany ps v = or $ map ($v) ps or something similar defined anywhere? Such that one can write nearly; using Prelude: passall ps v = all ($v) ps passany ps v = any ($v) ps One thing I have

Re: [Haskell-cafe] Re: Compiling Blobs

2008-01-17 Thread Isaac Dupree
Peter Verswyvelen wrote: However I'm using GHC 6.8.2 on Fedora 8. BTW what do you think is the best distro for doing Haskell development? they all suck if you want to be able to try/use the latest stuff, in my experience; just install a GHC and cabal stuff in your home directory (you can

Re: [Haskell-cafe] the trivial monad- thoughts and a question

2008-01-12 Thread Isaac Dupree
Brian Hurt wrote: The second question I have is: is there any hope of getting something like this into the standard library? the newtype Identity in module Control.Monad.Identity in package `mtl` is what you describe:

Re: [Haskell-cafe] US Homeland Security program language security risks

2008-01-09 Thread Isaac Dupree
Bryan O'Sullivan wrote: Yitzchak Gale wrote: Perhaps Coverity's interest could be piqued if they were made aware of Haskell's emergence as an important platform in security-sensitive industries such as finance and chip design, and of the significant influence that Haskell is having on the

Re: [Haskell-cafe] Please allow beginners to vocalize code. = :: - - -

2008-01-08 Thread Isaac Dupree
Wolfgang Jeltsch wrote: Am Dienstag, 8. Januar 2008 21:36 schrieb Richard Kelsall: Now supposing you were on the phone to a Haskell programmer and you wanted to say this f :: Int - Int I imagine you might say f maps Int to Int or function f has type Int to Int. Both symbols have been

Re: [Haskell-cafe] Re: The Worker/Wrapper Transformation

2008-01-03 Thread Isaac Dupree
Achim Schneider wrote: Achim Schneider [EMAIL PROTECTED] wrote: [...] I'm trying to grok that [] = id ++ = . in the context of Hughes lists. they are also known as difference lists, and also used at type String in the Prelude as ShowS, to help avoid quadratic behavior when making

Re: [Haskell-cafe] The Worker/Wrapper Transformation

2008-01-03 Thread Isaac Dupree
Achim Schneider wrote: ...is a paper about automatic specialisation of functions by unboxing arguments, one could say. I'm only on page 6, but already survived the first formalisms, which is bound to mean that the rest of the paper is likewise accessible, as hinted on at ltu.

Re: [Haskell-cafe] A commutative diagram conjecture about applicative functors

2007-12-31 Thread Isaac Dupree
Twan van Laarhoven wrote: Robin Green wrote: I am proving various statements relating to applicative functors, using the Coq proof assistant (I am considering only Coq terms, which always terminate so you don't have to worry about _|_). However, I'm not sure how to go about proving a certain

Re: [Haskell-cafe] A commutative diagram conjecture about applicative functors

2007-12-31 Thread Isaac Dupree
Twan van Laarhoven wrote: Isaac Dupree wrote: Unfortunately, I get puzzling type errors if I annotate either one of them with their type (e.g. (Applicative f) = f (a - b) - f a - f (Int, b) ) in an expression. The very answer doesn't seem to typecheck. :t \f x - fmap ((,) (0::Int)) (f * x

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

2007-12-27 Thread Isaac Dupree
Bulat Ziganshin wrote: here T is any type. you said that values of ANY TYPE can be saved to disk, so show us the way ... try to prove that this mean that value of ANY type may be saved to disk Run another program that uses lots of memory, and watch the entire Haskell program's memory be

Re: [Haskell-cafe] Re: Comments on reading two ints off Bytestring

2007-12-24 Thread Isaac Dupree
Paulo J. Matos wrote: On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote: -- this should work too parseHeader3 :: BS.ByteString - Maybe (Int, Int) --note accurate type signature, which helps us use Maybe failure-monad, --although losing your separate error messages Oh gee, I just

Re: [Haskell-cafe] Re: Comments on reading two ints off Bytestring

2007-12-24 Thread Isaac Dupree
Brandon S. Allbery KF8NH wrote: On Dec 24, 2007, at 13:18 , Isaac Dupree wrote: Paulo J. Matos wrote: On Dec 23, 2007 12:44 PM, Isaac Dupree [EMAIL PROTECTED] wrote: parseHeader3 bs = do (x, rest) - BS.readInt $ BS.dropWhile (not . isDigit) bs (y, _) - BS.readInt $ BS.dropWhile

Re: [Haskell-cafe] Re: Comments on reading two ints off Bytestring

2007-12-23 Thread Isaac Dupree
-- this should work too parseHeader3 :: BS.ByteString - Maybe (Int, Int) --note accurate type signature, which helps us use Maybe failure-monad, --although losing your separate error messages parseHeader3 bs = do (x, rest) - BS.readInt $ BS.dropWhile (not . isDigit) bs (y, _) - BS.readInt $

Re: [Haskell-cafe] Re: Haskell performance

2007-12-21 Thread Isaac Dupree
Jon Harrop wrote: On Thursday 20 December 2007 19:02, Don Stewart wrote: Ok, so I should revive nobench then, I suspect. http://www.cse.unsw.edu.au/~dons/nobench/x86_64/results.html that kind of thing? Many of those benchmarks look good. However, I suggest avoiding trivially reducible

Re: [Haskell-cafe] ghc overlapping instances

2007-12-05 Thread Isaac Dupree
Steffen Mazanek wrote: Hi, Stefan and Isaac, thx for providing quick advice. @Stefan: Unfortunately I have to use a list. @Isaac: I do not get it. Could you please provide a short example of your approach? The question still remains. Which arguments do I have ghc to start with to get the same

Re: [Haskell-cafe] ghc overlapping instances

2007-12-04 Thread Isaac Dupree
Steffen Mazanek wrote: Hello, I want to quickcheck a property on a datatype representing programs (=[Stmt]) and need to define a specific instance instance Arbitrary [Stmt] (mainly to restrict the size of the list). you don't always need to use instances. for example, I have (where

[Haskell-cafe] Re: [Haskell] IVar

2007-12-04 Thread Isaac Dupree
A pure readIVar would be just like lazy I/O, with similar drawbacks. With readIVar, the effect that lets you observe the evaluation order is writeIVar; with hGetContents it is hClose. Conclusion: it's probably no worse than lazy I/O. Actually, it's considerably better. +: implementation

Re: [Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-27 Thread Isaac Dupree
apfelmus wrote: Benedikt Huber wrote: type Upd a = a - a data Ref cx t = Ref { select :: cx - t , update :: Upd t - Upd cx } Functional references are also called lens, I'm going to use that term from now on. As a minor note, I somehow prefer a single primitive data Lens s a =

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Isaac Dupree
Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? therefore, maxBound is Infinity and minBound negative infinity? Isaac

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Isaac Dupree
Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? therefore, maxBound is Infinity and minBound negative infinity? But IEEE can be run with projective infinity in which case there is only one of them. Well, if Double becomes a

[Haskell-cafe] Re: [Haskell] placing modules in the module hierarchy

2007-10-29 Thread Isaac Dupree
Wolfgang Jeltsch wrote: Since the Control.Grapefruit subtree would probably only consist of Control.Grapefruit.Signal and submodules, I’d prefer to just use Control.Signal and Control.Signal.*. But this would pose the problem that no other FRP library could use Control.Signal without

Re: [Haskell-cafe] Recipes for organizing HUnit tests

2007-10-28 Thread Isaac Dupree
Mushfeq Khan wrote: I'm new to Haskell and am trying to find a good way to organize my HUnit tests. Having used some of the other XUnit frameworks, I tended towards trying to organize them all in a parallel test folder structure, but this seems to be a bad fit for Haskell, since the test modules

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Isaac Dupree
Prabhakar Ragde wrote: You could try giving divisors type signature: divisors :: Int - [Int] Thank you. That brings the time down to 0.5 seconds. I'm glad it was something as simple as that. --PR I assume GHC was smart enough to do inlining and such in this case, so the difference is that

[Haskell-cafe] viewing HS files in Firefox

2007-10-27 Thread Isaac Dupree
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them

  1   2   >