Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site

2010-07-19 Thread wren ng thornton
Malcolm Wallace wrote: I still like the original design on http://imgur.com/NjiVh a lot better, It has a simple modern design to it in my opinion :) +1. It is simply beautiful. Much more striking and memorable than the blue diver. I really like the background image; it's nicely striking an

Re: [Haskell-cafe] On documentation

2010-07-22 Thread wren ng thornton
David Waern wrote: 2010/7/21 Richard O'Keefe : One of the really nice ideas in the R statistics system is that documentation pages can contain executable examples, and when you wrap up a package for distribution, the system checks that the examples run as advertised. The next version of Haddoc

Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-22 Thread wren ng thornton
Magnus Therning wrote: On Thu, Jul 22, 2010 at 11:52, Ross Paterson wrote: On Thu, Jul 22, 2010 at 11:31:21AM +0100, Magnus Therning wrote: On Thu, Jul 22, 2010 at 10:59, Ross Paterson wrote: Magnus is building by directly running the Setup.hs himself, which ignores the Build-Type. To get c

Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-27 Thread wren ng thornton
aditya siram wrote: Eta-reducing is nice, and sometimes it makes code more readable. But 'flip' is one of those functions that always seems to hinder rather than help readability, conversely factoring out flip always makes code easier to comprehend. I don't see a need for its existence - maybe I'

Re: [Haskell-cafe] Re: Lists and monads

2010-07-27 Thread wren ng thornton
Kevin Jardine wrote: But as I said, that is just an example. I keep wanting to apply the usual list tools but find that they do not work inside a monad. I find myself wishing that f (m [a]) just automatically returned m f([a]) Are you looking for these? import Data.Traversable as T T.s

Re: [Haskell-cafe] monoids and monads

2010-07-27 Thread wren ng thornton
Henning Thielemann wrote: However the applicative functor laws from http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Applicative.html are quite unintuitive and the proofs are certainly not very illustrative. I always found it more illustrative to break it down and talk

[Haskell-cafe] Int and ByteStrings

2010-07-27 Thread wren ng thornton
Hey all, Is there a library function (f :: [Int] -> ByteString) such that it's prefix-preserving, and platform independent? GHC-only is fine for now. There are a bunch of functions of that type, but I need those guarantees and I'm hoping someone else has already done it. If there isn't one f

Re: [Haskell-cafe] Int and ByteStrings

2010-07-27 Thread wren ng thornton
Don Stewart wrote: wren: Hey all, Is there a library function (f :: [Int] -> ByteString) such that it's prefix-preserving, and platform independent? GHC-only is fine for now. There are a bunch of functions of that type, but I need those guarantees and I'm hoping someone else has already d

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread wren ng thornton
Tillmann Rendel wrote: C K Kashyap wrote: I am of the understanding that once you into a monad, you cant get out of it? That's not correct. Indeed. The correct formulation of the statement is that it's not "safe" to leave a monad. Where "safe" has the same connotation as in all the unsafe

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-07-30 Thread wren ng thornton
Ivan Lazar Miljenovic wrote: More and more people seem to be getting away from trying to say that monads are containers/burritos/etc. and just teaching them by way of the definition, either >>= and return or just join You always need return. The choice of primitives is: return, (>>=) or:

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread wren ng thornton
Martijn van Steenbergen wrote: In fact, I would argue that a monad which you cannot escape from is not very useful at all. IO is the only exception I know of. You can escape IO just fine. Just compile your program, and then run it in the real life monad. Results aren't guaranteed to be the sam

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread wren ng thornton
Alex Rozenshteyn wrote: I also found myself thinking about list as a monad in terms of this discussion. I think it's an interesting case: it's pure, but it doesn't really make sense to "come out of it". Head, indexing, and last all break out of it, but none of them can be the default, and all

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-07-30 Thread wren ng thornton
Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/30/10 11:48 , Ivan Lazar Miljenovic wrote: Ertugrul Soeylemez writes: it's a bit hidden in Haskell, but a monad instance consists of three functions: fmap :: (a -> b) -> (m a -> m b) You don't even need fm

Re: [Haskell-cafe] Re: Re: Can we come out of a monad?

2010-07-30 Thread wren ng thornton
Jason Catena wrote: By this example State doesn't seem to give you anything more than a closure would, since it doesn't act like much of an accumulator (by, for example, storing 6 as its new internal value). Reader r = (r->) Writer m = Monoid m => (m,) State s = (s->) . (s,) So, yes, the stat

Re: [Haskell-cafe] Definition of List type?

2010-07-30 Thread wren ng thornton
Ben Millwood wrote: On Fri, Jul 30, 2010 at 7:50 PM, Gregory Crosswhite wrote: The reason why this definition never actually appears is because it defines the constructors using operators rather than names, which is not allowed in vanilla Haskell. (There is an extension, TypeOperators, howev

Re: [Haskell-cafe] dear traversable

2010-07-30 Thread wren ng thornton
Ben wrote: unliftMap :: (Ord a) => M.Map a (b -> c) -> M.Map a b -> M.Map a c unliftMap mf ma = M.mapWithKey (\k v -> mf M.! k $ v) ma the first is obviously inefficient as it traverses the map twice. the second just seems like it is some kind of fmap. It's the (<*>) operator of Applicative,

Re: [Haskell-cafe] dear traversable

2010-07-30 Thread wren ng thornton
Ben wrote: dear traversable geniuses -- i am looking for "better" implementations of unzipMap :: M.Map a (b, c) -> (M.Map a b, M.Map a c) unzipMap m = (M.map fst m, M.map snd m) I don't think you can give a more efficient implementation using the public interface of Data.Map. You need to hav

Re: [Haskell-cafe] dear traversable

2010-07-31 Thread wren ng thornton
Stephen Tetley wrote: wren ng thornton wrote: Ben wrote: unzipMap :: M.Map a (b, c) -> (M.Map a b, M.Map a c) unzipMap m = (M.map fst m, M.map snd m) I don't think you can give a more efficient implementation using the public interface of Data.Map. You need to have a sort of

Re: [Haskell-cafe] dear traversable

2010-07-31 Thread wren ng thornton
Claude Heiland-Allen wrote: On 31/07/10 12:13, wren ng thornton wrote: Stephen Tetley wrote: wren ng thornton wrote: Ben wrote: unzipMap :: M.Map a (b, c) -> (M.Map a b, M.Map a c) unzipMap m = (M.map fst m, M.map snd m) I don't think you can give a more efficient implementation u

Re: [Haskell-cafe] dear traversable

2010-07-31 Thread wren ng thornton
wren ng thornton wrote: That O(n)+O(n) is much better than the O(n)*2*O(log n) foldrWithKey/insert version. But it's still about the same as the original 2*O(n) map fst/map snd version. With the primitive I mentioned we could reduce the constant factor by about half. Oops, the foldrWi

Re: [Haskell-cafe] Re: Microsoft's Singularity Project and Haskell

2010-07-31 Thread wren ng thornton
David Leimbach wrote: Haskell's great and all but it does have a few warts when it comes to how much real trust one should put into the type system. Some compromises still exist like unsafePerformIO that you can't detect simply by looking at the types of functions. In order to live up to the h

Re: [Haskell-cafe] Laziness question

2010-07-31 Thread wren ng thornton
Brandon S Allbery KF8NH wrote: michael rice wrote: Are you saying: [ head x ] -> [ *thunk* ] and length [ *thunk* ] -> 1, independent of what *thunk* is, even head [], i.e., *thunk* never needs be evaluated? Exactly. (I was being cagey because the first response was cagey, possibly su

Re: [Haskell-cafe] Re: Microsoft's Singularity Project and Haskell

2010-07-31 Thread wren ng thornton
Thomas DuBuisson wrote: And note that we wouldn't need unsafePerformIO for the FFI if all programs were made in Haskell ;). Perhaps that's true, though entirely unrealistic, in the application world. In the OS world you need access to machine registers and special instructions (CR3 anyone? CP1

Re: [Haskell-cafe] Re: dear traversable

2010-07-31 Thread wren ng thornton
Ben wrote: 4) ross, i had to ask ghci to even believe your code type-checks! i didn't realize currying worked that way -- i've never thought to pass in functions of different arities. as an experiment, i tried N.B. intersectionWith id == intersectionWith ($), which might cause it to make a b

[Haskell-cafe] Cabal LD errors

2010-08-01 Thread wren ng thornton
So I'm getting some weird linking errors from cabal-install when doing `cabal configure && cabal build` ld warning: atom sorting error for _postazm0zi2zi0_DataziMonoidziOrdziArgmax_Max_closure_tbl and _postazm0zi2zi0_DataziMonoidziOrdziArgmax_Min_closure_tbl in dist/build/Data/Monoid/Ord/Argm

Re: [Haskell-cafe] Cabal LD errors

2010-08-01 Thread wren ng thornton
Gregory Collins wrote: wren ng thornton writes: So I'm getting some weird linking errors from cabal-install when doing `cabal configure && cabal build` ld warning: atom sorting error for _postazm0zi2zi0_DataziMonoidziOrdziArgmax_Max_cl

Re: [Haskell-cafe] Why do "unsafe" foreign calls block other threads?

2010-08-05 Thread wren ng thornton
John Meacham wrote: 'reentrant' and 'blocking' which could be specified independently would be better and would be more future-proof against changes in the RTS or between compilers. +1. Perhaps we should propose it to the haskell' committee. -- Live well, ~wren ___

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread wren ng thornton
Henning Thielemann wrote: On Wed, 4 Aug 2010, John Meacham wrote: The numeric classes are sort of messed up when it comes to non integral values. (not that they are perfect for other things) for instance, realToFrac doesn't preserve NaN or Infinity, Why should realToFrac do this? NaN, Infini

Re: [Haskell-cafe] philosophy of Haskell

2010-08-08 Thread wren ng thornton
Alberto G. Corona wrote: But it seems that the trick is so productive because it comes from some fundamental properties of math, the reality, and maybe the human mind . Jost now I found this article: Categorial Compositionality: A Category Theory Explanation for the Systematicity of Human Cognit

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread wren ng thornton
Alexander Dunlap wrote: CaSSius and JSaesar? +1 for Cassius. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-09 Thread wren ng thornton
aditya siram wrote: Thanks all for you suggestions! Upon further reflection I realized that my audience is more pragmatic than theoretical. Instead of emphasizing how monads are constructed and the monad laws I think I want to dive right into the most common and useful monads. From my vantage po

Re: [Haskell-cafe] Re: Haskell in Industry

2010-08-10 Thread wren ng thornton
Henning Thielemann wrote: about functional programming jobs in investment banking ... Ketil Malde schrieb: Tom Hawkins writes: (Yes, I realize that's were the money is [...]) Exactly. I don't think this is bad: having talented people recruited to work on functional programming will improv

Re: [Haskell-cafe] Couple of questions about *let* within *do*

2010-08-10 Thread wren ng thornton
michael rice wrote: OK, then there's also an implicit *in* after the *let* in this code. Must the implicit (or explicit) *in* actually use the calculated value(s)? And, the monad can "continue on" after the *let* (with or without the *in*) as below, i.e., the *let* needn't be the last statemen

Re: [Haskell-cafe] universal quantification is to type instantiations as existential quantification is to what

2010-08-12 Thread wren ng thornton
Daniel Peebles wrote: The existential is a pair where one component is a type, and the type of the second component depends on the value (i.e., which type went in the first component) of the first. It's often called a sigma type when you have full dependent types. Not quite. Strong-sigma is a d

Re: [Haskell-cafe] universal quantification is to type instantiations as existential quantification is to what

2010-08-12 Thread wren ng thornton
Joshua Ball wrote: Hi, If I have a universally quantified type mapInt :: forall a. (Int -> a) -> [Int] -> [a] I can instantiate that function over a type and get a beta-reduced version of the type mapInt [String] :: (Int -> String) -> [Int] -> [String] (I'm borrowing syntax from Pierce here

Re: [Haskell-cafe] universal quantification is to type instantiations as existential quantification is to what

2010-08-13 Thread wren ng thornton
Dan Doel wrote: On Thursday 12 August 2010 7:59:09 pm wren ng thornton wrote: Not quite. Strong-sigma is a dependent pair where you can project both elements. Weak-sigma is a dependent pair where you can only project the first element (because the second is erased). Existentials are dependent

Re: [Haskell-cafe] Is bumping the version number evil, if it's not mandated by the PVP?

2010-08-14 Thread wren ng thornton
Sebastian Fischer wrote: Hello, I wonder whether (and how) I should increase the version number of a library when the API does not change but the implementation gets more efficient. I think it depends on how much more efficient. Constant factors of improvement are always nice, but they aren

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-14 Thread wren ng thornton
Yitzchak Gale wrote: Bryan O'Sullivan wrote: In general, Unicode uptake is increasing rapidly: http://googleblog.blogspot.com/2010/01/unicode-nearing-50-of-web.html These Google graphs are the oft-quoted source of Unicode's growing dominance. But the data for those graphs is taken from Google

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-15 Thread wren ng thornton
Bryan O'Sullivan wrote: As a case in point, I took the string search benchmark that Daniel shared on Friday, and boiled it down to a simple test case: how long does it take to read a 31MB file? GNU wc -m: - en_US.UTF-8: 0.701s text 0.7.1.0: - lazy text: 1.959s - strict text: 3.527s

Re: [Haskell-cafe] Assorted AT fun and games

2010-08-15 Thread wren ng thornton
Brandon S Allbery KF8NH wrote: On 8/15/10 09:00 , Andrew Coppin wrote: class (Vector (Point x)) => HasSpace x where type Point x :: * (...) And now things get *really* interesting. Consider this: data Foo x = Foo !x !(Point x) Surprisingly, GHC accepts this. This despite the rather obvi

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread wren ng thornton
Brandon S Allbery KF8NH wrote: only ordering of calls in the *current* thread of execution. (Which, hmm, implies that unsafePerformIO and unsafeInterleaveIO are conceptually similar to forkIO.) Implementationally they are very similar (at least as far as the baton is concerned). How hard we s

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread wren ng thornton
Bulat Ziganshin wrote: Johan wrote: So it's not clear to me that using UTF-16 makes the program noticeably slower or use more memory on a real program. it's clear misunderstanding. of course, not every program holds much text data in memory. but some does, and here you will double memory usage

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread wren ng thornton
Michael Snoyman wrote: On Tue, Aug 17, 2010 at 2:20 PM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: Michael Snoyman writes: I don't think *anyone* is asserting that UTF-16 is a common encoding for files anywhere, *ahem* http://en.wikipedia.org/wiki/UTF-16/UCS-2#Use_in_major_op

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread wren ng thornton
John Millikin wrote: The reason many Japanese and Chinese users reject UTF-8 isn't due to space constraints (UTF-8 and UTF-16 are roughly equal), it's because they reject Unicode itself. +1. This is the thing Unicode advocates don't want to admit. Until Unicode has code points for _all_ Chine

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread wren ng thornton
Johan Tibell wrote: To my knowledge the data we have about prevalence of encoding on the web is accurate. We crawl all pages we can get our hands on, by starting at some set of seeds and then following all the links. You cannot be sure that you've reached all web sites as there might be cliques i

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-17 Thread wren ng thornton
Ivan Lazar Miljenovic wrote: On 18 August 2010 12:12, wren ng thornton wrote: Johan Tibell wrote: To my knowledge the data we have about prevalence of encoding on the web is accurate. We crawl all pages we can get our hands on, by starting at some set of seeds and then following all the links

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-18 Thread wren ng thornton
Jinjing Wang wrote: John Millikin wrote: The reason many Japanese and Chinese users reject UTF-8 isn't due to space constraints (UTF-8 and UTF-16 are roughly equal), it's because they reject Unicode itself. +1. This is the thing Unicode advocates don't want to admit. Until Unicode has code poi

Re: [Haskell-cafe] and from standard Prelude

2010-08-18 Thread wren ng thornton
Oleg Lobachev wrote: #ifdef USE_REPORT_PRELUDE and = foldr (&&) True or = foldr (||) False #else and [] = True and (x:xs) = x && and xs or [] = False or (x:xs) = x || or xs {-# RULES "and/build" forall (g::forall b

Re: [Haskell-cafe] A cabal odyssey

2010-08-19 Thread wren ng thornton
Andrew Coppin wrote: I guess I just figured that since Cabal is used by hundreds of millions of people every single day, any little glitches I might have come across have already been seen by at least 1,000 people before me (and hence, the developers already know about it and just haven't had t

Re: [Haskell-cafe] ANNOUNCE: enumerator, an alternative iteratee package

2010-08-19 Thread wren ng thornton
John Millikin wrote: On Wed, Aug 18, 2010 at 23:33, Jason Dagit wrote: The main reason I would use iteratees is for performance reasons. To help me, as a potential consumer of your library, could you please provide benchmarks for comparing the performance of enumerator with say, a) iteratee, b

Re: [Haskell-cafe] ANNOUNCE: enumerator, an alternative iteratee package

2010-08-19 Thread wren ng thornton
John Millikin wrote: If you can recall the reasoning behind using ListLike or StreamChunk, it would be useful. Their advantages over simply using lists is not obvious to me. Well, one benefit is for efficient use of ByteStrings. Because the StreamChunk/ListLike class allows for non-parametric

Re: [Haskell-cafe] A cabal odyssey

2010-08-21 Thread wren ng thornton
Daniel Fischer wrote: On Saturday 21 August 2010 15:35:08, Ivan Lazar Miljenovic wrote: A Bazillion is an imaginary number meant to indicate something extremely large: http://en.wikipedia.org/wiki/Bazillion#-illion Yes, but 'extremely large' numbers mean different things, depending on whether

Re: [Haskell-cafe] Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-23 Thread wren ng thornton
Conal Elliott wrote: For anyone interested in iteratees (etc) and not yet on the iteratees mailing list. I'm asking about what iteratees *mean* (denote), independent of the various implementations. My original note (also at the end below): With the encouragement & help of Conrad Parker, I've

Re: [haskell-cafe] How to substitute FD like a -> b c by type families?

2010-08-23 Thread wren ng thornton
Vladimir Matveev wrote: I'm trying to implement the "Advanced Example : Type-Level Quicksort" from HaskellWiki using type families instead of functional dependencies. My code is at [1]. I substituted all 'many to one' functional dependencies like xs ys -> zs by explicit type families, but I don't

Re: [Haskell-cafe] Higher-order algorithms

2010-08-23 Thread wren ng thornton
Eugene Kirpichov wrote: Do there exist other nontrivial higher-order algorithms and datastructures? Is the field of higher-order algorithms indeed as unexplored as it seems? Many algorithms in natural language processing can be captured by higher-order algorithms parameterized by the choice of

Re: [Haskell-cafe] Higher-order algorithms

2010-08-24 Thread wren ng thornton
On 8/24/10 12:29 AM, wren ng thornton wrote: All of these are the same algorithm, just with different (augmented) semirings. In order to prevent underflow for very small probabilities, we usually run these algorithms with probabilities in the log-domain. Those variants are also the same

Re: [Haskell-cafe] Higher-order algorithms

2010-08-24 Thread wren ng thornton
On 8/24/10 11:10 AM, Daniel Peebles wrote: Interesting. I've come across this general idea/algorithm the factor graph / sum-product algorithm papers[1] but I was wondering if you knew of any implementations of it in haskell? I wrote one a while back but it was fairly ugly and not as general as I'

Re: [Haskell-cafe] Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-24 Thread wren ng thornton
On 8/24/10 3:54 AM, C. McCann wrote: What sets an iteratee-style design apart from something conventional based on a State monad is that the iteratee conceals its internal state completely (in fact, there's no reason an iteratee even has to be the "same" function step-to-step, or have a single co

Re: [Haskell-cafe] and from standard Prelude

2010-08-24 Thread wren ng thornton
On 8/24/10 1:55 PM, Jan-Willem Maessen wrote: On Wed, Aug 18, 2010 at 9:56 PM, wren ng thornton wrote: The thing I find puzzling is that the foldr is inlined. The (regular) clever optimizations for build/foldr seem like they should already handle this without the need for the extra rules. I

Re: [Haskell-cafe] the overlapping instance that wasn't?

2010-08-24 Thread wren ng thornton
On 8/24/10 5:12 PM, C. McCann wrote: The problem is that instance selection doesn't work the (obvious, seemingly-sensible) way you thought it did. In short, instance contexts are only examined after the fact; [...] The reason it works this way has to do with the nature of type classes being "open

Re: [Haskell-cafe] open and closed

2010-08-30 Thread wren ng thornton
On 8/29/10 1:33 PM, Gábor Lehel wrote: Another thing I'm wondering about is that there's a fairly intuitive correspondence between functions at the value level vs. functions at the type level, and datatypes to classify the value level vs. datakinds to classify the type level, but what corresponds

Re: [Haskell-cafe] ANNOUNCE: Haddock version 2.8.0

2010-09-03 Thread wren ng thornton
On 9/2/10 9:57 PM, John Millikin wrote: Is there any particular reason you're using XHTML instead of HTML? You're using a transitional doctype, invalid IDs, and the .html file extension -- in short, HTML with an incorrect doctype. The markup doesn't even validate. Because HTML is evil? Though,

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread wren ng thornton
On 9/3/10 12:16 AM, Ivan Lazar Miljenovic wrote: 1) How should I name the kind * versions? For example, the kind * version of Functor is currently called Mappable with a class method of rigidMap. What should I call the kind * version of Foldable and its corresponding methods? Is there a valid

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread wren ng thornton
On 9/4/10 3:50 AM, Ivan Lazar Miljenovic wrote: On 4 September 2010 17:40, wren ng thornton wrote: So, in the interest of generality, perhaps you should just pick a letter or a short prefix and use that for each of the classes. In my blog posts I called them 0-monads, 1-monads, and 2-monads

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread wren ng thornton
On 9/5/10 10:19 AM, Ivan Lazar Miljenovic wrote: Hmmm is there any reason for Functor to be a superclass of Pointed? I understand Functor and Pointed being superclasses of Applicative (which in turn is a superclass of Monad), but can't see any relation between Pointed and Functor... Becaus

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/6/10 2:35 AM, Ivan Lazar Miljenovic wrote: Well, if we consider what this does, pure is equivalent to singleton for container types. The actual definition of pure (or any other aspect of Pointed) doesn't require Functor; however there are properties for types that are instances of Functor a

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/6/10 1:33 PM, David Menendez wrote: For that matter, can you even describe what pure is intended to do without reference to<*> or join? As already stated: fmap f . pure = pure . f -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@h

[Haskell-cafe] Pointed (was: Re: Restricted type classes)

2010-09-06 Thread wren ng thornton
On 9/6/10 11:50 AM, Gábor Lehel wrote: On Mon, Sep 6, 2010 at 5:11 PM, John Lato wrote: But please don't make Pointed depend on Functor - we've already seen that it won't work for Bloom filters. I think most people have been using "Pointed" merely as shorthand for "Pointed Functor" -- in the

Re: [Haskell-cafe] container-classes (was: Restricted type classes)

2010-09-06 Thread wren ng thornton
On 9/6/10 12:53 PM, John Lato wrote: I'd like to make one more argument in favor of my preference for more splitting of type classes. FWIW, I agree that more splitting is generally good. This is one of the problems I have with the various proposals for a ListLike class. They conflate the cons

Re: [Haskell-cafe] container-classes

2010-09-06 Thread wren ng thornton
On 9/6/10 11:46 PM, Ivan Lazar Miljenovic wrote: Well, my current work is to implement restricted versions of the various type classes (I'm undecided if they should be split off into a separate package or not) and then have the Data.Containers module basically define type aliases (which will prob

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/7/10 12:04 AM, Ivan Lazar Miljenovic wrote: Perhaps this just means that union/insert should be part of some other class. That is part of the plan (I'm tentatively calling the class with the "insert" method "Buildable" or "Extendable"); this means that if a type is an instance of Monoid (f

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread wren ng thornton
On 9/7/10 12:33 AM, Ivan Lazar Miljenovic wrote: On 7 September 2010 14:24, wren ng thornton wrote: On 9/7/10 12:04 AM, Ivan Lazar Miljenovic wrote: Not quite sure what you mean by a "mis-match" Just that they're not the same thing. For example, ZipList supports pur

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread wren ng thornton
On 9/7/10 7:26 AM, Neil Brown wrote: On 07/09/10 05:24, wren ng thornton wrote: Just that they're not the same thing. For example, ZipList supports pure but it has no meaningful instance of singleton since every ZipList is infinite. I don't believe that every ZipList is infinit

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread wren ng thornton
On 9/7/10 4:21 AM, Daniel Fischer wrote: On Tuesday 07 September 2010 05:22:55, David Menendez wrote: In fact, I think *every* appropriately-typed function satisfies that law. Does anyone know of a counter-example? -- | Multiply the *Hask* category by its number of objects. data E a wh

Re: [Haskell-cafe] Handling platform- or configuration-specific code (or, my CPP complaints)

2010-09-08 Thread wren ng thornton
On 9/7/10 3:10 PM, Ben Millwood wrote: So I wonder what people think of the use of CPP in Haskell code, what alternatives people can propose, or what people hope to see in future to make conditional compilation of Haskell code more elegant and simple? The only thing I ever use CPP for in Haskel

Re: [Haskell-cafe] Restricted type classes

2010-09-09 Thread wren ng thornton
On 9/9/10 1:04 AM, David Menendez wrote: Fascinating. I figured there might be a counter-example involving seq, but this is pretty subtle. In particular, would it be fair to say that in Haskell-without-seq, "E (f a) a" and "E (f a) (f a)" are indistinguishable? Yes, I think that without polymo

Re: [Haskell-cafe] Restricted type classes

2010-09-10 Thread wren ng thornton
On 9/10/10 12:47 AM, David Menendez wrote: It seems like you could use a similar argument to show that fmap id /= id. Specifically, xs and map id xs are equivalent lists, but they occupy different locations in memory. By replacing xs with map id xs, you can come arbitrarily close to doubling a p

Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-11 Thread wren ng thornton
On 9/11/10 3:43 PM, Daniel Fischer wrote: - is there a "specification" of which are the "core" packages? "core" as in *do not update*? Basically, what comes with GHC shouldn't be updated. Though I heard updating Cabal was okay. I tried updating Cabal once (recently) and it broke things in the

Re: [Haskell-cafe] Re: Scraping boilerplate deriving?

2010-09-15 Thread wren ng thornton
On 9/15/10 9:11 AM, Kevin Jardine wrote: Hi Malcolm, In this case, I am counting on GHC's {-# LANGUAGE GeneralizedNewtypeDeriving #-} feature to derive the instances for the classes I am including in the deriving clause. So perhaps portability is not a big issue here in any case. Yes, but G

Re: [Haskell-cafe] Memoization/call-by-need

2010-09-15 Thread wren ng thornton
On 9/15/10 10:39 PM, Conal Elliott wrote: Hi Alex, In Haskell, data structures cache, while functions do not. Exactly. What this means is that when you call (slowFib 50) Haskell does not alter slowFib in any way to track that it maps 50 to $whatever; however, it does track that that particul

Re: [Haskell-cafe] Re: Do expression definition

2010-09-15 Thread wren ng thornton
On 9/13/10 6:22 AM, Michael Lazarev wrote: Thanks for examples and pointers. Since I came from Lisp, it never occurred to me that let and lambda are different constructs in Haskell. I thought that let x = y in f is really (\x -> f) y It turns out that let is about declarations which a

Re: [Haskell-cafe] Re: Full strict functor by abusing Haskell exceptions

2010-09-15 Thread wren ng thornton
On 9/13/10 6:23 PM, Paolo G. Giarrusso wrote: Then, I would also like to understand what exactly a strict functor is, in detail, and/or a link to the post you reference. I'm assuming the OP was referring to a functor for strictness I mentioned recently in the discussion about pointed functors.

Re: [Haskell-cafe] Re: Re: Do expression definition

2010-09-17 Thread wren ng thornton
On 9/16/10 4:59 PM, Ben Franksen wrote: wren ng thornton wrote: The difference is that, for let-bindings, once you've figured out a type of the variable being bound, then that type can be "generalized". [...] Whereas, lambda-bindings don't get generalized, and so they'

Re: [Haskell-cafe] Re: Re: Re: Full strict functor by abusing Haskell exceptions

2010-09-17 Thread wren ng thornton
On 9/17/10 4:39 PM, Ben Franksen wrote: Thanks for the link. What I actually wanted was a mathematical definition, though. From the TMR article I gather that a pointed functor could be defined as an endo-functor F: C -> C together with a natural transformation pure: Id -> F where Id:

Re: [Haskell-cafe] example in "All about Monads"

2010-09-17 Thread wren ng thornton
On 9/17/10 12:48 PM, ender wrote: my question is, why not define the function father and mother as type of father::Maybe Sheep -> Maybe Sheep? this can also clean the code and it avoid the additional function comb Do note that `comb` is giving you a natural way of creating those functions:

Re: [Haskell-cafe] Re: Re: Re: Do expression definition

2010-09-17 Thread wren ng thornton
On 9/17/10 4:04 PM, Ben Franksen wrote: wren ng thornton wrote: Note that when compilers do CPS conversion, everything is converted into let-binding and continuations (i.e., longjump/goto with value passing). It's just dual to the everything-is-lambda world, nothing special. Do you k

Re: [Haskell-cafe] Re: Re: Re: Full strict functor by abusing Haskell exceptions

2010-09-18 Thread wren ng thornton
On 9/18/10 8:00 AM, Sjoerd Visscher wrote: On Sep 17, 2010, at 10:39 PM, Ben Franksen wrote: What I actually wanted was a mathematical definition, though. Here's a definition of pointed objects: http://ncatlab.org/nlab/show/pointed+object pointed objects, pointed sets/groups/topospaces, poi

Re: [Haskell-cafe] Shared thunk optimization. Looking to solidify my understanding

2010-09-22 Thread wren ng thornton
On 9/22/10 11:48 AM, Daniel Fischer wrote: On Wednesday 22 September 2010 17:10:06, David Sankel wrote: The following code (full code available here[1], example taken from comments here[2]), const' = \a _ -> a test1 c = let a = const' (nthPrime 10) in (a c, a c) test2 c = let

Re: [Haskell-cafe] Simple question about the function composition operator

2010-09-25 Thread wren ng thornton
On 9/24/10 5:35 AM, Axel Benz wrote: Can anybody explain why this happens and how I can compose f and g? Hint: It works fine if f is defined as an unary function. As already mentioned: (g . f) x y = (\z-> g (f z)) x y = g (f x) y In order to get it to work you need to say that you want to pas

Re: [Haskell-cafe] Re: Shared thunk optimization. Looking to solidify my understanding

2010-09-25 Thread wren ng thornton
what I was pointing out in in the post described as: On Wed, Sep 22, 2010 at 11:10 AM, David Sankel wrote: wren ng thornton provided an evaluation using another operational semantics (reference?). Under this semantics, this optimization would be called partial evaluation. Unfortunately I couldn&#

Re: [Haskell-cafe] Applicative instances for Monads

2010-09-25 Thread wren ng thornton
On 9/24/10 10:01 PM, Gregory Crosswhite wrote: Hey everyone, There is something that has been bugging me recently about the Applicative class and the Monad class. Any type constructor F that is a Monad has a natural Applicative instance, (<$>) :: F (a -> b) -> F a -> F b mf <$> ma = do f <- mf

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread wren ng thornton
On 10/2/10 3:13 PM, Christopher Done wrote: There's nothing more annoying than having to introduce intermediate bindings when you're going to immediate pattern match against it immediately and never use it again. It's both annoying to have to think of a variable name that makes sense and is not i

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread wren ng thornton
On 10/3/10 5:52 PM, Victor Nazarov wrote: I suggest to pay more attention to haskell's standard library. "allButLast" is called "init" in Data.List module. Second, do not use explicit recursion. You can capture recursion using some high-order function like map, filter, foldr and so on: lastToT

Re: [Haskell-cafe] Ordering vs. Order

2010-10-08 Thread wren ng thornton
On 10/7/10 8:35 AM, Ketil Malde wrote: Christian Sternagel writes: recently I was wondering about the two words "order" and "ordering" I would use "ordering" to mean the relation or function that orders (ranks) elements, and I'd use "order" to refer the actual progression. So by applying an o

Re: [Haskell-cafe] Layered maps

2010-10-08 Thread wren ng thornton
On 10/8/10 5:46 PM, Thomas DuBuisson wrote: Alex, The containers library can do this already - there are no constraints on the elements of a Map. For example: type TripleNestedMap a = Map Int (Map Char (Map String a)) But this is rather silly as you can just do: type MapOfTriples a = Map

Re: [Haskell-cafe] Layered maps

2010-10-09 Thread wren ng thornton
On 10/9/10 2:02 AM, Alex Rozenshteyn wrote: This came up as I was doing homework for natural language processing. I'm constructing a trigram model from training data, but I also need the bigram and unigram counts. I could, for each triple of characters, add the 3 tuple to a trigram map and incr

Re: [Haskell-cafe] Re: Re-order type (flip map)

2010-10-10 Thread wren ng thornton
On 10/10/10 7:00 PM, Johannes Waldmann wrote: My point was: you need to find/define two operators, not just one. Sure, I need flip ($) and flip (.) Since the Prelude forgot to define these (and flip map), the question was: are there established names for these two operators? I don't kn

Re: [Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-16 Thread wren ng thornton
On 10/16/10 10:48 AM, Ben Franksen wrote: Don Stewart wrote: It is open source, and was born open source. It is the product of research. How can a language be open source, or rather, how can it *not* be open source? The point of a (programming) language is that it has a published ('open') defi

Re: [Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-16 Thread wren ng thornton
On 10/16/10 11:34 AM, Ben Franksen wrote: Christopher Done wrote: To solve this ambiguity that phrase is a link that people can click to find out what it means. "Object oriented", "dynamically typed", "stack-based" are about as meaningful. The difference may be that everyone thinks he knows wh

Re: [Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-16 Thread wren ng thornton
On 10/16/10 11:22 AM, Ben Franksen wrote: Much better. Though I *do* think mentioning the main implementations and their qualities is a good thing to o, right after this: "[...]The most important Haskell implementation, ghc [like to ghc page], has served as a test bed for practical application o

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