[Haskell-cafe] Re: Bathroom reading

2007-08-14 Thread Chad Scherrer
Maybe something of these? http://www.haskell.org/haskellwiki/Blow_your_mind -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] monte carlo trouble

2007-08-15 Thread Chad Scherrer
without even requiring the length of the list to be known in advance, that could lead to a solution. Thanks, Chad On 8/15/07, Paul Johnson [EMAIL PROTECTED] wrote: Chad Scherrer wrote: There's a problem I've been struggling with for a long time... I need to build a function buildSample

Re: [Haskell-cafe] monte carlo trouble

2007-08-15 Thread Chad Scherrer
Funny you should say that, I was just experimenting with generating one at a time using (StateT StdGen Maybe). If I get stuck (again) I'll check out ListT. Thanks! Chad On 8/15/07, Paul Johnson [EMAIL PROTECTED] wrote: Chad Scherrer wrote: Thanks for your replies. I actually starting out

Re: [Haskell-cafe] monte carlo trouble

2007-08-15 Thread Chad Scherrer
isn't so well studied, the bulk of the work is in finding the right abstraction, which forces generalization beyond what would otherwise be needed (though it'll be easier the next time!). On 8/15/07, Paul Johnson [EMAIL PROTECTED] wrote: Chad Scherrer wrote: Funny you should say that, I

Re: [Haskell-cafe] monte carlo trouble

2007-08-16 Thread Chad Scherrer
from the GC. Or maybe it's a strictness/laziness issue I'm missing. Still not so sure when I need case vs let/where. How would you guys going about tracking down the problem? Thanks, Chad On 8/15/07, Paul Johnson [EMAIL PROTECTED] wrote: Chad Scherrer wrote: Thanks for your replies. I

[Haskell-cafe] gtk2hs in Ubuntu Gutsy

2007-10-04 Thread Chad Scherrer
Depends: libghc6-cairo-dev but it is not going to be installed Do any of you guys know why this wouldn't include a newer version? Probably just an oversight, I'm guessing. -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx

[Haskell-cafe] Re: Suspected stupid Haskell Question

2007-10-17 Thread Chad Scherrer
Big_Ham joymachine2001 at hotmail.com writes: Is there a library function to take a list of Strings and return a list of ints showing how many times each String occurs in the list. So for example: [egg, egg, cheese] would return [2,1] I couldn't find anything on a search, or

Re: [Haskell-cafe] Re: Suspected stupid Haskell Question

2007-10-17 Thread Chad Scherrer
Hmm, is insertWith' new? If I remember right, I think the stack overflows were happening because Map.insertWith isn't strict enough. Otherwise I think the code is the same. But I would expect intTable to be faster, since it uses IntMap, and there's no IntMap.insertWith' as of 6.6.1 (though it may

[Haskell-cafe] Using Data.Binary for compression

2007-11-14 Thread Chad Scherrer
Hi, I'd like to be able to use Data.Binary (or similar) for compression. Say I have an abstract type Symbol, and for each value of Symbol I have a representation in terms of some number of bits. For compression to be efficient, commonly-used Symbols should have very short representations, while

[Haskell-cafe] functional maps

2007-12-21 Thread Chad Scherrer
A while back I was playing with Data.Map was getting irritated about lookups that fail having the type of values, but wrapped in an extra monad. I decided to work around this by putting a default in the data type itself, so we have a functional map data FMap k a = FMap (k - a) (Map k a) This has

[Haskell-cafe] Re: functional maps

2007-12-21 Thread Chad Scherrer
Chad Scherrer chad.scherrer at gmail.com writes: A while back I was playing with Data.Map was getting irritated about lookups that fail having the type of values, but wrapped in an extra monad. I decided to work around this by putting a default in the data type itself, so we have

[Haskell-cafe] Re: replicateM over vectors

2010-04-03 Thread Chad Scherrer
Roman Leshchinskiy rl at cse.unsw.edu.au writes: Ah. I missed that. Then your best bet is probably replicate n action = munstream v $ Fusion.Stream.Monadic.generateM n (const action) $ new n It's uglier that it should be but vector simply doesn't define

[Haskell-cafe] bounded ranges

2010-07-22 Thread Chad Scherrer
Hello cafe, I'm trying to do some things with bounded indices so I can carry around arrays (well, Vectors, really) without needing to refer to the bounds. For example, if I know my indices are Bool values, I can do rangeSize (minBound, maxBound :: Bool) 2 I'd like to be able to do this in

[Haskell-cafe] Re: bounded ranges

2010-07-22 Thread Chad Scherrer
On Thu, 22 Jul 2010, Chad Scherrer wrote: I thought it might help to put it into a module and do a better job with the type, like this: bdRangeSize :: (Ix i, Bounded i) = i - Int bdRangeSize _ = rangeSize (minBound, maxBound :: i) Henning Thielemann lemming at henning-thielemann.de

Re: [Haskell-cafe] bounded ranges

2010-07-22 Thread Chad Scherrer
On Thu, Jul 22, 2010 at 3:43 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: {-# LANGUAGE ScopedTypeVariables #-} bdRangeSize :: forall i. (Ix i, Bounded i) = i - Int Ah nice, I tried a forall in that position, but I didn't know about ScopedTypeVariables. Thanks! Chad

[Haskell-cafe] Re: Newbie request

2006-06-09 Thread Chad Scherrer
Philip,you wrote:-I am trying to learn Haskell. As an exercise, I wrote afunction to create a binary tree in level-order. I am attaching the code. I am sure there are a number of places wherethe code could be

[Haskell-cafe] Learning C after Haskell

2006-06-12 Thread Chad Scherrer
Ok, so I'm doing things somewhat backward. I've been using Haskell for a while now, whenever I get a chance to. But in order to become more involved in high-performance computing projects at my work, I need to learn C. I've heard a lot of people say that experience in Haskell can improve one's

Re: [Haskell-cafe] Learning C after Haskell

2006-06-12 Thread Chad Scherrer
Subject: Re: [Haskell-cafe] Learning C after HaskellTo: Chad Scherrer [EMAIL PROTECTED]hi,C is very different from Haskell.* you'lle have to manage explicitly memory de/allocation. * c programming is a bit like haskell io monad programming (butwithout the functionnal part) :you'lle use = in place

[Haskell-cafe] Re: Learning C after Haskell

2006-06-13 Thread Chad Scherrer
Thanks for all the replies - this has helped a lot! ChadOn 6/12/06, Chad Scherrer [EMAIL PROTECTED] wrote: Ok, so I'm doing things somewhat backward. I've been using Haskell for a while now, whenever I get a chance to. But in order to become more involved in high-performance computing projects

[Haskell-cafe] Re: Speed of ByteString.Lazy

2006-06-29 Thread Chad Scherrer
Then I should be thanking Duncan as well (thanks!). I had seen the array fusion idea before in the NDP work, but I hadn't thought of applying to this area. I wonder where else the concept might apply? Is there a typeclass to be built? -- Chad ScherrerTime flies like an arrow; fruit flies like a

[Haskell-cafe] Hackathon hesitation

2006-07-12 Thread Chad Scherrer
Hi, I'm interested in attending the Hackathon, but I don't have any previous experience working on compilers. I think it could be a great learning experience, but I certainly don't want to slow progress on any work by just hanging around asking questions. I'm a mathematician/statistician, and my

[Haskell-cafe] Windows PowerShell Monad

2006-07-14 Thread Chad Scherrer
Yep, that's its codename. Now, I'm not much of a Windows person. Is the name just a weird coincidence, or does it have anything to do with monads as we know them? http://en.wikipedia.org/wiki/MSH_(shell) -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx

Re: [Haskell-cafe] Windows PowerShell Monad

2006-07-15 Thread Chad Scherrer
yet, and already the mainstream-to-be is taking over the google results. Googling for microsoft monad gives all powershell and no MS Research! -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing

[Haskell-cafe] deepSeq vs. rnf?

2006-07-18 Thread Chad Scherrer
Now and again I see references to deepSeq, and I've never understood how this could be any different than using rnf from Control.Parallel.Strategies. Is there really any difference? When is it better to use one or the other? Thanks, -- Chad Scherrer Time flies like an arrow; fruit flies like

[Haskell-cafe] REALLY simple STRef examples

2006-07-20 Thread Chad Scherrer
maybe I needed to replace 1 with (1 :: Int) so the state representation didn't force the type, but it still gives the same result. Can someone point me to the simplest possible runST example that actually works? Thanks! -- Chad Scherrer Time flies like an arrow; fruit flies like a banana

Re: [Haskell-cafe] REALLY simple STRef examples

2006-07-20 Thread Chad Scherrer
Whoa. That changes everything I thought I knew about ($). Come to think of it, one of the examples that does work it written main = print $ runST f where f is defined separtely. So that's consistent. I'll take a look at the references. Thanks! Indeed. The short answer: use runST (long

Re: [Haskell-cafe] REALLY simple STRef examples

2006-07-20 Thread Chad Scherrer
mapM_ (x0 +=) xs x0 -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re[2]: [Haskell-cafe] REALLY simple STRef examples

2006-07-20 Thread Chad Scherrer
Are the types of (result x) and result' not exactly the same? -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re[4]: [Haskell-cafe] REALLY simple STRef examples

2006-07-21 Thread Chad Scherrer
The IO monad hasn't given me too much trouble, but I want to be sure to structure things the way they should be. If I get everything running using IO first and then have type-checking problems with ST, it will be tempting to just slap on an unsafePerformIO and call it good. Sure, it's really

Re: [Haskell-cafe] REALLY simple STRef examples

2006-08-05 Thread Chad Scherrer
! Of course there is no problem if you don' use the higher order function $. Use parens instead x = runST (return 1) Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of | Chad Scherrer | Sent: 19 July 2006 23:02 | To: haskell-cafe@haskell.org

[Haskell-cafe] Expressing seq

2006-09-27 Thread Chad Scherrer
not just do something like this (in ghci)? Prelude let sq x y = if x == x then y else y Prelude 1 `sq` 2 2 Prelude (length [1..]) `sq` 2 Interrupted. There must be a subtlety I'm missing, right? -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx

Re: [Haskell-cafe] Expressing seq

2006-09-27 Thread Chad Scherrer
There must be a subtlety I'm missing, right? What if the types are not instances of Eq? Jason Thanks, I figured it was something simple. Now I just to convince myself there's no way around that. Is there a proof around somewhere? -- Chad Scherrer Time flies like an arrow; fruit flies

Re: [Haskell-cafe] smallest double eps

2006-09-29 Thread Chad Scherrer
-- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] smallest double eps

2006-09-30 Thread Chad Scherrer
Hang on, hang on, now I'm getting confused. First you asked for the smallest (positive) x such that 1+x /= x which is around x=4.5e15. Then Joachim wondered if you wanted 1+x /= 1 which is around x=2.2e-16. But not you claim to be looking for the smallest positive number that a Double

Re: [Haskell-cafe] cumulative sum

2006-10-02 Thread Chad Scherrer
Tamas, try scanl (+) 0 for the cumulative sum From there the zipWith idea you mentioned seems like the way to go. -Chad Hi, I have two lists, p and lambda (both are finite). I would like to calculate 1) the cumulative sum of lambda, ie if lambda = [lambda1,lambda2,lambda3,...] then

[Haskell-cafe] DiffTime in Data.Time

2006-10-02 Thread Chad Scherrer
I'm trying to use Data.Time, and I'm totally confused. DiffTime is abstract, and I don't see anything that maps into it. How do I construct one? I would like to then use the result to create a value of type UTCTime, but it seems (currently) like this might be easier. Thanks, -- Chad Scherrer

[Haskell-cafe] Re: DiffTime in Data.Time

2006-10-02 Thread Chad Scherrer
Ok, that's much simpler than I was making it. fromIntegral or fromRational does the trick. Obvious in hindsight, I guess. Thanks! -Chad On 10/2/06, Ashley Yakeley [EMAIL PROTECTED] wrote: Chad Scherrer wrote: I'm trying to use Data.Time, and I'm totally confused. DiffTime is abstract, and I

[Haskell-cafe] deepSeq vs rnf

2006-10-22 Thread Chad Scherrer
missing, but it seems to me they're basically the same. -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] deepSeq vs rnf

2006-10-22 Thread Chad Scherrer
Interesting, I hadn't thought of the SYB approach. I still need to get through those papers. Actually, I wonder if this idea would help with something else I was looking into. It seems like it might occasionally be useful to have a monad that is the identity, except that it forces evaluation as

[Haskell-cafe] monadic performance

2006-10-27 Thread Chad Scherrer
Hello, I've written some code that does a foldl (or scanl, depending on my mood) kind of thing, and builds a huge tree structure as it goes along. I've been careful to make inserts as strict (and eager) as possible, since I know all the pieces will be evaluated eventually anyway. Now I'd like to

Re: [Haskell-cafe] monadic performance

2006-10-30 Thread Chad Scherrer
On 10/28/06, Tomasz Zielonka [EMAIL PROTECTED] wrote: On Fri, Oct 27, 2006 at 06:28:58AM -0700, Chad Scherrer wrote: Should I expect a monadic version to take a performance hit? What if I use some SPECIALIZE pragmas or somesuch? Is it more efficient to write one from scratch, or do specific

[Haskell-cafe] Re: Haskell-Cafe Digest, Vol 39, Issue 6

2006-11-02 Thread Chad Scherrer
Lemmih wrote: Using 'seq' is generally a bad idea. It can worsen the performance if not used carefully and GHCs strictness analyser is usually good enough. Is GHC.Conc.pseq any better? Usually the whole point of making things more strict is to optimize performance for pieces you know will be

[Haskell-cafe] Efficiency of bang patterns

2006-11-07 Thread Chad Scherrer
the role of the strictness analysis step. But being able to easily make things really strict seems pretty important, and there seem to be a lot of subtleties to using seq that make it difficult to tune for performance. -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho

[Haskell-cafe] Re: what are the points in pointsfree?

2006-12-15 Thread Chad Scherrer
for program transformation and derivation from specification (Bird-Meertens formalism) The only disadvantage I know of is that it can lead to obfuscation, especially if Haskell hasn't twisted your brain yet (in a good way). -- Chad Scherrer Time flies like an arrow; fruit flies like a banana

[Haskell-cafe] MVar style question

2007-01-04 Thread Chad Scherrer
When using MVars, is there a reason to prefer using MVar (a,b) over (MVar a, MVar b), or vice versa? I'm not sure if this is really a question of style, or if there are practial implications I'm missing one way or another. Thanks! -- Chad Scherrer Time flies like an arrow; fruit flies like

Re: [Haskell-cafe] MVar style question

2007-01-05 Thread Chad Scherrer
invariants that span the two? Put operationally, do you want different threads to be able to access a and b concurrently? -m Chad Scherrer [EMAIL PROTECTED] writes: When using MVars, is there a reason to prefer using MVar (a,b) over (MVar a, MVar b), or vice versa? I'm not sure if this is really

[Haskell-cafe] STM and random numbers

2007-01-12 Thread Chad Scherrer
Hi, I'd like to be able to use randomIO, but I'm working within the context of STM. Is there a way to get these working together happily? For now, I guess I could kludgingly use unsafePerformIO inside STM (it's the other way around that's not allowed, right?), but I would need to be sure it

Re: [Haskell-cafe] STM and random numbers

2007-01-12 Thread Chad Scherrer
Wow, lots of great ideas. Thanks, guys. Lemmih, I worry about the uncertainty in the semantics that seems to be introduced by the unsafe stuff. But I actually hadn't noticed GHC.Conc.unsafeIOToSTM before, so it's good to know it's there. Rich, Even if I use randomIO outside the STM code, I

[Haskell-cafe] newTArrayIO

2007-01-26 Thread Chad Scherrer
testing with this beyond type checking, but it seems like it could be useful for similar cases to newTVarIO. Has anyone else played with anything similar? -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe

[Haskell-cafe] (a - [b]) vs. [a - b]

2007-02-01 Thread Chad Scherrer
Are (a - [b]) and [a - b] isomorphic? I'm trying to construct a function f :: (a - [b]) - [a - b] that is the (at least one-sided) inverse of f' :: [a - b] - a - [b] f' gs x = map ($ x) gs It seems like it should be obvious, but I haven't had any luck with it yet. Any help is greatly

Re: [Haskell-cafe] (a - [b]) vs. [a - b]

2007-02-02 Thread Chad Scherrer
in this context. On 2/2/07, Yitzchak Gale [EMAIL PROTECTED] wrote: Chad Scherrer wrote: Are (a - [b]) and [a - b] isomorphic? I'm trying to construct a function f :: (a - [b]) - [a - b] that is the (at least one-sided) inverse of f' :: [a - b] - a - [b] f' gs x = map ($ x) gs Anything

[Haskell-cafe] Monolithic module tool

2007-02-08 Thread Chad Scherrer
Maybe a year or so ago, I came across a tool for Haskell that takes a collection of modules, does some name-mangling, and gives a single module that only needs to export main. There were wonderful reductions in the size of the resulting executable, and potentially more optimizations available to

[Haskell-cafe] Re: Leaves of a Tree

2007-02-21 Thread Chad Scherrer
Tom, I think inserting elements would be a lot faster than multiple unions. I would try: leafList :: Tree - [Int] leafList (Leaf n) = [n] leafList (Branch left right) = leafList left ++ leafList right leaves = fromList . leafList If you're writing many functions on Trees (or maybe even if

[Haskell-cafe] Re: Leaves of a Tree

2007-02-21 Thread Chad Scherrer
Neil, I think this idea is better than what I had suggested, but as it stands it doesn't typecheck. Did you mean something like this? leaves :: Tree - [Int] leaves = f [] where f rest (Leaf n) = n : rest f rest (Branch l r) = f (f rest r) l -Chad ---

[Haskell-cafe] Re: Leaves of a Tree

2007-02-21 Thread Chad Scherrer
Hi Tom, Tom Hawkins wrote: Folding was my first approach: leaves :: Tree - Set Int leaves tree = accumLeaves Set.empty tree accumLeaves :: Set Int - Tree - Set Int accumLeaves set (Leaf n) = insert n set accumLeaves set (Branch l r) = foldl accumLeaves set [l,r] However, with this approach I

[Haskell-cafe] numeric minimization in Haskell

2007-02-28 Thread Chad Scherrer
if possible. Thanks! -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] numeric minimization in Haskell

2007-02-28 Thread Chad Scherrer
On 2/28/07, Dan Weston [EMAIL PROTECTED] wrote: GSL is written in C, and I don't know any language more portable than that! gsl_vector and gsl_matrix use a continuous block of doubles, so you can use the FFI to marshall this however you want for efficiency. I'd stick with GSLHaskell until

[Haskell-cafe] Abstracting ByteStrings

2008-01-22 Thread Chad Scherrer
of this subsumed by fusion anyway? -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Abstracting ByteStrings

2008-01-23 Thread Chad Scherrer
Careful. ByteString is an alternative to [Word8]. Converting [Char] to ByteString and back requires an encoding. (Unfortunately, the only encoding that comes with the bytestring package is lossy.) Ahh, good point. I guess I almost always just use them to read ASCII, so it hasn't been an issue.

Re: [Haskell-cafe] Abstracting ByteStrings

2008-01-23 Thread Chad Scherrer
Given a reasonable Storable instance of pairs you could use: http://code.haskell.org/~sjanssen/storablevector I hadn't seen that before, thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] :i and :t give different types

2008-02-07 Thread Chad Scherrer
Hello haskell-cafe, In ghci, I tried to get info for Data.Stream.Stream: $ ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude :m Data.Stream Prelude Data.Stream :i Stream data Stream a where Stream :: forall a s.

Re: [Haskell-cafe] :i and :t give different types

2008-02-08 Thread Chad Scherrer
On Feb 8, 2008 9:55 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: I have not been following closely but if Don thinks there's a bug there probably is. Can someone submit a bug report pls? Better still a patch! :-) Simon Ok, I filed a bug report.

[Haskell-cafe] stream/bytestring questions

2008-02-17 Thread Chad Scherrer
ByteStrings have given a real performance boost to a lot of Haskell applications, and I'm curious why some of the techniques aren't more abstracted and widely available. If it's because it's a big job, that's certainly understandable, but maybe there's something I'm overlooking that some of the

Re: [Haskell-cafe] stream/bytestring questions

2008-02-17 Thread Chad Scherrer
On Feb 17, 2008 4:13 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: Have you looked at the stream-fusion package on Hackage? http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stream- fusion-0.1.1 Yeah, I've seen this. It's nice that this is separated, but a little unsatisfying

Re: [Haskell-cafe] stream/bytestring questions

2008-02-17 Thread Chad Scherrer
they currently use two different fusion systems. bytestring uses an older version of what is now stream fusion. at some point we'll switch bytestrings over to using the new stuff in the stream-fusion package, since its a lot better. Oh, that's pretty interesting. I had assumed bytestring had

Re: [Haskell-cafe] stream/bytestring questions

2008-02-17 Thread Chad Scherrer
On Feb 17, 2008 5:01 PM, Don Stewart [EMAIL PROTECTED] wrote: yeah, with lists, as compared to bytestrings, there are: * more complex operations to fuse * allocation is much cheaper (lazy list cons nodes) * built in desugaring for build/foldr fusion interferes (enumerations,

Re: [Haskell-cafe] stream/bytestring questions

2008-02-20 Thread Chad Scherrer
On Feb 17, 2008 6:06 PM, Derek Elkins [EMAIL PROTECTED] wrote: It's -quite- possible that a coalgebraic perspective is much more natural for your code/problem. If that's the case, use it (the coalgebraic perspective that is). Obviously depending on the internals of the stream library is not

[Haskell-cafe] Re: The Proliferation of List-Like Types

2008-02-20 Thread Chad Scherrer
Henning Thielemann lemming at henning-thielemann.de writes: 4) We are missing one final useful type: a Word32-based ByteString. When working in the Unicode character set, a 32-bit character can indeed be useful, and I could see situations in which the performance benefit of a

Re: [Haskell-cafe] Re: The Proliferation of List-Like Types

2008-02-20 Thread Chad Scherrer
On Feb 20, 2008 10:57 AM, Antoine Latter [EMAIL PROTECTED] wrote: For anyone looking into it - the StorableVector fusion would have to be quite different from the current ByteString fusion framework. Maybe it would be enough to lay down a Stream fusion framework for StorableVectors. I must be

Re: [Haskell-cafe] Re: The Proliferation of List-Like Types

2008-02-20 Thread Chad Scherrer
Antoine Latter [EMAIL PROTECTED] wrote: From what I saw of Data.ByteString.Fusion, it relies on the assumption that the elements of the output array are of the same size and alignment as the elements of all of the arrays in the fused intermediate steps. That way, all of the intermediate

Re: [Haskell-cafe] stream/bytestring questions

2008-02-21 Thread Chad Scherrer
On Wed, Feb 20, 2008 at 5:53 PM, Roman Leshchinskiy [EMAIL PROTECTED] wrote: In general, I don't see why programming directly with streams is something that should be avoided. You do have to be quite careful, though, if you want to get good performance (but GHC's simplifier is becoming

[Haskell-cafe] Re: The Proliferation of List-Like Types

2008-02-21 Thread Chad Scherrer
On Wed, Feb 20, 2008 at 7:57 PM, Henning Thielemann [EMAIL PROTECTED] wrote: I think there can also be problems simply because the element type is no longer fixed to Word8 but also not entirely free, but restricted to Storable. E.g. you cannot simply replace SV.fromList . List.map f

[Haskell-cafe] Re: fast integer base-2 log function?

2008-02-27 Thread Chad Scherrer
Jens Blanck jens.blanck at gmail.com writes: {-# LANGUAGE MagicHash #-} import GHC.Exts import Data.Bits -- experiment with using a LUT here (hint: FFI + static arrays in C) ... Sorry I don't have an answer, only more questions. Is {-# LANGUAGE MagicHash #-} documented somewhere? I've seen

[Haskell-cafe] Re: Just a quick question

2008-02-27 Thread Chad Scherrer
Imam Tashdid ul Alam uchchwhash at yahoo.com writes: A few days back, I *think* I stumbled upon the statement the interaction between GADTs and functional dependencies is not yet well understood. Then I glossed over it. Now that I have (finally) started understanding what GADTs are meant to

[Haskell-cafe] Re: Interesting critique of OCaml

2008-05-08 Thread Chad Scherrer
Don Stewart dons at galois.com writes: [interesting quote...] Which I think really captures the joy of being able to write algebraic and data structure transformations, via rewrite rules, without having to extend the compiler -- all thanks to purity, laziness, and static typing. This makes me

[Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Chad Scherrer
My work uses WebSense to filter viewable pages - I don't have an option. I used to be able to get to darcs.haskell.org just fine, but apparently a /hacking directory was added somewhere, so WebSense put it on the naughty list. I put in a request for WebSense to review the site; hopefully it will

[Haskell-cafe] Re: Copying Arrays

2008-05-29 Thread Chad Scherrer
Jed Brown jed at 59A2.org writes: Uh, ByteString is Unicode-agnostic. ByteString.Char8 is not. So why not do IO with lazy ByteString and parse into your own representation (which might look a lot like StorableVector)? One problem you might run into doing it this way is if a wide

[Haskell-cafe] Re: WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Chad Scherrer
Duncan Coutts duncan.coutts at worc.ox.ac.uk writes: On Thu, 2008-05-29 at 18:12 +, Chad Scherrer wrote: I used to be able to get to darcs.haskell.org just fine, but apparently a /hacking directory was added somewhere, so WebSense put it on the naughty list. Do you know where? Neil

[Haskell-cafe] first post

2005-11-30 Thread Chad Scherrer
. Or, if you're using ghci, you could just do s - load parse s This is because ghci executes in the IO monad (maybe there are some details of this I'm missing, but that's how I think of it anyway. BTW, your load function could be equivalently written simply as load = readFile parse.hs -Chad

[Haskell-cafe] Re: [Haskell] installing streams library

2006-05-19 Thread Chad Scherrer
://haskell.org/haskellwiki/Library/Streams and download it as http://freearc.narod.ru/Streams.tar.gzfrom a thread in February entitled:Streams: the extensible I/O library (Feb 21)Googlesite:haskell.org bulat extensible I/O library for the thread, etc. Hope that helps,Jared.On 5/19/06, Chad Scherrer

[Haskell-cafe] Re: [Haskell] installing streams library

2006-05-21 Thread Chad Scherrer
On 5/20/06, Donald Bruce Stewart [EMAIL PROTECTED] wrote: Data.ByteString is in the base libraries now.For a bit of the flavour, see:http://haskell.org/haskellwiki/Wc In this message http://article.gmane.org/gmane.comp.lang.haskell.general/13625 Bulat says, i foresee that Streams + Fast Packed

[Haskell-cafe] IO Put confusion

2010-09-14 Thread Chad Scherrer
Hello, I need to be able to use strict bytestrings to efficiently build a lazy bytestring, so I'm using putByteString in Data.Binary. But I also need random numbers, so I'm using mwc-random. I end up in the IO Put monad, and it's giving me some issues. To build a random document, I need a random

[Haskell-cafe] Re: IO Put confusion

2010-09-15 Thread Chad Scherrer
Chad Scherrer chad.scherrer at gmail.com writes: Second attempt: doc :: IO Put doc = docLength = go where go 1 = word go n = do w - word ws - go (n-1) return (w putSpace ws) This one actually works, but it holds onto everything in memory instead of outputting

[Haskell-cafe] Re: Is www.haskell.org down?

2008-08-14 Thread Chad Scherrer
Don Stewart dons at galois.com writes: Some choice quotes: almost all of the examples of Haskell's use in industry are fakes nobody has ever done anything significant using Haskell Jon's the primary source of FUD against Haskell and its community, as he goes around promoting his

[Haskell-cafe] Re: Automatic parallelism in Haskell, similar to make -j4?

2008-11-04 Thread Chad Scherrer
T Willingham t.r.willingham at gmail.com writes: I am thinking of our troglodytic friend 'make', which will run (for example) 4 parallel jobs when given the option make -j4. Even 'rake', the ruby version of make, now has a branch (called drake) which does the parallel -j option. From the

[Haskell-cafe] mapping unfreeze over an IntMap of IOUArrays

2008-11-11 Thread Chad Scherrer
to avoid that. Any ideas? BTW, I probably should be using ST for this, but I hit the usual type s escapes irritation and gave up. If that would work more easily, that would be fine with me too. Thanks! Chad Scherrer ___ Haskell-Cafe mailing list Haskell

[Haskell-cafe] Re: mapping unfreeze over an IntMap of IOUArrays

2008-11-11 Thread Chad Scherrer
Don Stewart dons at galois.com writes: Hmm. So you'd need to construct a new IntMap, made by fmap'ping unsafeFreeze over each element of the old map. I guess if we had a Traversable instance for Data.IntMap things would be just fine. Would this be a bad thing in any way? Chad

[Haskell-cafe] Re: mapping unfreeze over an IntMap of IOUArrays

2008-11-11 Thread Chad Scherrer
Don Stewart dons at galois.com writes: Hmm. So you'd need to construct a new IntMap, made by fmap'ping unsafeFreeze over each element of the old map. For now I'll just do IntMap.map (unsafePerformIO . unsafeFreeze) Hopefully this won't come back to bite me Thanks! Chad

[Haskell-cafe] Re: Trouble trying to find packages for ubuntu linux

2007-03-15 Thread Chad Scherrer
Brian, I had this exact problem, and I found this approach to work wonderfully: http://pupeno.com/2006/12/17/unstable-packages-on-ubuntu/ Chad ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Is ([] - []) an arrow?

2007-03-21 Thread Chad Scherrer
In John Hughes's Programming With Arrows (http://www.cs.chalmers.se/~rjmh/afp-arrows.pdf), he discusses a stream function type newtype SF a b = SF {runSF :: [a] - [b]} and gives instance Arrow SF where He gives some examples using this, and everything seems to go just fine. But in Ross

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-10 Thread Chad Scherrer
String] - IO (Matrix Double). -- Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: release plans

2007-04-16 Thread Chad Scherrer
What do you think of this plan? Are there features/bug-fixes that you really want to see in 6.8? I'm most anxious for parallel GC - do you think it will be another release or two before this is a reality? Thanks, Chad ___ Haskell-Cafe mailing list

[Haskell-cafe] Bad let..do syntax

2007-05-17 Thread Chad Scherrer
I've gotten into a habit of preceding most dos in my code with a $, and indenting the next line. I kind of like this, since it makes the indentation more uniform. But it seems to have bitten me now. I'd like to write something like this s = sum $ do x - [1,2,3] let b = sum $ do y - [0..x +

Re: [Haskell-cafe] Bad let..do syntax

2007-05-17 Thread Chad Scherrer
of the original code, where sum [0.. x+1] wasn't an option. -Chad On 5/17/07, David House [EMAIL PROTECTED] wrote: On 17/05/07, Chad Scherrer [EMAIL PROTECTED] wrote: But GHC complains of Empty 'do' construct. Because it takes the indented following lines as being new bindings in the let-block

Re: [Haskell-cafe] Currying: The Rationale

2007-05-23 Thread Chad Scherrer
Is (^2) really considered currying? As I understand it, this is syntactic sugar for a section, and might confuse the issue a bit, since it's distinct from ((^) 2). In this case we would have something like Prelude let pow2 = ((^) 2) Prelude map pow2 [1..10] [2,4,8,16,32,64,128,256,512,1024] I

Re: [Haskell-cafe] Currying: The Rationale

2007-05-23 Thread Chad Scherrer
On 5/23/07, Philippa Cowderoy [EMAIL PROTECTED] wrote: On Wed, 23 May 2007, Chad Scherrer wrote: Is (^2) really considered currying? As I understand it, this is syntactic sugar for a section, and might confuse the issue a bit, since it's distinct from ((^) 2). Sure, but it's (flip (^)) 2

[Haskell-cafe] directory tree?

2007-06-22 Thread Chad Scherrer
Haskell is great at manipulating tree structures, but I can't seem to find anything representing a directory tree. A simple representation would be something like this: data Dir = Dir {dirName :: String, subDirectories :: [Dir], files :: [File]} data File = File {fileName :: String, fileSize ::

Re: [Haskell-cafe] directory tree?

2007-06-22 Thread Chad Scherrer
On 6/22/07, Jeremy Shaw [EMAIL PROTECTED] wrote: Hello, Have you seen Tom Moertel's series on directory-tree printing in Haskell ? No, I hadn't. Might be just the ticket. Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] directory tree?

2007-06-22 Thread Chad Scherrer
Nice, thanks! Certainly looks like a good start at this. What got me thinking about this is I'd like to be able to do something like this in just a couple lines of code: gunzip -c ./2*/*.z ... and feed the result into a giant lazy ByteString. Now, the UNIX command doesn't really cut it,

Re: [Haskell-cafe] directory tree?

2007-06-24 Thread Chad Scherrer
Thanks, Bryan, this is much cleaner than the imperative hack I was throwing together. And aside from the imports, it even fits the couple lines of code criteria! Wonderful. I won't be able to try this out until I get back to work, but I'm wondering whether this will handle a few thousand files.

  1   2   >