Re: [Haskell-cafe] symbol type?

2007-10-11 Thread Thomas Conway
to be a significant problem. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-08 Thread Thomas Conway
Haskell. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-08 Thread Thomas Conway
, and as a consequence you end up doing your thinking sooner rather than later. This usually ends with better software with fewer bugs. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-04 Thread Thomas Conway
heard a Prolog guy - Bart Demoen - talk about doing pretty much this during GC to improve sharing. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Thomas Conway
synonyms for this reason, but you end up polluting the global namespace. +1 vote. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Thomas Conway
type BST = Tree key val data RelaxedTree key val = Leaf Bal [(key,val)] | Node Bal [(key,RelaxedTree key val)] where data Bal = Balanced | Unbalanced -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] C's fmod in Haskell

2007-09-24 Thread Thomas Conway
9899:1999 which defines fmod. It specifies that the result of fmod(x,y) should have the same sign as x. Interesting. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] C's fmod in Haskell

2007-09-23 Thread Thomas Conway
is efficient (which it probably isn't), you can implement fmod really quite efficiently. In particular, x `fmod` 1.0 == (snd . properFraction) x cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-13 Thread Thomas Conway
(at least in Forte 5, and probably most implementations) template instantiations are hash-consed. I would *much* rather have a simpler type system, than a compiler which might not terminate. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little

Re: [Haskell-cafe] Learn Prolog...

2007-09-04 Thread Thomas Conway
know what I mean, go and read Why Functional Programming Matters. Hey, that was fun. I have barely written *any* Prolog since I finished my thesis. :-) cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Learn Prolog...

2007-09-04 Thread Thomas Conway
in a good word for Mercury which I worked on, along with a few other denizens in this forum. See www.mercury.cs.mu.oz.au. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Learn Prolog...

2007-09-04 Thread Thomas Conway
: 1. Order of side-effects. 2. Efficiency of implementation. and arguably 3. Hysterical Raisins. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] STM, IO and b-trees

2007-08-20 Thread Thomas Conway
On 8/21/07, Ben [EMAIL PROTECTED] wrote: for sake of argument, suppose an enterprising haskell newbie wanted to code up concurrent b-trees (really b-link trees) in haskell. if i am understanding STM correctly, it will NOT help in any way with the implementation, because of the IO-intensive

Re: [Haskell-cafe] Small question

2007-08-10 Thread Thomas Conway
of the memory management issues. When they don't, one can usually make a analogous class to manage the lifetime for you. cheers, Tom -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Dynamic thread management?

2007-08-10 Thread Thomas Conway
or more for more usual 'f's. Some tasks, like Monte Carlo integration are very amenable to such, but most tasks are not. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Haskell vs GC'd imperative languages, threading, parallelizeability (is that a word? :-D )

2007-08-10 Thread Thomas Conway
of execution. As nomenclature, it is not universal, but is very common, and helps avoid conflating two quite different things. cheers, Tom -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Backpatching

2007-08-01 Thread Thomas Conway
On 8/2/07, Daniel McAllansmith [EMAIL PROTECTED] wrote: On Wednesday 01 August 2007 17:44, Thomas Conway wrote: This sounds like a common problem type. Is there a well known solution to this sort of problem? Have you looked into Tying the Knot? http://www.haskell.org/haskellwiki

Re: [Haskell-cafe] Re: Zippers, Random Numbers Terrain

2007-08-01 Thread Thomas Conway
can be made to go away. Well, not all of them - after all Double has limited digits of mantissa, but down to quite small scales, the arithmetic will be precise. Actually, you could use (Either Rational Rational), except that performance would be [even more] atrocious. cheers, T. -- Dr Thomas

[Haskell-cafe] Backpatching

2007-07-31 Thread Thomas Conway
about the types. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Zippers, Random Numbers Terrain

2007-07-30 Thread Thomas Conway
my question to the learned members of this forum is: Am I on the right track? Is a scheme like this going to work? cheers, Tom -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: Re : [Haskell-cafe] Indentation woes

2007-07-26 Thread Thomas Conway
recently introduced me to the Maybe monad transformer for exactly this reason). It's actually a pretty effective rule of thumb. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Maintaining the community

2007-07-17 Thread Thomas Conway
the way C++ is taught at the undergraduate level, and the way it is perceived by the inexperienced is that it isn't so hard. But then again, I've taught Java at the ugrad level, and what do I know about Java, other that it'd be quite a nice place to have a holiday some time :) T. -- Dr Thomas

Re: [Haskell-cafe] Maintaining the community

2007-07-17 Thread Thomas Conway
. From what I know of the marketplace, people working in C# are more likely to be doing client/integration work where technical finesse is less important, and are therefore less likely to see the point. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were

Re: [Haskell-cafe] Maintaining the community

2007-07-16 Thread Thomas Conway
never get the payoff. And before you all flame, yes, I do know C++ at an expert level, and that is exactly why, after 7 years of writing server software in C++, I now want to do it in Haskell. cheers, T -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were

Re: [Haskell-cafe] Indentation Creep

2007-07-15 Thread Thomas Conway
, and can use the Error monad, and mean it. Level 3 - Can use monad transformers deliberately ... Level 42 - Has realized monad really is some kind of swear word. :-) -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Indentation Creep

2007-07-15 Thread Thomas Conway
when e $ writeTVar' p Empty return (v,e) Is this correct? And if so, is GHC likely to do constant folding on msum over the list skeleton? T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Re: Indentation Creep

2007-07-14 Thread Thomas Conway
is used in an inner loop, so a structure giving O(1) operations was desirable. Anyway, the point of the original post was to find tricks for avoiding indentation creep, rather than the trie itself. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were

[Haskell-cafe] Indentation Creep

2007-07-13 Thread Thomas Conway
, or is there Haskellmagic that I still need to learn? cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: Re[8]: [Haskell-cafe] Toy compression algorithms [was: A very edgy language]

2007-07-12 Thread Thomas Conway
of which are symbol based (0, 1 or higher order), and others which are word based. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Toy compression algorithms

2007-07-11 Thread Thomas Conway
is Any Expression requiring more than 80 columns is fiddly. :-) I say this in jest, but it is ha ha, only serious. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] better error expression in IO function

2007-07-11 Thread Thomas Conway
Southpaw Conway -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Data.ByteString.dropWhile

2007-07-10 Thread Thomas Conway
, but is not exported -} T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] The Garbage Collector Ate My Homework

2007-07-10 Thread Thomas Conway
(-hb) aborts on my program. :-( Still, -hc and -hd seem to work, the only hassle is the hours of running time required to get things to go bad. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Re: Too many packages on hackage? :-)

2007-07-09 Thread Thomas Conway
On 7/9/07, Ketil Malde [EMAIL PROTECTED] wrote: The current deliverables seem to consist of a tar file and a package description, neither of them accurately dated. Clearly we need to store them in a treap. :-) -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I

[Haskell-cafe] Data.ByteString.dropWhile

2007-07-09 Thread Thomas Conway
Hi All, I notice that Data.ByteString has span and spanEnd. Is there a known particular reason why dropWhile and takeWhile don't have corresponding *End functions? If not, what is the protocol for adding them? cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald

Re: [Haskell-cafe] A very edgy language (was: A very nontrivial parser)

2007-07-07 Thread Thomas Conway
more sophisticated mechanisms, which in time will probably lead to more expressive paradigms. cheers, T. -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] A very edgy language (was: A very nontrivial parser)

2007-07-07 Thread Thomas Conway
running so performance and memory usage are pretty important, and these are relatively hard to get right in Haskell. OTOH, you can tell, I think it's a good trade off - I did convince the mgt to let me doit in Haskell in the first place. :-) -- Thomas Conway [EMAIL PROTECTED] Silence is the perfectest

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-05 Thread Thomas Conway
that Haskell lacks the *coverage* that Perl or Python have. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] System.Exit

2007-07-05 Thread Thomas Conway
FWIW, I implemented the STM based solution, and it works a treat. It's less of a hack than the version where I got the child thread to send a SIGINT. ;-) T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] interrupting an accept()ing thread

2007-07-05 Thread Thomas Conway
sure the live op count gets decremented. T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] interrupting an accept()ing thread

2007-07-05 Thread Thomas Conway
somehow. Well, it works because the sub-thread dies when the program exits, so the socket gets closed then. T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Thomas Conway
. That's the kind of [de]serialization I like. :-) Mind you, I still have to use HaXml when I first read documents into the system, and a very nice job it does too. T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Thomas Conway
structure, stick it in the cache, then rerun the transaction. There are a few details you have to get right, including making sure none of the items you require to complete the operation get evicted by another thread, but it works very nicely. T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence

[Haskell-cafe] System.Exit

2007-07-04 Thread Thomas Conway
completed. This is the case regardless of whether the call is inside a block or not. /quote So no joy there. Ideas anyone? And is exitWith broken, or is it the doco that's broken? cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy

[Haskell-cafe] The Garbage Collector Ate My Homework

2007-07-03 Thread Thomas Conway
94.5% (84.5% elapsed) Alloc rate506,470,897 bytes per MUT second Productivity 5.5% of total user, 4.6% of total elapsed Can anyone offer general suggestions for how to fix this! T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy

Re: [Haskell-cafe] Odd lack of laziness

2007-06-23 Thread Thomas Conway
length would evaluate the whole list skeleton. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] Re: Collections

2007-06-22 Thread Thomas Conway
-knife myself, comparison to sliced bread may be faint praise. It isn't. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Thomas Conway
name, c, c. FWIW, the other little combinator I invariably use is p `returning` x = p = (\_ - return x) which I end up calling with () as the second argument so often (especially during development), I usually have another combinator void p = p return () YMMV, T. -- Dr Thomas Conway [EMAIL

Re: [Haskell-cafe] Re: Collections

2007-06-21 Thread Thomas Conway
) but I need to keep a firm lid on the resource usage, so I can't. sigh cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell

Re: [Haskell-cafe] Re: Collections

2007-06-21 Thread Thomas Conway
Key ([IO (Maybe Key)]). T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] Collections

2007-06-20 Thread Thomas Conway
to the C++ STL std::pair template type? I must be missing something. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] Re: String Hashing

2007-06-19 Thread Thomas Conway
On 6/19/07, apfelmus [EMAIL PROTECTED] wrote: [nice exposition of how you could do lazy look-ma-no-updates tries] Clearly, I still think too much like a logic programmer. :-) T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I

Re: [Haskell-cafe] Re: String Hashing

2007-06-18 Thread Thomas Conway
programming cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] String Hashing

2007-06-18 Thread Thomas Conway
that advantage vs. tries. edna-e-mode-voice No Strings, darling! No Strings. /edna-e-mode-voice cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell

Re: [Haskell-cafe] Re: String Hashing

2007-06-18 Thread Thomas Conway
://citeseer.ist.psu.edu/2986.html T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] OS design FP aesthetics

2007-06-18 Thread Thomas Conway
functional programming. I'm not sure if the thesis itself is online. cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing list Haskell-Cafe

[Haskell-cafe] String Hashing

2007-06-17 Thread Thomas Conway
the intermediate Triple structures. So, how do you convince ghc to do this? Alternatively, how would you *translate* rather than transliterate, the mix function? -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

Re: [Haskell-cafe] String Hashing

2007-06-17 Thread Thomas Conway
FWIW, here's a link to the original c code: http://www.burtleburtle.net/bob/hash/evahash.html -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Implementing Mathematica

2007-06-14 Thread Thomas Conway
are explicit, and not just a notational convenience as they are in lambda calculus: main :- f(42,X), f(42,Y), cheers, T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I could say how much

[Haskell-cafe] Switch optimization

2007-06-10 Thread Thomas Conway
': x' - force x update precomputed-table[x'] Even if you leave out property 2 and include bounds checks, this seems like an important kind of function to optimize well. So what have I missed, or is it time to learn how to hack on ghc? T. -- Thomas Conway [EMAIL PROTECTED] Silence

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Thomas Conway
performance model (e.g. when should you use tail recursion, and when should you not). But I happily acknowledge that my experience is probably atypical. ;-) cheers, T. -- Dr Thomas Conway You are beautiful; but learn to work, [EMAIL PROTECTED] for you cannot eat your beauty

Re: [Haskell-cafe] RE: What I learned from my first serious attempt low-level Haskell programming

2007-04-08 Thread Thomas Conway
Appel's code generator that used dynamic programming to select between different generated code sequences comes to mind as potential inspiration for a super-duper inliner. cheers, Tom -- Dr Thomas Conway You are beautiful; but learn to work, [EMAIL PROTECTED] for you cannot eat your

Re: [Haskell-cafe] TVars throw

2007-03-08 Thread Thomas Conway
the library is implemented. sigh Why are tricky problems tricky? I thought Haskell was supposed to make everything easy. ;-) T. -- Dr Thomas Conway You are beautiful; but learn to work, [EMAIL PROTECTED] for you cannot eat your beauty. -- Congo

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Thomas Conway
level. cheers, T. -- Dr Thomas Conway You are beautiful; but learn to work, [EMAIL PROTECTED] for you cannot eat your beauty. -- Congo proverb ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Thomas Conway
On 3/7/07, mm [EMAIL PROTECTED] wrote: f . g . h $ x Alternativly, (f . g . h) x will work, too. It always irks me that you don't actually save any horizontal space using $. That is, (e) x has the same number of characters (incl spaces) as e $ x T. -- Dr Thomas Conway You

[Haskell-cafe] TVars throw

2007-03-07 Thread Thomas Conway
. I assume it actually works, but should it? T. -- Dr Thomas Conway You are beautiful; but learn to work, [EMAIL PROTECTED] for you cannot eat your beauty. -- Congo proverb ___ Haskell-Cafe mailing

[Haskell-cafe] lhs2TeX

2007-03-07 Thread Thomas Conway
couldn't see anything in the manual to show me how. Anyone? -- Dr Thomas Conway You are beautiful; but learn to work, [EMAIL PROTECTED] for you cannot eat your beauty. -- Congo proverb ___ Haskell

[Haskell-cafe] weak references caches

2007-02-08 Thread Thomas Conway
Hi All, I'm hacking some (external) B-Tree code, and amongst the numerous interesting problems I've come up against[*], is to do with managing which pages/nodes are in memory and which are not. We use TVars to point from one (in-memory version of a) page to another, so we have a type like the

[Haskell-cafe] Re: weak references caches

2007-02-08 Thread Thomas Conway
So I just coded up the approach. It compiles, so I assume it works as intended. ;-) Comments and clever obervations extremely welcome. cheers, T. module W where import Control.Concurrent.STM import qualified Data.Map as M import System.Mem.Weak import GHC.Conc makePtr tabPtr a = do

[Haskell-cafe] casting

2006-10-09 Thread Thomas Conway
Hi All I'm having some difficulty with typeclasses. What I'm trying to do should be obvious, but it's still giving me trouble. I want to take a packaged item, and strengthen the constraints on its type. Rather than being just any type that is an instance of A, I want to do a runtime check and

[Haskell-cafe] Re: casting

2006-10-09 Thread Thomas Conway
On 10/9/06, I wrote: So, can anyone suggest how I can achieve my goal? And how many milliolegs of type hackery will it take? ;-) Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] casting

2006-10-09 Thread Thomas Conway
Thanks Misha Matthias. I now get what's going on. The mention of the word dictionary revealed it all. I've spent the last 7 years programming in C++, and had dynamic_cast firmly fixed in my head. I totally forgot that Fergus Henderson and I independently reinvented dictionary passing for the

Re: [Haskell-cafe] Vertical tabs in source code and other obscure chars

2006-10-09 Thread Thomas Conway
Mostly hysterical raisins, I think. T. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] layout monads

2006-10-03 Thread Thomas Conway
Hi All, Next monad query [*] In the 1995 paper Composing Haggis, layout is done using a monad to compose individual elements. To modernize the syntax consider (forgive the operator, but it avoids parentheses): infixl 1 | f | x = f x mylayout = do hbox | do button ok

[Haskell-cafe] Either as a Monad instance

2006-10-02 Thread Thomas Conway
Hi All, I've been [trying to] grapple with the various monads and transformers, and it occurs to me that the standard instance for Either as a monadic type is unnecessarily restrictive. Is there a compelling reason that it is not just instance Monad (Either e) where return = Right (Left

[Haskell-cafe] Bit string

2006-09-14 Thread Thomas Conway
Hi all, I'm doing some work with ASN.1, and I'm thinking about how to represent the type BIT STRING. The obvious, and inefficient representation would be type BitString = [Bool] A reasonable sparse representation might be type BitString = [Integer] where the integers represent the

Re: [Haskell-cafe] Bit string

2006-09-14 Thread Thomas Conway
On 9/15/06, Lennart Augustsson [EMAIL PROTECTED] wrote: It's hard to tell what the best representation is if you don't know what the operations that you are going to perform are. If all you are going to do is I/O of bitstrings, then [Bool] could be great. If you need to do bitwise boolean ops

[Haskell-cafe] Anonymous types

2006-09-14 Thread Thomas Conway
Hi all, Is there any deep and meaningful reason why Haskell doesn't have anonymous discriminated union types? I'm thinking of an example like: data Amount = Amount Integer (Mg|G|Kg|T) Now this particular case is perhaps unconvincing - a seperate Units type would be quite sensible, however I'm

Re: [Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-20 Thread Thomas Conway
On 8/20/06, John Meacham [EMAIL PROTECTED] wrote: C++ templates are a whole nother ball of wax. And that's putting it politely. ;-) T. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-17 Thread Thomas Conway
On 8/18/06, John Meacham [EMAIL PROTECTED] wrote: [lots of good argument before and after deleted] There is a major difference though, in C++ (or java, or sather, or c#, etc..) the dictionary is always attached to the value, the actual class data type you pass around. in haskell, the

Re: [Haskell-cafe] How can we detect and fix memory leak due to lazyness?

2006-08-07 Thread Thomas Conway
Perhaps your instances will work correctly with this data declaration? Perhaps it might. But that misses an important point. The biggest impediment to developing large robust applications with Haskell is the opacity of its performance model. Haskell is fantastic in very many ways, but this