[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] 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] 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: 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] 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: 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

Re: dataflow rewriting engine

2008-08-27 Thread Chad Scherrer
Wow, lots of great information. We'll take a look at the papers and get back if there's any remaining confusion. Thanks! Chad ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org

dataflow rewriting engine

2008-08-22 Thread Chad Scherrer
Hello GHC, This page http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/IntegratedCodeGen mentions a to-be-developed dataflow rewriting engine. Can someone please send a description of what this will do? Thanks! -- Chad Scherrer Time flies like an arrow; fruit flies like a banana

[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] 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] 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

ghc-6.8.2 overflows stack

2008-03-05 Thread Chad Scherrer
Hello, I'm trying to compile stream-fusion-0.1.1 with profiling enabled, and it's overflowing the stack. $ runghc Setup.lhs configure -pO Configuring stream-fusion-0.1.1... $ runghc Setup.lhs build Preprocessing library stream-fusion-0.1.1... Building stream-fusion-0.1.1... [2 of 3] Compiling

Re: ghc-6.8.2 overflows stack

2008-03-05 Thread Chad Scherrer
Chad Scherrer chad.scherrer at gmail.com writes: I'm trying to compile stream-fusion-0.1.1 with profiling enabled, and it's overflowing the stack. Sorry to reply to my own post, but I wanted to add that it works just fine if you compile Setup.lhs first, but not with runghc. Chad

[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

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

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

[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] :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] :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] 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] 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

[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

Strange compilation behavior

2007-12-09 Thread Chad Scherrer
Hello, I'm using ghc 6.6.1 under Ubuntu Gutsy on a Pentium 4 machine, and I was working to get some code running in an acceptable time. I was surprised to find that turning on profiling switches made the code run over 40x faster! Here's the first run, using ghc --make -O2: 88.03user 0.08system

[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] 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] 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

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

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

[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] where to put handy functions?

2007-08-10 Thread Chad Scherrer
Agreed. I like select better too, and the regular vs Asc version is a nice parallel with fromList and fromAscList. Chad On 8/10/07, Tillmann Rendel [EMAIL PROTECTED] wrote: Non-negative is obvious for a list of indexes. Ordered makes sense implementation-wise, and should be easy to match for

Re: [Haskell-cafe] where to put handy functions?

2007-08-10 Thread Chad Scherrer
Hmm, this would make a good QuickCheck property. I wonder, is listify a contravariant functor? Fun to work through the details of that some time, I think. Chad On 8/10/07, Brent Yorgey [EMAIL PROTECTED] wrote: Amusingly, extract is intimately related to function composition. Suppose we have

[Haskell-cafe] listify

2007-08-10 Thread Chad Scherrer
Don't be too impressed, I think I was way off base. Looks like just a homomorphism: http://en.wikipedia.org/wiki/Homomorphism Chad I wonder, is listify a contravariant functor? I wonder - will I ever reach the stage where I too make off-hand remarks like this? :-} Now I know how all the

[Haskell-cafe] where to put handy functions?

2007-08-09 Thread Chad Scherrer
to forced qualified imports. Finally, even if no one else is using it, it would be good to settle on reasonable names for things more easily. Is there a better name for this function? Is there a reason not to call it extract? -- Chad Scherrer Time flies like an arrow; fruit flies like a banana

Re: [Haskell-cafe] infinite list of random elements

2007-07-31 Thread Chad Scherrer
Ok, that looks good, but what if I need some random values elsewhere in the program? This doesn't return a new generator (and it can't because you never get to the end of the list). Without using IO or ST, you'd have to thread the parameter by hand or use the State monad, right? This is where I

Re: [Haskell-cafe] infinite list of random elements

2007-07-31 Thread Chad Scherrer
On 7/31/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Jul 31, 2007, at 16:20 , Chad Scherrer wrote: calls. I suppose a State' monad, strict in the state, could help here. You mean Control.Monad.State.Strict ? Umm, yeah, I guess I do. Glad I hadn't started recoding

[Haskell-cafe] infinite list of random elements

2007-07-30 Thread Chad Scherrer
I'm trying to do something I thought would be pretty simple, but it's giving me trouble. Given a list, say [1,2,3], I'd like to be able to generate an infinite list of random elements from that list, in this case maybe [1,2,1,3,2,1,3,2,3,1,2,...]. I'm using IO for random purely due to laziness

Re: [Haskell-cafe] infinite list of random elements

2007-07-30 Thread Chad Scherrer
Thanks for your responses. Stefan, I appreciate your taking a step back for me (hard to judge what level of understanding someone is coming from), but the example you gave doesn't contradict my intuition either. I don't consider the output [IO a] a list of tainted a's, but, as you suggest, a list

[Haskell-cafe] Preferred way to get data from a socket

2007-06-26 Thread Chad Scherrer
I've never used sockets before, but I need to now, and I need to be able to get a lot of data quickly. I was thinking about doing something like this (below), but I'm wondering if there's a way that would be faster. Is the obvious way of doing this the right way? I'm happy to install outside

Re: [Haskell-cafe] Preferred way to get data from a socket

2007-06-26 Thread Chad Scherrer
Ok, cool. FWIW, the current documentation for Network says: For really fast I/O, it might be worth looking at the hGetBuf and hPutBuf family of functions in System.IO. But this looked pretty low-level to me, and I figured it might be outdated. I also know Bulat Ziganshin had put together a

Re: [Haskell-cafe] directory tree?

2007-06-25 Thread Chad Scherrer
Bryan, I downloaded your FileManip library and Duncan's zlib library, but I kept getting a Too many open files exception (it matches over 9000 files). I tried to get around this using unsafeInterleaveIO as Greg had suggested, so now I have this: foo = namesMatching */*.z = fmap B.concat .

Re: [Haskell-cafe] directory tree?

2007-06-25 Thread Chad Scherrer
Jedaï, Are you sure you're not confusing .z with .Z? http://kb.iu.edu/data/afcc.html And is it possible that gzip is smarter somehow? Doesn't Codec.Compression.GZip call the same C library used by gzip? Chad On 6/25/07, Chaddaï Fouché [EMAIL PROTECTED] wrote: Because gunzip is smarter than

Re: Re[2]: [Haskell-cafe] directory tree?

2007-06-25 Thread Chad Scherrer
Bulat, I don't think I can. (1) (de)compress is defined for lazy bytestrings, and (2) my data comes to me compressed in order to fit it all on a single DVD. So even if I could uncompress each file strictly, I couldn't hold such a big strict bytestring in memory at once. On 6/25/07, Bulat

Re: [Haskell-cafe] directory tree?

2007-06-25 Thread Chad Scherrer
On 6/25/07, Bryan O'Sullivan [EMAIL PROTECTED] wrote: Are you sure you really have gzip files? If you're on a Linux or similar box, what does file myfile.z report to you? It should say something like gzip compressed data. Aarrgh, that's the problem - it does use compress. Is the distinction

Re: [Haskell-cafe] directory tree?

2007-06-25 Thread Chad Scherrer
On 6/25/07, Stefan O'Rear [EMAIL PROTECTED] wrote: .z : always pack .Z : always compress .gz : always gzip gzip can handle all three, zlib only the last. (Are you *sure* your file is compress?) This means it's compress, doesn't it? $ file myData.z myData.z: compress'd data 16 bits I

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.

[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] 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] 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

[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

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] 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

[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] 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

GHC on Cray XMT?

2007-02-26 Thread Chad Scherrer
with Haskell. Can anyone tell me how big an undertaking it would this be to get GHC going on one of these? It seems to me like the fact that the absence of cache on XMT processors should simplify things, since there are less issues reasoning about locality. Thanks! Chad Scherrer Time flies like

[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] 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

No instance for (Monad ((-) Integer))

2007-02-05 Thread Chad Scherrer
I'm getting this error in ghci, and I think it should typecheck just fine. Prelude let fs = [(+2), (*4)] Prelude :t fs fs :: [Integer - Integer] Prelude :t sequence fs interactive:1:0: No instance for (Monad ((-) Integer)) arising from use of `sequence' at interactive:1:0-10 Possible

Re: No instance for (Monad ((-) Integer))

2007-02-05 Thread Chad Scherrer
On 2/5/07, Neil Mitchell [EMAIL PROTECTED] wrote: Hi Chad, Prelude let fs = [(+2), (*4)] Prelude :t fs fs :: [Integer - Integer] Prelude :t sequence fs I think you need to import Control.Monad.Instances to get the appropriate instance in scope. Hmm, that's weird. The instance Monad ((-)

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] (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

[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] 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

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] 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

[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

GHC 6.6 on Ubuntu

2006-11-17 Thread Chad Scherrer
to be sure whatever I do now doesn't later confuse the system. Thanks, Chad Scherrer Time flies like an arrow; fruit flies like a banana -- Groucho Marx ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman

[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: 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

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] 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

instance Data (Complex a)

2006-10-26 Thread Chad Scherrer
I was playing around with the Data.Generics stuff, and I'm getting an error that says No instance for (Data (Complex Double)) Looking at the source for Data.Complex, I see it is an instance of Typeable, but not of Data. Is there a reason not to add deriving Data on the end of this? Thanks,

ghc error

2006-10-23 Thread Chad Scherrer
I tried compiling a file today using -O2, and it gave me this: /tmp/ghc10376_0/ghc10376_0.hc:5:20: HsTime.h: No such file or directory It compiled fine without the -O2. Am I missing some files? Where can I find what I need to make this work again? Thanks, -- Chad Scherrer Time flies

[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

  1   2   >