Re: [Haskell-cafe] Lisp like symbols in haskell

2009-12-08 Thread Ketil Malde
Luke Palmer writes: > data Sym = Sym String Hash > > fromString :: String -> Sym > fromString s = Sym s (hash s) > > instance Eq Sym where > Sym _ h == Sym _ h' = h == h' > Much as I am uncomfortable with hash-based equality. 1/2^256, despite > being very small, is not zero. It is begging

Re: [Haskell-cafe] ANN: hakyll-0.1

2009-12-08 Thread Ketil Malde
minh thu writes: > I wonder how APIs are covered. I don't think an API would be covered. The API is the standard way to use something, if copyright licenses cover usage like this, any executable will be a derivative of the operating system and (possibly) the compiler. > Why should your code

Re: [Haskell-cafe] Re: ANN: hakyll-0.1

2009-12-08 Thread Ketil Malde
Tom Tobin writes: > Your contributions could still be licensed under a different license > (e.g. BSD), as long as the licensing doesn't prevent somebody else to > pick it up and relicense it under GPL. Right. So hakyll is absolutely fine with a BSD3 license, AFAICS. >>> Serious

Re: [Haskell-cafe] Re: ANN: hakyll-0.1

2009-12-08 Thread Ketil Malde
Tom Tobin writes: > 1) Is there any scenario where Y can be distributed under a non-GPL > license (e.g., the BSD)? > 2) If so, what would Y's author need to do (or *not* do)? > 3) If Y must be released under the GPL under the above scenario, and > someone subsequently wrote library Z, an API co

Re: [Haskell-cafe] Re: ANN: hakyll-0.1

2009-12-09 Thread Ketil Malde
Tom Tobin writes: > In temporary lieu of posing questions explicitly to the SFLC, I dug > up a copy of _Intellectual Property and Open Source_ by Foobar (and > published by O'Reilly), and found this (from an entire chapter — > Chapter 12 — about the GPL): > "Nevertheless, there is a persistent

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-10 Thread Ketil Malde
"Richard O'Keefe" writes: >> You mean to parse a - b differently then a-b? You don't have the >> problem in LISP as AFAIR you use (- a b) but in Haskell it would be a >> problem. > Haskell already has this problem with ".", where we generally need (As somebody pointed out, this is usually unam

Re: [Haskell-cafe] Re: Why?

2009-12-10 Thread Ketil Malde
Sebastian Sylvan writes: > I think laziness requires purity to make sense. Laziness implies that the > order of evaluation is highly unpredictable and depends strongly on the > implementation details of libraries and such Laziness is like single-threaded concurrency. > So it's fickle. Someone a

Re: [Haskell-cafe] What about adding a wiki for each haskell project?

2009-12-13 Thread Ketil Malde
wren ng thornton writes: >> Using a wiki page for each project enables anybody to add comments.[...] I think this is a great idea. > Because of Duncan's concerns about imposing too much burden on > authors, and because there are many mature projects which already have > wikis etc, I have a coun

Re: [Haskell-cafe] What about adding a wiki for each haskell project?

2009-12-13 Thread Ketil Malde
wren ng thornton writes: > Ketil Malde wrote: >> At least the way I see it, it is primarily *not* for use by >> the author, and in fact most useful when the author is not around to >> actively support his project. > But if it's a wiki, wouldn't people be able

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Ketil Malde
Jon Fairbairn writes: > As one of the early Haskellers, I definitely preferred > underscores, because my intuition told me that it was closer in > appearance to normal English¹ text, > [1] and quite a high proportion of other natural languages. Which makes me wonder - might there be a (natural)

Re: [Haskell-cafe] Double free-ing

2009-12-17 Thread Ketil Malde
Mitar writes: > I checked ByteString's hGetNonBlocking now and I do see why it is > still better to use System.IO's hGetBufNonBlocking. > [...] But with hGetNonBlocking I would have to append two different > buffers to get a resulting buffer, what is completely unnecessary > O(n). Lazy ByteStri

Re: [Haskell-cafe] Pattern matching, and bugs

2009-12-18 Thread Ketil Malde
András Mocsáry writes: > Now we have a problem, which is most generally fixed in these ways: > C-like: >> switch ( x ) > > { > > Case 0: > > "Unchecked" > > Case 1: > > "Checked" > > Case 2: > > "Unknown" > > Default: > > "Nothing" > > } This is not a fix, this is a workaround for a des

[Haskell-cafe] profiling problem

2009-12-23 Thread Ketil Malde
Hi, I guess I should report this? Previously, this program got a signal 11, and that happened somewhat later in the process, so I'm not sure how reproducible it is. Source and data is available, if it is of any interest. (This is using the GHC currently shipped with Ubuntu 9.10.) xml2x3prof:

Re: [Haskell-cafe] FGL/Haskell and Hierarchical Clustering/dendograms

2009-12-23 Thread Ketil Malde
Nikolas Borrel-Jensen writes: > I have very hard to see, how this could be done efficiently without pointers > (as in C). I have thought of just saving the nodes from the start of the > root path, and traversing it, but a lot of searching should be done all the > time. I must admit I didn't foll

[Haskell-cafe] 64-bit Bloom filters?

2010-01-05 Thread Ketil Malde
Hi, I've previously used Bloom filters on 32-bit Linux with some success. However, after upgrading to 64 bit, my Bloom filter applications crash or misbehave in random ways. So: is anybody successfully using Bloom filters on 64 bit computers? Although I'm not clear on why it would cause crashes

Re: [Haskell-cafe] short licensing question

2010-01-11 Thread Ketil Malde
Svein Ove Aas writes: >>> when writing a Haskell library that uses two other Haskell libraries -- >>> one licensed under BSD3 and one under LGPL -- what are allowed >>> possibilities for licensing the written package? >> Any resulting binaries might contain a mixture of such libraries, and >> th

Re: [Haskell-cafe] short licensing question

2010-01-12 Thread Ketil Malde
Sebastian Fischer writes: > I wonder whether the following statements are valid: You want my layman's opinion? > When I write a program that uses an LGPL library, I am allowed to > distribute the *sources* of my program under a permissive (non- > copyleft) license like BSD3. Yes. I don't thi

Re: [Haskell-cafe] Language simplicity

2010-01-13 Thread Ketil Malde
sylvain writes: > Let me order your list: > Smalltalk: 0 > Lisp: 0 > Tcl: 0 If you count reserved tokens, I guess Lisp reserves parentheses and whitespace? > Haskell: 21 * > Python: 31 > C: 32 * > JavaScript: 36 > Ruby: 38 > --- > Borland Turbo Pascal: ~50 > Java: 53 > Eiffel: 59 > C++: 62

Re: [Haskell-cafe] Language simplicity

2010-01-13 Thread Ketil Malde
Fraser Wilson writes: > module LordsOfMidnight.Character(Character) where > > data Character = C { name :: String, > location :: (Int,Int), > facing :: Direction, > hour :: Int, > energy :: Int, >

Re: [Haskell-cafe] Language simplicity

2010-01-13 Thread Ketil Malde
"Brandon S. Allbery KF8NH" writes: > If we're going to go that far, FORTRAN and PL/1 have none. FORTRAN is > somewhat infamous for this: There's also the option (perhaps this was PL/1?) of writing constructs like: IF THEN THEN IF ELSE THEN etc. Having few reserved words isn't necessarily a be

Re: [Haskell-cafe] Typed Configuration Files

2010-01-14 Thread Ketil Malde
Magnus Therning writes: > Seriously, cmdargs is *brilliant*. It's also magic (to me). On this list, I'm uncertain whether "brilliant" is a warning or a recommendation, but "magic" is clearly irresistible, so I had a go at using cmdargs. And I agree, it is really nice in quickly and succintly

Re: [Haskell-cafe] wildcards for type variables?

2010-01-14 Thread Ketil Malde
Ozgur Akgun writes: > Can someone give an example of a "reasonable" function that never uses one > of its parameters, and justify the existence of that parameter in this case, > please? E.g, 'const' is useful when you need something to feed to a higher order function: -- an element <=3 starts

Re: [Haskell-cafe] Typed Configuration Files

2010-01-14 Thread Ketil Malde
Ketil Malde writes: > - CmdArgs helpfully provides default --help, --version as well as > --quite and --verbose. For the two former, there's also a nice > default implementation, but presumably the latter two are for use in > the program proper. Unfortunately, I don

Re: [Haskell-cafe] Typed Configuration Files

2010-01-15 Thread Ketil Malde
Neil Mitchell writes: > The CmdArgs manual might help: > http://community.haskell.org/~ndm/darcs/cmdargs/cmdargs.htm Yes, this is what I used :-) Presenting examples is great, but gives me the hubris to rip off the example that seems to fit most closely, and modify it. This makes for a quick s

Re: [Haskell-cafe] Re: AlternativePrelude extension

2010-01-17 Thread Ketil Malde
Maciej Piechotka writes: >> However, the option to set language extension globally is still >> available, either as an option to the compiler when building, or in >> the cabal file describing the package. > Hmm. Since the extensions should be specified in Cabal anyway (at least > I guess it does

Re: [Haskell-cafe] Having a look at XMonad window manager

2010-01-19 Thread Ketil Malde
michael rice writes: > Perhaps. Is there a Linux distro that's more XMonad friendly? I use Ubuntu, in the GDM login screen, I get a drop down menu that includes Xmonad as an option. Even if Fedora doesn't have this, it probably has a "Failsafe" option that will just give you an xterm, from whic

Re: [Haskell-cafe] scheduling an alarm

2010-01-28 Thread Ketil Malde
Brian Denheyer writes: > doEvent f usDelay = forkIO $ > threadDelay usDelay > doEvent f usDelay > f There's a missing 'do' here, right? >> Infinite loop? yes, that is what you wanted. Memory gobbling? Why >> would you think that? > Why would I think that ? > doEvent f

Re: [Haskell-cafe] Linguistic hair-splitting

2010-01-28 Thread Ketil Malde
Daniel Fischer writes: >> It has been known to call such things 'computations', I think "actions" has been used, too, but perhaps mostly for things in IO and similar monads? >> as opposed to 'values', and even to separate the categories of types >> and expressions which deliver the two. > As

Re: [Haskell-cafe] scheduling an alarm

2010-01-28 Thread Ketil Malde
Thomas DuBuisson writes: > Yes - I said that in a later e-mail but it doesn't fix me violating my own > peeve about non-functional code snippits on -cafe. I guess we're spoiled by the type checker catching all our mistakes. Since I recently discovered the new and wonderful world of C-c C-l in h

Re: [Haskell-cafe] Re: Generate 50 random coordinates

2006-12-04 Thread Ketil Malde
Henning Thielemann wrote: On Sat, 2 Dec 2006 [EMAIL PROTECTED] wrote: -- The IO -- Who rides so late through the bits and the bytes? It's Haskell with his child Hank; He has the boy type safe in his arm, He holds him pure, he holds him warm. I vote for an art/lyrics section on Haskel

Re: [Haskell-cafe] Designing an object model in Haskell

2006-12-07 Thread Ketil Malde
John Ky wrote: Hi, I've got an object model that I have a difficult time conceptualising how it might look like in Haskell: class Element { } class Inline : Element { } class ParentInline : Inline { List children; } class Bold : ParentInline { } class Underline : ParentInline { } class

Re: [Haskell-cafe] Writing "Haskell For Dummies Or At Least For People Who Feel Like Dummies When They See The Word 'Monad'"

2006-12-12 Thread Ketil Malde
Paul Hudak wrote: Maybe some of you can do better, but it's really tough to show someone how an /advanced/ Haskell programmer would solve /advanced /problems that arise in the real world. As a simple example, I love this recent quote by Garrett Morris: "I'm personally fond of framing most

[Haskell-cafe] Re: a cabal/database lib experience

2006-12-12 Thread Ketil Malde
Simon Marlow wrote: + add a dedicated command "cabal", which does nothing more than "runhaskell Setup", but is more memorable and suggestive cabal-setup does this, but wasn't included with the latest release of Cabal. It should be in the next one, I hope. The plan is to deprecate

Re: [Haskell-cafe] for loops and 2d arrays in haskell

2007-01-19 Thread Ketil Malde
Fernan Bolando wrote: what is the simplest way to implement the following code in haskell? it's just printing the contents of 2D array. for(i = 0; i < imax; i++){ for(n = 0; n < nmax; n++){ printf("%i:%i = %f\n", array[i][n]); } } *%* ghci ___ ___ _ * / _ \ /\ /\/ __(

Re: [Haskell-cafe] basic field questions

2007-01-24 Thread Ketil Malde
jamin1001 wrote: What if I want to do something like data Chair = Chair {pos:: Int, color :: Int} data Table = Table {pos:: Int, color :: Int} data Properties = Props { pos, color :: Int } data Chair = Chair Props data Table = Table Props or: data Chair = Chair Int Int data Table = Table

Re: [Haskell-cafe] Re: Channel9 Interview: Software Composability and theFu ture of Languages

2007-01-31 Thread Ketil Malde
Kirsten Chevalier wrote: On 1/31/07, Bill Wood <[EMAIL PROTECTED]> wrote: On Wed, 2007-01-31 at 19:51 +1100, Donald Bruce Stewart wrote: . . . > foldl (\water dish -> wash water dish) soapywater dishes :: [Dishes] Nice example. First, note that you can't get close with map -- you need

Re: [Haskell-cafe] Newbie: generating a truth table

2007-02-06 Thread Ketil Malde
[EMAIL PROTECTED] wrote: I would like to create a Haskell function that generates a truth table, for all Boolean values, say, using the following "and" function : and :: Bool -> Bool -> Bool and a b = a && b What is the type of the resulting table? I have tried creating a second function ca

Re: [Haskell-cafe] Newbie: generating a truth table

2007-02-06 Thread Ketil Malde
[EMAIL PROTECTED] wrote: Ketil, thanks for you help. Here's the code: and2 :: Bool -> Bool -> Bool and2 a b = a && b loop = [ and2 x y | x <- [True,False], y <- [True,False] ] Now, how do I have Haskell print printStrLn("True and True = ") + printStrLn("True and False = ") + Well,

Re: [Haskell-cafe] Re: Generalizing three programs

2007-02-06 Thread Ketil Malde
Bjorn Lisper wrote: Erlang actually stands for "Ericsson Language". I think the alternative interpretation is intentional, though. According to this: http://www.erlang.org/pipermail/erlang-questions/1999-February/98.html A.K.E. was the actual origin, but with an intentional ambiguity.

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Ketil Malde
Donald Bruce Stewart wrote: Following recent discussion about a cross-implementation performance benchmark suite, based on nofib, I've gone and combined nofib with the great language shootout programs, and rewritten the build system to support cross implementation measurements. Great work! .

Re: [Haskell-cafe] LGPL libraries

2007-03-06 Thread Ketil Malde
Kirsten Chevalier wrote: I am not a lawyer, but there are a couple of important points getting missed in this thread: [...] "That's just silly" isn't a defense. [...] and thus "trust me, we're not going to sue you" isn't the answer they're looking for, even if it's a completely accurate an

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Ketil Malde
David Roundy wrote: Actually, I was thinking this sounded a lot like DiffArrays. Except that DiffArrays are slow and expensive in both space and time (compared with strict unboxed arrays). They necesarily hold boxed values so you pay a factor of at least two in space cost (for arrays of Do

Re: [Haskell-cafe] Lazy IO and closing of file handles

2007-03-14 Thread Ketil Malde
Donald Bruce Stewart wrote: pete-expires-20070513: When using readFile to process a large number of files, I am exceeding the resource limits for the maximum number of open file descriptors This is very annoying - I can't see any good reason why file descriptors should "run out" (before memo

Re: [Haskell-cafe] Lazy IO and closing of file handles

2007-03-15 Thread Ketil Malde
Matthew Brecknell wrote: Ketil Malde: Perhaps this is an esoteric way, but I think the nicest approach is to parse into a strict structure. If you fully evaluate each Email (or whatever structure you parse into), there will be no unevaluated thunks linking to the file, and it will be

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Ketil Malde
Neil Mitchell wrote: close (x:y:xs) | abs (x - y) < 0.1 = y close (x:xs) = close xs I don't know how to add it into the one liner though - although I suspect someone here will :) head . head . filter (\(x:y:_) -> abs (x-y) < 0.1) ? -k ___ Haskell-C

Re: [Haskell-cafe] AI Strike Force!

2007-03-26 Thread Ketil Malde
Andrew Wagner wrote: The time has come! Calling all Haskell programmers interested in AI! I've established a new home base at http://www.haskell.org/haskellwiki/AI . I have added a link to the Google Summer of Code ticket for a machine learning library, which I hope is approriate to categorize a

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

2007-04-09 Thread Ketil Malde
On Tue, 2007-04-10 at 13:16 +1000, Duncan Coutts wrote: > Note, that like in your original we read each file twice, once for the > mean and once for the variance. As an aside, you can calculate both mean and variance in one pass (and constant space) by calculating the sum of elements 'x', the su

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Ketil Malde
On Mon, 2007-04-16 at 13:27 +0200, Thomas Hartman wrote: > To recap: transform a piece of simple code that works in serial, so it > works in parallel. Maybe even a couple, or three ways: using forks, > using threads, using map reduce. This made me think of one of my favorite observations. You oc

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Ketil Malde
On Mon, 2007-04-16 at 11:06 +0100, Dougal Stanton wrote: > > A one-liner using PCRE regex might also be of use. > Unless it can be performed with astounding dexterity, I don't think > try to beat, for example, Perl at its own game will produce worthwhile > results. One possibility is a task wher

[Haskell-cafe] System.Random

2007-04-16 Thread Ketil Malde
Hi, I've recently stumbled upon some issues with the System.Random module, and thought I'd try to remedy them. However, I'm not quite sure what an optimal resolution is. Problem 1 is that I often get the same "random" number on consecutive program runs [1]. Looking at the code for initializatio

Re: [Haskell-cafe] Zero-arity tests in QuickCheck and displaying expected result

2007-04-17 Thread Ketil Malde
On Mon, 2007-04-16 at 22:17 +0100, Joel Reymont wrote: > On Apr 16, 2007, at 10:11 PM, Lennart Augustsson wrote: >> Why can't you just do 'f 1 2 3 == (4, 5, 6, 7)' to test f? > That's what HUnit does but it's enticing to be able to standardize on > QuickCheck for all of your testing. Prelude

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-22 Thread Ketil Malde
On Sun, 2007-04-22 at 00:25 -0400, Pete Kazmier wrote: > Pete Kazmier <[EMAIL PROTECTED]> writes: > > > I'd love to see other Haskell implementations as well if anyone has a > > few moments to spare. Admittedly, it took me several hours to get my > > version working, but I'm a Haskell newbie. Un

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-22 Thread Ketil Malde
On Sun, 2007-04-22 at 11:51 -0400, Pete Kazmier wrote: > type WordFreq = M.Map B.ByteString Int > > train:: [B.ByteString] -> WordFreq > train words = frequencyMap > where > frequencyMap = foldr incWordCount M.empty words > incWordCount w m = M.insertWith (+) w

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-23 Thread Ketil Malde
On Sun, 2007-04-22 at 13:15 -0700, Stefan O'Rear wrote: > You can almost always do DP with less space, and this is no exception: > linear space for full Levenschtein, constant for the diagonal band. Right. Especially as we only want the final score and not the exact edits, we only need to keep

Re: [Haskell-cafe] Is there a best *nix or BSD distro for Haskell hacking?

2007-04-24 Thread Ketil Malde
On Sun, 2007-04-22 at 10:02 -0400, David Cabana wrote: > I have a spare Windows machine I want to put to better use. I want > to turn it into a Haskell hacking box, and was wondering whether any > particular *nix or BSD distribution is best (or worst) suited for > this. Any thoughts? I hav

Re: [Haskell-cafe] Poor first impression

2007-04-27 Thread Ketil Malde
On Fri, 2007-04-27 at 06:28 -0300, Fernando Cassia wrote: > So I follow the directions Which directions are those? If they somehow tell users of Fedora to download tarballs, they should be rectified to instruct users to 'yum install ghc' instead. > So, I conclude that Haskell is not ready for

Re: [Haskell-cafe] The Trivial Monad

2007-05-07 Thread Ketil Malde
On Fri, 2007-05-04 at 20:02 +0400, Bulat Ziganshin wrote: >> don't understand what this monad thingy is all about. > the whole monadic business was introduced with the sole goal to let > haskellers believe that they are smarter than other programmers :) Or perhaps to ensure that they are? -k _

Re: [Haskell-cafe] Roles == type classes ???

2007-05-09 Thread Ketil Malde
On Wed, 2007-05-09 at 10:41 +0100, Magnus Therning wrote: > The way roles/traits are described in [1] (and the pages it links to) > make me think of Haskell type classes. Am I completely off in doing > that? At http://mail.python.org/pipermail/python-3000/2007-April/007026.html we find this passa

Re: [Haskell-cafe] Re: Editor

2007-05-22 Thread Ketil Malde
On Tue, 2007-05-22 at 10:19 +0200, apfelmus wrote: > http://www.asktog.com/TOI/toi06KeyboardVMouse1.html > > It adresses the question whether selecting commands in menus with the > mouse or accessing them via keyboard shortcuts is faster. The answer is: > > "* Test subjects consistently report

Re: [Haskell-cafe] (no subject)

2007-05-23 Thread Ketil Malde
> And also, there is one problem left. When i read a binary file, data is > truncated at the charactor EOF. Which character is this: ^D or ^Z? Which operating system - Windows, perhaps? And you are reading from a file, not from stdin? -k ___ Haskel

Re: Re: [Haskell-cafe] (no subject)

2007-05-24 Thread Ketil Malde
On Thu, 2007-05-24 at 17:01 +0800, L.Guo wrote: > Tring openBinaryFile, Well, did you get it to work? > I can not locate which module including readBinaryFile. This is what I find in System.IO (ghci> :b System.IO): openBinaryFile :: FilePath -> IOMode -> IO Handle openBinaryTempFile :: Fi

Re: [Haskell-cafe] Why this exception occurs ?

2007-05-25 Thread Ketil Malde
On Fri, 2007-05-25 at 17:33 +1000, Donald Bruce Stewart wrote: > Sorry, I should clarify, think about how to represent: > > 256 :: Word8 So the error isn't really divide by zero, but overflow. I've been bitten by this, too, and L.Guo should count him/herself lucky to get an error, and not j

Re: [Haskell-cafe] Darcs users [was: New book: Real-World Haskell!]

2007-05-29 Thread Ketil Malde
On Tue, 2007-05-29 at 14:05 -0500, Doug Kirk wrote: > I *want* people (and companies) to move to Haskell; therefore, I want > to lower the entry "price". The goal is to introduce a new language, > not a new SCM tool. You certainly wouldn't want to leave the > impression that one MUST use darcs in

Re: [Haskell-cafe] Language extensions [was: Memoization]

2007-05-30 Thread Ketil Malde
On Tue, 2007-05-29 at 21:28 +0100, Andrew Coppin wrote: > > phantom types: > > the types of ghost values (in other words, we are only interested in > > the type, not in any value of that type). > Mmm... Still not seeing a great amount of use for this one. The point is to 'tag' something with a

Re: [Haskell-cafe] Language extensions

2007-05-30 Thread Ketil Malde
On Tue, 2007-05-29 at 21:39 +0100, Andrew Coppin wrote: > My point is for most programs, trying to figure out exactly what you > want the program to do is going to be much harder than implementing a > program that does it. And the solution is..to not say anything about what the program should d

RE: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Ketil Malde
On Thu, 2007-05-31 at 08:46 +0100, Simon Peyton-Jones wrote: > | $ ghc htrace.hs -o htrace > | $ ghc -O2 htrace.hs -o htrace > | compilation IS NOT required > Yes, I think it's a bug. GHC should really compare the flags used > last time with the flags used this time [...] As an (easier) alterna

Re: [Haskell-cafe] ordNub

2013-07-16 Thread Ketil Malde
Francesco Mazzoli writes: >> import qualified Data.HashSet as S >> >> nub :: Hashable a => [a] -> [a] >> nub = S.toList . S.fromList > Well, the above is not stable while Niklas’ is. But I guess that’s not > the point of your message :). We could also implement Data.BloomFilter.nub, which re

[Haskell-cafe] GHC and backwards compatibility

2013-08-19 Thread Ketil Malde
I recently encountered the following problem: $ cabal install Resolving dependencies... Configuring array-0.4.0.1... Building array-0.4.0.1... Preprocessing library array-0.4.0.1... Data/Array/IArray.hs:1:14: Unsupp

Re: [Haskell-cafe] GHC and backwards compatibility

2013-08-19 Thread Ketil Malde
Joe Q writes: > This is definitely an issue with the array package not setting the right > minimum versions. You should email the maintainer. Yes, that would be the thing to do, except that the maintainer is "librar...@haskell.org", whom I believe does not accept emails from me. :-( But if you

Re: [Haskell-cafe] abs minBound < (0 :: Int) && negate minBound == (minBound :: Int)

2013-08-20 Thread Ketil Malde
Richard A. O'Keefe writes: >> I think a better argument for twos complement is that you're just >> doing all of your computations modulo 2^n (where n is 32 or 64 or >> whatever), and addition and multiplication work as expected modulo >> anything. > To me, that's not a better argument. It isn'

Re: [Haskell-cafe] Compiling stringable with GHC 7.0.4

2013-08-20 Thread Ketil Malde
I took the liberty of implementing this fix and uploading stringable-0.1.1.1 to HackageDB. I tested it on GHC 7.0.4 (you know, shipped with the cutting-edge Fedora distribution one year ago, but ancient and no longer to be bothered with by Haskell standards :-) and on 7.6.2. -k Ketil Malde

Re: [Haskell-cafe] abs minBound < (0 :: Int) && negate minBound == (minBound :: Int)

2013-08-20 Thread Ketil Malde
> fact 0 = 1 > fact n = n * fact (n-1) > > Now I ran it as fact 100 with signature Int -> Int and with > Integer -> Integer > > In the first case I got 0 in about 3 seconds [...] > And if that sounds like a unreal argument, consider representing and > storing Graham's number. So, since comp

Re: [Haskell-cafe] Doubting Haskell

2008-03-04 Thread Ketil Malde
Paul Johnson <[EMAIL PROTECTED]> writes: > I'm surprised you found the significant whitespace difficult. I wonder if this has something to do with the editor one uses? I use Emacs, and just keep hitting TAB, cycling through possible alignments, until things align sensibly. I haven't really tri

[Haskell-cafe] Job opening: Use Haskell to save the environment!

2008-03-05 Thread Ketil Malde
tional regulations and starts out at NOK 325000 (i.e., approximately €4)/year. Contact Ketil Malde ([EMAIL PROTECTED], +47 55238647) for further details. ¹) The target of the project is the sea louse, which is a large ecological and economical problem. -- If I haven't seen further,

[Haskell-cafe] SimpleArgs

2008-03-06 Thread Ketil Malde
Hi, Often when I write small scripts, I find I just want a couple of command line arguments but don't want to go the whole GetOpt route. SimpleArgs is an attempt to make the raw getArgs somewhat less raw, and quick and dirty scripts a bit less dirty without sacrificing the quickness. Since I fin

Re: [Haskell-cafe] Analysing Haskell with Graph Theory

2008-03-07 Thread Ketil Malde
"Ivan Miljenovic" <[EMAIL PROTECTED]> writes: > Can anyone think of any other kind of functions that would be useful > in this kind of source code analysis? Sometimes, it's not obvious where to draw boundaries between modules, perhaps finding a "smallest cut" (if that is the correct term) could h

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-10 Thread Ketil Malde
Adrian Hey <[EMAIL PROTECTED]> writes: > But seriously, once you admit the possibility that even if x == y it > still matters which of x or y is used in expressions than all hell > breaks loose. I shudder to think just how much Haskell code there must > be out there that is (at best) ambiguious or

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-11 Thread Ketil Malde
"Krzysztof Skrzętnicki" <[EMAIL PROTECTED]> writes: > The above results are for 100 Ints x 10 runs, but I don't expect any > drastic changes in longer run. I leave the interpretation up to you. Might I suggest (also) testing with numbers of smaller magnitude? Lots of collisions is another kil

Re: [Haskell-cafe] Re: Constructing Data.Map from ByteString

2008-03-12 Thread Ketil Malde
"Dave Tapley" <[EMAIL PROTECTED]> writes: > I've upgraded to bytestring-0.9.0.5 from Darcs, no improvement. > Also this morning I tried using Data.HashMap with Bytestring's readInt > and HashMap's hashInt.. The result was a Stack space overflow :( That's not so good. >> It works as required, lo

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-12 Thread Ketil Malde
Adrian Hey <[EMAIL PROTECTED]> writes: > So really I think the docs have this backwards. It's sortBy that > implements a stable sort (assuming a suitably sane comparison function > I guess) and apparently sort is whatever you get from (sortBy compare). > But this is unduly restrictive on possible

Re: [Haskell-cafe] Re: Constructing Data.Map from ByteString

2008-03-12 Thread Ketil Malde
Duncan Coutts <[EMAIL PROTECTED]> writes: > To get something really compact we could use an index composed of three > unboxed Int arrays. To get something *really* compact, we could build a (kind of) suffix array. That is, we do a lexical sort of the lines, and store the sorted offsets of the l

Re: [Haskell-cafe] floating point operations and representation

2008-03-13 Thread Ketil Malde
"Jacob Schwartz" <[EMAIL PROTECTED]> writes: > A test on IEEE computers (x86 and x86-64), shows that for > a range of 64-bit "double" values, the answers in C do differ (in the > last bit) if you use "log2(x)" and "log10(x)" versus "log (x) / > log(2)" and "log(x) / log(10)". I think this may als

Re: [Haskell-cafe] Re: Some clarity please!

2008-03-13 Thread Ketil Malde
Aaron Denney <[EMAIL PROTECTED]> writes: > Well, the way the report specifies that max's default definition > is. I'd actually favor making that not an instance function at > all, and instead have max and min be external functions. If you permit a naïve question: Prelude> :i Ord class (Eq a) =>

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Ketil Malde
Thomas Engel <[EMAIL PROTECTED]> writes: > My problem is: How can I get the input values into the calculations and back > the result to the output. > In an other language I would use global variables for this. That would be bad style. > An other point is that I want to separate the input from

Re: [Haskell-cafe] [Newbie] Problem with Data.Map (or something else ?)

2008-03-31 Thread Ketil Malde
"Bruno Carnazzi" <[EMAIL PROTECTED]> writes: > The program ends for values up to 40 : Wild guess here - I know nothing about the problem, and haven't examined your program in detail - but could it be that you default to Int, and that it wraps silently at some power of two, thereby making your

Re: [Haskell-cafe] function type def

2008-04-01 Thread Ketil Malde
PR Stanley <[EMAIL PROTECTED]> writes: > It's one of those things - I know sort of instinctively why it is so > but can't think of the formal rationale for it: > f g x = g (g x) :: (t -> t) -> (t -> t) (t -> t) -> (t -> t) So g :: t -> t x :: t Thus f :: (t -> t) -> t -> t (The last

Re: [Haskell-cafe] Re: Shouldn't this loop indefinitely => take (last [0..]) [0..]

2008-04-04 Thread Ketil Malde
"Neil Mitchell" <[EMAIL PROTECTED]> writes: >> length, take, drop and index working on machine-sized Ints by default >> are really a bit of a wart, aren't they? > Yes. Also, having strict Int's by default is a bit ugly, [..] > (Not that it isn't a worthwhile trade off, but it is still loosing

Re: [Haskell-cafe] Quick check?

2008-04-08 Thread Ketil Malde
"Galchin, Vasili" <[EMAIL PROTECTED]> writes: > What are some examples of libraries in HackageDB that use either Quick > Check (pure side) or Monad testing? Is there a way to use "darcs" to answer my > question? I used the ByteString library as a guideline when developing testing (and to a

Re: [Haskell-cafe] ghc

2008-04-10 Thread Ketil Malde
"Cetin Sert" <[EMAIL PROTECTED]> writes: > Is GHC required to be installed on the target OS I compile Haskell binaries > for > in order for these binaries to run? I need a quick answer on that! Quick answer: No. GHC produces normal, standalone binaries. You may have problems with dynamic libra

Re: [Haskell-cafe] library version problem

2008-04-11 Thread Ketil Malde
"Galchin, Vasili" <[EMAIL PROTECTED]> writes: >> ghci > :m System.Posix > > I am getting the wrong version of the Unix package. I know this to be true > because I did > ghc-pkg latest unix > > and got unix-2.3.0.0 > > I want unix.2.2.0.0 because this version has changes that I made Naturall

Re: [Haskell-cafe] library version problem

2008-04-11 Thread Ketil Malde
Ketil Malde <[EMAIL PROTECTED]> writes: > Either rename your modified version to 2.4 (or similar), specify the > exact version in your *application's* cabal file, ..or you could compile your application specifying the package explicitly, using "-package unix-2.2.0.0"

Re: [Haskell-cafe] retrospective on 'seq' -> 'unsafeSeq' ?

2008-04-14 Thread Ketil Malde
Bernie Pope <[EMAIL PROTECTED]> writes: > Of course, [unsafeShow] won't be able to print functions in any helpful way, > unless we attach source code information to > functions as well (which may be worth doing anyway?). It might not be able to print the function's definition, but perhaps its typ

[Haskell-cafe] compressed pointers?

2008-04-16 Thread Ketil Malde
One of the downsides of a 64-bit environment is the increased size of pointers. This means that the cost of a String increases from something like 12 bytes per char to something like 24. I notice BEA uses something called "compressed pointers" to get the 64-bit (more registers, etc) benefits wit

Re: [Haskell-cafe] compressed pointers?

2008-04-17 Thread Ketil Malde
Don Stewart <[EMAIL PROTECTED]> writes: > One small upside (performance wise), is that the bottom 3 bits of the > pointer are now used to encode the constructor on 64 bits, so 'case' gets a > good percent cheaper. Well - my experience (which is from before this optimization was added, I think) is

Re: [Haskell-cafe] lookup tables & style guidelines

2008-04-23 Thread Ketil Malde
Don Stewart <[EMAIL PROTECTED]> writes: >>1) what is the most performant lookup table/hashtable/dictionary solution >>for Haskell? > Data.IntMap is awfully good. Is it benchmarked anywhere? Compared to the Judy bindings, or Adrian Hey's AVL trees, or Data.Hashtable? I rewrote (roughl

Re: [Haskell-cafe] how can this code be less?

2008-04-24 Thread Ketil Malde
cetin tozkoparan <[EMAIL PROTECTED]> writes: > sublist :: Eq a => [a] -> [a] -> Bool > sublist [] _ = True > sublist (_:_) [] = False This can be simplified a bit, I think (Reformatted to one line): > sublist (x:xs) (y:ys) > | x == y = if isEqual (x:xs) (y:ys) == False then sublist (x:xs

Re: [Haskell-cafe] announce: Glome.hs-0.3 (Haskell raytracer)

2008-04-26 Thread Ketil Malde
david48 <[EMAIL PROTECTED]> writes: >> Personally, I don't see the point in rendering a couple of million >> mathematically flat surfaces, > What about speed ? "If it doesn't have to be correct, it can be arbitrarily fast" :-) -k -- If I haven't seen further, it is by standing in the footprin

Re: [Haskell-cafe] runInteractiveProcess and hGetLine on Windows

2008-05-07 Thread Ketil Malde
"Richard A. O'Keefe" <[EMAIL PROTECTED]> writes: > According to the ASCII standard, it was fully legitimate to use > backspace and carriage return to get over-striking (which is why ASCII > includes oddities such as ^ and ` : they really are for accents, and , > did double duty as cedilla, ' as ac

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread Ketil Malde
PR Stanley <[EMAIL PROTECTED]> writes: > What is the underlying rationale for the Maybe data type? It is the equivalent of a database field that can be NULL. > is it the safe style of programming it encourages/ Yes. Consider C, where this is typically done with a NULL pointer, or Lisp,

Re: [Haskell-cafe] Endianess

2008-05-13 Thread Ketil Malde
Aaron Denney <[EMAIL PROTECTED]> writes: > I used to be a big-endian advocate, on the principle that it doesn't > really matter, and it was standard network byte order. Now I'm > convinced that little endian is the way to go I guess it depends a lot on what you grew up with. The names (little/b

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