Re: [Haskell-cafe] ANN: fixed-list -- A fixed length list library

2010-03-20 Thread Casey McCann
Job Vranish wrote: > Its main advantages are: >  Very easy to use. >  Almost entirely Haskell98 (the non Haskell98 pieces are not critical, just > nice) >  The datatype is a member of  Foldable, Traverable, Applicative, Monad, > etc... >  Then length of the list is encoded in the type in a natural

Re: [Haskell-cafe] Correct way to record state in OpenGL?

2010-04-04 Thread Casey McCann
On Sun, Apr 4, 2010 at 5:03 AM, Mark Spezzano wrote: > What is the correct way to record "custom" state when using OpenGL? > > By this, I refer to, say, properties of a square--say it's x,y coordinates as > it moves across the screen. This requires that the program keep track of the > object's s

Re: [Haskell-cafe] Hackage accounts and real names

2010-04-05 Thread Casey McCann
2010/4/5 Jonas Almström Duregård : > This being said, I have no problem with this restriction. In fact, > trying to determine the origin of code before agreeing to distribute > it sounds like sound procedure. How so? What does knowing the real name of some code's author tell you that merely knowin

Re: [Haskell-cafe] Metaprogramming in Haskell vs. Ocaml

2010-04-05 Thread Casey McCann
On Mon, Apr 5, 2010 at 7:05 PM, Jason Dagit wrote: > On Mon, Apr 5, 2010 at 12:27 PM, Jacques Carette > wrote: >> 2. people who care about types use a typed meta-language (like metaocaml) >> instead of an untyped template layer atop a (fantastic!) typed language. > > Are you implying that templat

Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-08 Thread Casey McCann
On Thu, Apr 8, 2010 at 2:09 PM, Edward Kmett wrote: > Template Haskell can help dull the pain, but the result seems hardly > idiomatic. Well, since this is dealing with types and type classes, much of the required boilerplate could also be straightforwardly derived in full generality using type-

Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-08 Thread Casey McCann
On Thu, Apr 8, 2010 at 7:58 PM, wren ng thornton wrote: >> They don't?  I am pretty sure that a floating point number is always equal >> to itself, with possibly a strange corner case for things like +/- 0 and >> NaN. > > Exactly. NaN /= NaN. > > Other than that, I believe that "let x = ... in x =

Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-08 Thread Casey McCann
On Thu, Apr 8, 2010 at 8:51 PM, Gregory Crosswhite wrote: > First of all, it isn't clear to me that NaN /= NaN, since in ghci the > expression "1.0/0.0 == 1.0/0.0" evaluates to True.  But even if that were the > case, I would call that more of a technicality then meaning that equality is > not

Re: [Haskell-cafe] Type constrain in instance?

2010-04-09 Thread Casey McCann
On Fri, Apr 9, 2010 at 11:22 AM, Louis Zhuang wrote: > However GHC only has kinds for class/instance like (*->*->*) so we are forced > to > allow all possible types in instance code. I'm not sure if I'm modelling > things > correctly or is there another way to do the same thing? As far as I kno

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Casey McCann
On Wed, Apr 14, 2010 at 2:22 PM, Stefan Monnier wrote: > While we're here, I'd be more interested in a dirty&fast comparison > operation which could look like: > >    eq :: a -> a -> IO Bool > > where the semantics is "if (eq x y) returns True, then x and y are the > same object, else they may be

Re: [Haskell-cafe] Re: cabal: other-modules

2010-04-15 Thread Casey McCann
On Thu, Apr 15, 2010 at 10:45 AM, Dougal Stanton wrote: > 'Morally' seems just the perfect word for this occasion --- concerned > with right or proper conduct. In this case, potential discrepancies > between the files that cabal 'knows' about when issuing different > commands; or the sense of dece

Re: [Haskell-cafe] Functional Dependencies conflicts

2010-04-17 Thread Casey McCann
On Sat, Apr 17, 2010 at 4:01 PM, Limestraël wrote: > I would have undestood the error if GameObject was also an instance of > Binary (then the two instances would match), but it's not the case... As Daniel Fischer has mentioned, presumably a Binary instance could later be written for GameObject;

Re: [Haskell-cafe] Functional Dependencies conflicts

2010-04-18 Thread Casey McCann
On Sun, Apr 18, 2010 at 5:01 AM, Limestraël wrote: > There must be some kind of a private joke I don't get... > > BTW, all you've said is pretty scaring... And somewhat exaggerated, of course. Reasonable uses exist for all three extensions, but they're firmly in the category of "avoid unless you

Re: [Haskell-cafe] Proper Handling of Exceptional IEEE Floating Point Numbers

2010-04-22 Thread Casey McCann
On Thu, Apr 22, 2010 at 11:34 AM, Barak A. Pearlmutter wrote: > Comparison of exceptional IEEE floating point numbers, like Nan, seems > to have some bugs in ghci (version 6.12.1). Arguably, the "bug" in question is the mere existence of Eq and Ord instances for IEEE floats. They don't, can't, an

Re: [Haskell-cafe] Proper Handling of Exceptional IEEE Floating Point Numbers

2010-04-23 Thread Casey McCann
On Fri, Apr 23, 2010 at 3:21 AM, Barak A. Pearlmutter wrote: >> ... An invalid comparison evaluating to _|_ is arguably more >> correct, but I personally find the idea of introducing more bottoms >> rather distasteful. > > Too late!  NaN is pretty much the _|_ of IEEE Floating Point. Yes, of cour

Re: [Haskell-cafe] Proper Handling of Exceptional IEEE Floating Point Numbers

2010-04-25 Thread Casey McCann
On Sun, Apr 25, 2010 at 9:08 PM, Richard O'Keefe wrote: > It seems to me that there's a choice here between (...) Nice! That's a very comprehensive summary of the situation regarding issues of correctness. I do wonder, though, what (if any) are the performance implications? Editorializing a bit,

Re: [Haskell-cafe] Re: Sorting Types

2010-04-27 Thread Casey McCann
On Tue, Apr 27, 2010 at 10:20 AM, John Creighton wrote: >> I was wondering if it is possible to sort types in hakell and if so what >> language extension I should use. There are multiple ways that some manner of ordering could be defined on types. A structural definition is one method; ordering P

Re: [Haskell-cafe] Strict type system allows for a maximum number of programming errors to be caught at compile time.

2010-05-03 Thread Casey McCann
On Tue, May 4, 2010 at 12:13 AM, Ivan Miljenovic wrote: > On 4 May 2010 13:30, Luke Palmer wrote: >> Here is a contrived example of what I am referring to: >> >> prefac f 0 = 1 >> prefac f n = n * f (n-1) >> >> fac = (\x -> x x) (\x -> prefac (x x)) > > I can't work out how this works (or should

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-04 Thread Casey McCann
On Tue, May 4, 2010 at 9:09 AM, Limestraël wrote: > Are there other methods than Maybe or exceptions to handle the errors in > Haskell? Is the monad Error(T) useful? I believe the usual Error monad is just (Either e), with Left indicating failure. It's the same idea as Maybe, only returning infor

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-04 Thread Casey McCann
On Tue, May 4, 2010 at 2:43 PM, Gregory Crosswhite wrote: > I definitely like that idea.  :-)  Is this similar to the notion of > dependent types? That's where things tend to wind up eventually, yes. Although, with Haskell as it stands, a great deal of unused information is already present outsid

Re: [Haskell-cafe] Hackage 2 maintainership

2012-02-13 Thread Casey McCann
On 02/13/2012 06:44 PM, Ben Gamari wrote: I currently have a running installation on my personal machine and things seem to be working as they should. On the whole, installation was quite trivial, so it seems likely that the project is indeed at a point where it can take real use (although a "log

Re: [Haskell-cafe] List comprehensions with Word8

2013-05-16 Thread Casey McCann
At risk of belaboring the now-obvious, note that the empty lists begin at 1, which is 10^8, and thus the first power of 10 evenly divisible by 2^8. The largest value in the list for each 10^n is likewise 0 modulo 2^n. (Figuring out why the sequence has those particular multiples of 2^n is

Re: [Haskell-cafe] Python is lazier than Haskell

2011-04-28 Thread Casey McCann
On Fri, Apr 29, 2011 at 12:42 AM, Gregg Reynolds wrote: > On Thu, Apr 28, 2011 at 11:38 PM, Ben Lippmeier wrote: >> Laziness at the value level causes space leaks, and laziness at the type >> level causes mind leaks. Neither are much fun. >> > If the designers could find a way to support laziness

Re: [Haskell-cafe] Advertisement: the Haskell Stack Overflow Q & A site

2011-05-04 Thread Casey McCann
On Wed, May 4, 2011 at 5:02 PM, James Cook wrote: >  Haskell, on the other hand, has a small enough volume that people can at > least skim the ones from the last past day or two in a fairly small amount > of time. They can and, in fact, do. Or at least I do, at any rate, even when I don't really

Re: [Haskell-cafe] Exception for NaN

2011-05-13 Thread Casey McCann
On Fri, May 13, 2011 at 4:48 PM, Luke Palmer wrote: > On Thu, May 12, 2011 at 5:50 PM, Daniel Fischer > wrote: >> >> Prelude Data.List> maximum [0,-1,0/0,-5,-6,-3,0/0,-2] >> 0.0 >> Prelude Data.List> minimum [0,-1,0/0,-5,-6,-3,0/0,-2] >> -2.0 >> Prelude Data.List> sort [0,-1,0/0,-5,-6,-3,0/0,-2]

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Casey McCann
On Sat, May 14, 2011 at 9:14 AM, Ketil Malde wrote: > Maybe not terribly brilliant, but wouldn't it improve things slightly if > NaN was considered less or greater than any other value (possibly > excluding infinities)? It would improve things in the sense of giving well-behaved instances for Eq

Re: [Haskell-cafe] Random thoughts about typeclasses

2011-05-16 Thread Casey McCann
On Mon, May 16, 2011 at 8:10 AM, Robert Clausecker wrote: > I found out, that GHC implements typeclasses as an extra argument, a > record that stores all functions of the typeclass. So I was wondering, > is there a way (apart from using newtype) to pass a custom record as the > typeclass record, t

Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?

2011-05-16 Thread Casey McCann
On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie wrote: > I wanted to look into using Haskell for an introductory Image Processing > class, but the main package used for such things (OpenCV) does not appear to > be available for windows systems. > > Is there some other good option for image proc

Re: [Haskell-cafe] Exception for NaN

2011-05-16 Thread Casey McCann
On Mon, May 16, 2011 at 3:39 AM, Ketil Malde wrote: > I'm not intimately familiar with IEEE 754, but in any case we'd be in > good company: R typically lets you select to sort NaNs as greater or > less than any other values, and sorts non-NaN values correctly also in > the presence of NaNs, I thin

Re: [Haskell-cafe] Names for pretty-printing combinators

2011-05-25 Thread Casey McCann
One drastic approach I've used in personal libraries--operator-heavy EDSLs specifically--is to define everything first with alphanumeric names, then put operators in their own modules. In some cases I'd have three such modules: One providing a minimal set of operators that don't clash with anything

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Casey McCann
2011/5/26 Daniel Fischer > As far as I'm concerned, a left-associative version of ($) would sometimes > be nice (on the other hand, right-associativity of ($) is sometimes also > nice), but usually, I don't find parentheses too obnoxious. I have a whole set of function application/composition/lif

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Casey McCann
On Mon, May 30, 2011 at 9:01 AM, John Ky wrote: > instance Monoid (Stream a) where > mempty = Chunks mempty > mappend (Chunks xs) (Chunks ys) = Chunks (xs ++ ys) > mappend _ _ = EOF > > I guess, it shows my lack of experience in Haskell, but my question is, why > is writing the code th

Re: [Haskell-cafe] Can it be proven there are no intermediate "useful" type classes between Applicative Functors & Monads?

2011-06-06 Thread Casey McCann
On Mon, Jun 6, 2011 at 12:19 PM, Brent Yorgey wrote: > The idea is that Applicative computations > have a fixed structure which is independent of intermediate results; > Monad computations correspond to (potentially) infinitely branching > trees, since intermediate results (which could be of an in

Re: [Haskell-cafe] Can it be proven there are no intermediate "useful" type classes between Applicative Functors & Monads?

2011-06-06 Thread Casey McCann
On Mon, Jun 6, 2011 at 5:32 PM, Matthew Steele wrote: > I think Branching is to Monad what ArrowChoice is to ArrowApply. > Branching allows the shape of the computation to depend on run-time > values (which you can't do with Applicative), but still allows only a > finite number of computation path

Re: [Haskell-cafe] Proposal: remove "Stability" from haddock documentation on hackage

2011-06-07 Thread Casey McCann
On Tue, Jun 7, 2011 at 9:22 AM, Tillmann Rendel wrote: > On > http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Applicative.html, > in the upper right corner, the module is marked as "experimental". I think > this is a Haddock feature, not a Hackage feature. Oddly, I couldn

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-21 Thread Casey McCann
On Tue, Jun 21, 2011 at 5:24 PM, pipoca wrote: > If you were to have your anonymous sum types be a union instead of the > disjoint union, then you could say that A :+: A has no meaning. > That's what I was originally thinking of when I suggested that > syntax.  However, as was pointed out to me by

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-21 Thread Casey McCann
On Tue, Jun 21, 2011 at 9:51 PM, wren ng thornton wrote: > I don't think there are any problems[1]. (...) > [1] modulo the A:+:A ~ A issue. That issue is exactly my concern, though, and it seems a bit too thorny to handwave aside. For instance, doesn't this also cause problems for anything of the

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-22 Thread Casey McCann
On Wed, Jun 22, 2011 at 2:19 PM, wren ng thornton wrote: >>> [1] modulo the A:+:A ~ A issue. > > Oops, I should've said A:*:A there. > >> That issue is exactly my concern, though, and it seems a bit too >> thorny to handwave aside. > > Indeed. If we have A:*:A ~ A, then A:*:A is not a categorical

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-22 Thread Casey McCann
On Wed, Jun 22, 2011 at 5:00 PM, Alexander Solla wrote: > You're building up (Either a b) into a monoidal category.  There used to be > a package called category-extras for this kind of stuff.  I think it has > been broken up.  Does anybody know the status of its replacement(s)? You probably want

Re: [Haskell-cafe] compare iteratee with python's yield

2011-07-01 Thread Casey McCann
On Fri, Jul 1, 2011 at 6:01 AM, Ertugrul Soeylemez wrote: > I don't know Python very well, but I suspect that its generators are > really a sort of coroutines.  Iteratees are also coroutines, but their > architecture is quite different. Python generators were originally a sort of heavily restrict

Re: [Haskell-cafe] Ur tutorial, and a challenge

2011-07-27 Thread Casey McCann
On Wed, Jul 27, 2011 at 8:30 AM, Christopher Done wrote: > On 27 July 2011 13:58, Adam Chlipala wrote: >> Does this static type system support metaprogramming strong enough to >> implement my challenge problem with the level of static guarantee for all >> specialization parameters that I ask for?

Re: [Haskell-cafe] Tupling functions

2011-09-13 Thread Casey McCann
On Tue, Sep 13, 2011 at 10:03 PM, Chris Smith wrote: > Ah, okay... then sure, you can do this: > > class Tuple a b c | a b -> c where >    tuple :: a -> b -> c > > instance Tuple (a -> b, a -> c) a (b,c) where >    tuple (f,g) x = (f x, g x) This wouldn't actually work well in practice. There's n

Re: [Haskell-cafe] Tupling functions

2011-09-14 Thread Casey McCann
On Wed, Sep 14, 2011 at 9:32 AM, Victor Nazarov wrote: > I've just tried another approach (code below). And GHC even inferred > type for tupleF. But I think GHC inferred the wrong type and I can't > formulate the right one, it seems to require infinite number of > constraints. With GHC inferred ty

Re: [Haskell-cafe] Tupling functions

2011-09-15 Thread Casey McCann
On Thu, Sep 15, 2011 at 7:51 AM, Markus Läll wrote: > Intuitively it seems to be exactly the same as the type families' > aproach, and looks quite clear too. Not exact, no--as written, it's strictly more powerful. Your fundeps go in both directions, whereas the type families didn't (though could

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Casey McCann
On Tue, Sep 20, 2011 at 12:47 PM, Paterson, Ross wrote: > Daniel Fischer writes: >>> A numeric range [a..a+n] might be expected >>> to have a+n+1 elements, but that doesn't hold either for Float and >>> Double.  I think Enum for floating point values is broken >> >>Yes, it is. Like Eq and Ord. > >

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Casey McCann
On Tue, Sep 20, 2011 at 3:48 PM, Chris Smith wrote: > On Tue, 2011-09-20 at 15:28 -0400, Casey McCann wrote: >> I actually think the brokenness of Ord for floating point values is >> worse in many ways, as demonstrated by the ability to insert a value >> into a Data.Set.Set

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Casey McCann
On Tue, Sep 20, 2011 at 5:56 PM, Evan Laforge wrote: >> I actually think the brokenness of Ord for floating point values is >> worse in many ways, as demonstrated by the ability to insert a value >> into a Data.Set.Set and have other values "disappear" from the set as >> a result. Getting an unexp

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Casey McCann
On Tue, Sep 20, 2011 at 6:58 PM, Daniel Fischer wrote: > On Wednesday 21 September 2011, 00:20:09, Casey McCann wrote: >> Because >> NaN values never compare equal to themselves, I'm not sure if it's >> even possible to remove them from the structure, &g

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Casey McCann
On Tue, Sep 20, 2011 at 6:05 PM, Chris Smith wrote: > There's nothing *wrong* with pragmatism, but in any case, we seem to > agree on this.  As I said earlier, we ought to impose a (rather > arbitrary) total order on Float and Double, and then offer comparison > with IEEE semantics as a separate s

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Casey McCann
On Tue, Sep 20, 2011 at 8:20 PM, Daniel Fischer wrote: > Yes, where NaNs matter, you always have to check (well, unless you *know* > that your calculations don't produce any NaNs). > Btw, -0.0 can be problematic too. How so? As far as I can tell Ord and Eq treat it as equal to 0.0 in every way, w

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-21 Thread Casey McCann
On Tue, Sep 20, 2011 at 11:47 PM, Richard O'Keefe wrote: > > On 21/09/2011, at 2:18 PM, Casey McCann wrote: >> >> I still don't see why it makes sense to add separate IEEE comparisons >> instead of just adding a standard partial order class, though. > &g

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-21 Thread Casey McCann
On Tue, Sep 20, 2011 at 11:33 PM, wrote: > For what it's worth, at some point in time I was sketching a proposal to > split the Enum class into two classes because I felt that two distinct ideas > were being conflated.  Unfortunately this was years ago and I have forgotten > what the details I wa

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-21 Thread Casey McCann
On Wed, Sep 21, 2011 at 12:09 AM, Daniel Fischer wrote: > Yes. Which can be inconvenient if you are interested in whether you got a > -0.0, so if that's the case, you can't simply use (== -0.0). > Okay, problematic is a too strong word, but it's another case that may > require special treatment.

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-21 Thread Casey McCann
On Wed, Sep 21, 2011 at 2:41 PM, Brandon Allbery wrote: > On Wed, Sep 21, 2011 at 14:31, Casey McCann wrote: >> >> My thoughts are that the first interpretation is most naturally suited >> to list range syntax, that the second would be better served by a >> slightly d