Re: [Haskell-cafe] Monte Carlo Pi calculation (newbie learnings)

2007-11-06 Thread Henning Thielemann
On Mon, 5 Nov 2007, Andrew Coppin wrote: randList :: Int - IO [Int] randList n = mapM (\x - randomRIO (0, randMax)) [1..n] replicateM n (randomRIO (0, randMax)) but it is certainly better to use randomR and wrap it in a State monad ___

Re: [Haskell-cafe] Strange Type Inference

2007-11-06 Thread Henning Thielemann
On Mon, 5 Nov 2007, C.M.Brown wrote: I was given a quandary this evening, suppose I have the following code: Did you already try Prelude's 'asTypeOf' function? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: speeding up fibonacci with memoizing

2007-11-06 Thread Henning Thielemann
On Tue, 6 Nov 2007, marnes wrote: fib :: Integer - Integer fib n = fibaux n 0 1 1 where fibaux :: Integer - Integer - Integer - Integer - Integer fibaux i a b c | i==0 = a | i/=0 = fibaux (i-1) b c (b+c) http://www.haskell.org/haskellwiki/Memoization

Re: [Haskell-cafe] Fibbonachi numbers algorithm work TOO slow.

2007-11-07 Thread Henning Thielemann
On Tue, 6 Nov 2007 [EMAIL PROTECTED] wrote: However, this is still an O(log n) algorithm, because that's the complexity of raising-to-the-power-of. And it's slower than the simpler integer-only algorithms. You mean computing the matrix power of /1 1\ \0 1/ ?

Re: [Haskell-cafe] generating Maybe

2007-11-07 Thread Henning Thielemann
On Thu, 8 Nov 2007, Stuart Cook wrote: On 11/8/07, Tim Newsham [EMAIL PROTECTED] wrote: Data.Maybe has functions for processing Maybe's but nothing useful for creating maybe. I think the following would be a very useful addition, a guarded function: guarded :: (a - Bool) - (a -

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Henning Thielemann
On Thu, 8 Nov 2007 [EMAIL PROTECTED] wrote: Report from the Rabbit Warren. Thank you, everybody, for your contribution. The problem was, how to construct a one-liner which generates the infinite Rabbit Sequence: 10110101101101011010110110101101101011010110110101101011011010110... This is

Re: [Haskell-cafe] generating Maybe

2007-11-07 Thread Henning Thielemann
On Wed, 7 Nov 2007, Tim Newsham wrote: Data.Maybe has functions for processing Maybe's but nothing useful for creating maybe. I think the following would be a very useful addition, a guarded function: guarded :: (a - Bool) - (a - b) - a - Maybe b guarded p f x | p x = Just

Re: [Haskell-cafe] Disable echo in POSIX terminal

2007-11-10 Thread Henning Thielemann
On Fri, 9 Nov 2007, Derek Elkins wrote: Pointless frobbing but is there any issue with setting the echo to False when it is already False? Otherwise not checking seems to both simpler and quicker (not that performance matters), i.e. getpasswd h = do wasEnabled - hGetEcho h

Re: [Haskell-cafe] Sinus in Haskell

2007-11-10 Thread Henning Thielemann
On Sat, 10 Nov 2007, Daniel Fischer wrote: Since you seem to know a lot about these things, out of curiosity, do you know how these functions are actually implemented? Do they use Taylor series or other techniques? I think that for sin and cos the Taylor series are a good choice. For other

Re: [Haskell-cafe] Sinus in Haskell

2007-11-11 Thread Henning Thielemann
On Sat, 10 Nov 2007 [EMAIL PROTECTED] wrote: Quoting [EMAIL PROTECTED]: Then, a *rational* approximation gives you the same precision with less coeffs. Nowadays the division is not sooo much more expensive than the multiplication, so the efficiency doesn't suffer much. It might not

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Henning Thielemann
On Sun, 11 Nov 2007, Andrew Coppin wrote: Somebody just asked me ...if GHC is written in Haskell, how the heck did they compile GHC in the first place? ... and what happens, if they add a new feature, use it in the compiler itself, and then it turns out, that the implementation of the new

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Henning Thielemann
On Sun, 11 Nov 2007 [EMAIL PROTECTED] wrote: G'day all. Quoting [EMAIL PROTECTED]: But... tell me please, ANYONE, who takes part in this inspiring exchange: How many COBOL programs have you written in your life? As you well know, only one COBOL program has ever been written. The rest

Re: [Haskell-cafe] Re: Weird ghci behaviour?

2007-11-12 Thread Henning Thielemann
On Mon, 12 Nov 2007, Chris Smith wrote: Dan Piponi wrote: Several months late I now have a simple test case for what I think is either a GHC bug or a misexpectation on my part. Here's what it looks like to me. If there is a .hi and .o file sitting around for a module, then GHCi will

Re: [Haskell-cafe] Why are OCaml and Haskell being used at these companies?

2007-11-13 Thread Henning Thielemann
On Mon, 12 Nov 2007, Derek Elkins wrote: On Mon, 2007-11-12 at 15:51 -0800, Donn Cave wrote: On Nov 12, 2007, at 12:00 PM, Galchin Vasili wrote: I am looking for (objective.. i.e. not juts FPL cheerleading) opinions as to why Wall Street ( http://www.janestcapital.com/) and banking

Re: [Haskell-cafe] Why are OCaml and Haskell being used at these companies?

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, Jon Harrop wrote: Penetration is highest in parts of industry where small groups of talented programmers get together, most notably startups. Look at XenSource, Wolfram Research, The MathWorks, ?? Mathematica and MatLab are just the opposite of statically safe

Re: [Haskell-cafe] Why are OCaml and Haskell being used at these companies?

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007 [EMAIL PROTECTED] wrote: Henning Thielemann writes: ?? Mathematica and MatLab are just the opposite of statically safe programming. Is this a religious statement, quite popular in our Church of Functionalism, or you mean something concrete by that, and if yes

Re: [Haskell-cafe] Why are OCaml and Haskell being used at these companies?

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, Jon Harrop wrote: On Tuesday 13 November 2007 08:41, Henning Thielemann wrote: On Tue, 13 Nov 2007, Jon Harrop wrote: Penetration is highest in parts of industry where small groups of talented programmers get together, most notably startups. Look at XenSource

Re: [Haskell-cafe] Why are OCaml and Haskell being used at these companies?

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007 [EMAIL PROTECTED] wrote: Henning Thielemann writes: [EMAIL PROTECTED] wrote: Henning Thielemann writes: ?? Mathematica and MatLab are just the opposite of statically safe programming. Is this a religious statement, quite popular in our Church

RE: [Haskell-cafe] Re: Weird ghci behaviour?

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, Simon Peyton-Jones wrote: Meanwhile, though, the best we can do is improve the documentation: Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling? ... or even better - words that GHCi can say, when it

Re: [Haskell-cafe] let vs. where

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, John Lato wrote: Hello, I know there are several important differences between let-expressions and where-clauses regarding scoping and the restriction of where to a top-level definition. However, frequently I write code in which either one would be allowed, and I was

Re: [Haskell-cafe] let vs. where

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, John Lato wrote: I'd like to thank Henning for pointing out the wiki page, which describes one consequence I hadn't considered. I knew I couldn't have been the first person to have this question, but I somehow missed it before. I agree with Neil, though, that it

Re: [Haskell-cafe] Renaming constructors for readability

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, Dougal Stanton wrote: -- int a = 3; -- int *pa = a; ampersand :: t - Pointer t ampersand a = Just a What's bad about using 'ampersand' function as replacement for the constructor 'Just'? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Renaming constructors for readability

2007-11-13 Thread Henning Thielemann
On Tue, 13 Nov 2007, Dougal Stanton wrote: On 13/11/2007, Henning Thielemann [EMAIL PROTECTED] wrote: On Tue, 13 Nov 2007, Dougal Stanton wrote: -- int a = 3; -- int *pa = a; ampersand :: t - Pointer t ampersand a = Just a What's bad about using 'ampersand' function

Re: [Haskell-cafe] Renaming constructors for readability

2007-11-14 Thread Henning Thielemann
On Wed, 14 Nov 2007, Jules Bean wrote: Henning Thielemann wrote: No problem, write a function like 'maybe' to inspect the data. Instead of 'f m' with f :: Maybe T - S f (Just x) = g x f Nothing = h Yes. It is a problem. Do you write all your code using higher-order functions

Re: [Haskell-cafe] List of all powers

2007-11-14 Thread Henning Thielemann
On Wed, 14 Nov 2007, Kurt Hutchinson wrote: As part of a solution I'm working on for Project Euler problem 119, I wanted to create an ordered list of all powers of all positive integers (starting with squares). This is what I came up with: powers = ( uniq . map fst . iterate next ) ( 1, (

Re: [Haskell-cafe] let vs. where

2007-11-15 Thread Henning Thielemann
On Tue, 13 Nov 2007, Dan Piponi wrote: On Nov 13, 2007 1:24 PM, Ryan Ingram [EMAIL PROTECTED] wrote: I tend to prefer where, but I think that guards function declarations are more readable than giant if-thens and case constructs. Up until yesterday I had presumed that guards only applied

Re: [Haskell-cafe] Re: Weird ghci behaviour?

2007-11-15 Thread Henning Thielemann
On Thu, 15 Nov 2007, Jules Bean wrote: Anecdotes have little value, but for what it's worth: in around 5 years of ghc use, I have never, not even once, wanted to load the module I was working on in its compiled form. I've occasionally noticed that dependent modules get loaded quickly from

Re[2]: [Haskell-cafe] let vs. where

2007-11-15 Thread Henning Thielemann
On Thu, 15 Nov 2007, Bulat Ziganshin wrote: Hello Henning, Thursday, November 15, 2007, 2:31:07 PM, you wrote: Btw. I would write here min 1 (max (-1) x) or even better define a function for such clipping, since it is needed quite often. min 1 . max (-1) is pretty standard,

Re: [Haskell-cafe] let vs. where

2007-11-16 Thread Henning Thielemann
On Fri, 16 Nov 2007, jeff p wrote: A function is an expression whose type is an arrow; e.g. Int - Int. The type of taxRate is (Fractional t) = t. I had this misunderstanding too, when starting with Haskell. In other languages there are functions with zero, one or more arguments. In contrast

Re: [Haskell-cafe] Haskellforge?

2007-11-16 Thread Henning Thielemann
On Thu, 15 Nov 2007, Duncan Coutts wrote: On Thu, 2007-11-15 at 15:56 -0200, Maurí­cio wrote: Hi, Is there a Haskellforge somewhere, i.e., something like a sourceforge for open source Haskell programs, with darcs, automatic cabalization etc.? Has anyone tried that already? There

Re: [Haskell-cafe] Letting the darcs test fail, if QuickCheck tests fail

2007-11-18 Thread Henning Thielemann
On Tue, 30 Oct 2007, David Roundy wrote: On Tue, Oct 30, 2007 at 05:24:21PM +0100, Henning Thielemann wrote: When following the description on http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program#Add_some_automated_testing:_QuickCheck then darcs will run the QuickCheck

Re: [Haskell-cafe] What is the role of $!?

2007-11-19 Thread Henning Thielemann
On Sun, 18 Nov 2007, Andrew Coppin wrote: Lauri Alanko wrote: Please note that if you're using GHC, bang patterns are often much more convenient than $! or seq when you want to enforce strictness: http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html Wait, so...

Re: [Haskell-cafe] expanded standard lib

2007-11-19 Thread Henning Thielemann
On Mon, 19 Nov 2007, brad clawsie wrote: i would categorize myself as a purely practical programmer. i enjoy using haskell for various practical tasks and it has served me reliably. one issue i have with the library support for practical problem domains is the half-finished state of many

Re: [Haskell-cafe] Sillyness in the standard libs.

2007-11-19 Thread Henning Thielemann
On Mon, 19 Nov 2007, Brandon S. Allbery KF8NH wrote: On Nov 19, 2007, at 16:06 , Arthur van Leeuwen wrote: here is a puzzle for you: try converting a System.Posix.Types.EpochTime into either a System.Time.CalendarTime or a Data.Time.Clock.UTCTime without going through read . show or

Re: [Haskell-cafe] Sillyness in the standard libs.

2007-11-19 Thread Henning Thielemann
On Mon, 19 Nov 2007, Andrew Coppin wrote: Arthur van Leeuwen wrote: A closely related issue: fromIntegral is in Integral which also requires quotRem. However, the two are semantically quite disjoint. I can *easily* see the semantics of fromIntegral on EpochTime, but not the

Re: [Haskell-cafe] expanded standard lib

2007-11-19 Thread Henning Thielemann
On Mon, 19 Nov 2007, Brandon S. Allbery KF8NH wrote: On Nov 19, 2007, at 15:47 , Radosław Grzanka wrote: If you look at the stability tag of ghc libraries you will see that a lot of them are marked as provisional (Network.URI for example) or experimental (Control.Monad.Trans). This may

Re: [Haskell-cafe] expanded standard lib

2007-11-19 Thread Henning Thielemann
On Mon, 19 Nov 2007, Mads [ISO-8859-1] Lindstrøm wrote: It occurred to me that the voting could be implicit. That is, if 10 libraries/programs use library X, then library X gets 10 votes. Kind of like Google PageRank for libraries. It would be good if users could comment verbally. They could

Re: [Haskell-cafe] Problems with do notation

2007-11-22 Thread Henning Thielemann
On Thu, 22 Nov 2007, Peter Verswyvelen wrote: worksFine = if True then putStrLn True else putStrLn False worksNOT = do if True then putStrLn True else putStrLn False worksAgain = do if True then putStrLn True else putStrLn False Of course the worksFine

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

2007-11-26 Thread Henning Thielemann
On Thu, 4 Oct 2007, Don Stewart wrote: The Haskell website has the rather strange motivational text: Haskell is a general purpose, purely functional programming language featuring static typing, higher order functions, polymorphism, type classes, and monadic effects. Haskell

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

2007-11-26 Thread Henning Thielemann
On Mon, 26 Nov 2007, Thomas Davie wrote: On 26 Nov 2007, at 15:15, Henning Thielemann wrote: On Thu, 4 Oct 2007, Don Stewart wrote: The Haskell website has the rather strange motivational text: Haskell is a general purpose, purely functional programming language featuring

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

2007-11-26 Thread Henning Thielemann
On Mon, 26 Nov 2007, Andrew Coppin wrote: apfelmus wrote: But we'd probably need the glossary articles first before linking to them :) +12 I added added alpha, beta and eta conversion a while back. (And then some kind soul corrected it because half of what I wrote was actually

[Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Henning Thielemann
I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused with subsequent actions, and thus it is not necessary within a sequence of

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Thomas Davie wrote: On 27 Nov 2007, at 14:44, David Menendez wrote: On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007 [EMAIL PROTECTED] wrote: Hello, I'm trying to program an implementation of the St. Petersburg game in Haskell. There is a coin toss implied, and the random-number generation is driving me quite mad. So far, I've tried this: import Random increment :: Int - Int

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Josh Lee wrote: On Tue, 27 Nov 2007 14:41:59 -0500 Isaac Dupree [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Andrew Coppin wrote: So, now I have a Haskell version that's only several hundred times slower. Neither program is especially optimised, yet the C version is drastically faster. This makes me sad. :-( I think the C version is so much faster because it does not need

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Bit Connor wrote: Actually, IEEE numbers are designed in such a way, that if you interpret their bits as integer number, then 'succ' leads you to the next larger representable number. Thus you only have to cast from Float or Double to Int32 or Int64 respectively,

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Yitzchak Gale wrote: Bit Connor wrote: Also, a related question: How do you convert from Float - Double, and the reverse? Only thing I could find is (fromRational . toRational) which I also imagine to be slow, and I also wonder about accuracy. realToFrac added to

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

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, apfelmus wrote: More specifically, fact means something that you can easily check yourself. Robust/maintainable/testable code are things you _can't_ easily check yourself without already learning the language. +1 But shorter code is a fact you can easily check, for

Re: [Haskell-cafe] Downside of -fglasgow-extensions

2007-11-28 Thread Henning Thielemann
On Wed, 28 Nov 2007, manu wrote: Hello, I'm trying to build diverse packages from Hackage with ghc 6.8.1, they usually fail to build because of missing language extensions. Sometimes I am unable to determine the proper name of the extension missing in .cabal I tend to slap {- #OPTIONS

Re: [Haskell-cafe] Collections library

2007-11-28 Thread Henning Thielemann
On Wed, 28 Nov 2007, Robert Dockins wrote: FWIW, I find the same phenomenon with Edison. I get very little feedback about it positive or negative; I really have no idea how many people are using it. I guess people are more willing to roll their own data structures or use the standard libs.

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

2007-11-28 Thread Henning Thielemann
On Thu, 29 Nov 2007, Ben Franksen wrote: Thomas Schilling wrote: I put up a draft page. Feel free to adjust it. http://haskell.org/haskellwiki/FrontpageDraft I like the current version better. It is /very/ difficult to pack in such a short paragraph a list of the most important

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-29 Thread Henning Thielemann
On Wed, 28 Nov 2007, Chris Smith wrote: data AD a = AD a a deriving Eq instance Show a = Show (AD a) where show (AD x e) = show x ++ + ++ show e ++ eps instance Num a = Num (AD a) where (AD x e) + (AD y f) = AD (x + y) (e + f) (AD x e) - (AD y f)

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-29 Thread Henning Thielemann
On Thu, 29 Nov 2007, Henning Thielemann wrote: On Wed, 28 Nov 2007, Chris Smith wrote: diffNum:: Num b= (forall a. Num a= a - a) - b - b diffFractional :: Fractional b = (forall a. Fractional a = a - a) - b - b diffFloating :: Floating b = (forall

[Haskell-cafe] fast Array operations: foldl, drop

2007-11-29 Thread Henning Thielemann
I thought operations like foldl' and drop must be very fast on arrays (especially UArray) with appropriate pointer tricks, I mean pointer incrementing instead of indexing for foldl' and a pointer into the array for drop. Is it planned to add such functions? Ok, if foldl f x . elems and listArray

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

2007-11-29 Thread Henning Thielemann
On Thu, 29 Nov 2007, Simon Marlow wrote: What I'd *really* like to see is a bunch of links on the front page leading to pages that describe the main differences between Haskell and some other language (C, Python, Java, C#, F#, ...). The easiest way to grasp what Haskell is all about is by

Re: [Haskell-cafe] fast Array operations: foldl, drop

2007-11-29 Thread Henning Thielemann
On Thu, 29 Nov 2007, Bryan O'Sullivan wrote: Henning Thielemann wrote: I thought operations like foldl' and drop must be very fast on arrays (especially UArray) with appropriate pointer tricks, These kinds of functions are only much use on one-dimensional arrays, which look sufficiently

Re: [Haskell-cafe] A tale of Project Euler

2007-11-30 Thread Henning Thielemann
On Fri, 30 Nov 2007, Daniel Fischer wrote: Am Freitag, 30. November 2007 14:39 schrieb Henning Thielemann: Is this thread still about the prime sieve? As I mentioned, I think one can avoid the mutable array, because if there is only a small number of array updates with much changes per

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

2007-11-30 Thread Henning Thielemann
On Fri, 30 Nov 2007, Johan Tibell wrote: On Nov 30, 2007 1:30 AM, Ivan Miljenovic [EMAIL PROTECTED] wrote: Speaking of Stackless Python, its homepage (http://www.stackless.com/) has a rather nice layout... maybe slightly less emphasis on the About section, but there you've got the links,

Re: [Haskell-cafe] Progress indications

2007-11-30 Thread Henning Thielemann
On Thu, 29 Nov 2007, Thomas Hartman wrote: but there's no risk using trace is there? 'trace' is really only for debugging. It should not appear in shipped libraries or programs. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Functional dependencies / monotonic boolean functions in Haskell

2007-11-30 Thread Henning Thielemann
I know there are Haskell people who are busy with hardware verification and relational algebra. (as indicated by http://www.haskell.org/haskellwiki/Relational_algebra http://www.haskell.org/haskellwiki/Applications_and_libraries/Hardware_verification ) Is there a Haskell library

Re[2]: [Haskell-cafe] A tale of Project Euler

2007-11-30 Thread Henning Thielemann
On Fri, 30 Nov 2007, Bulat Ziganshin wrote: Hello Andrew, Thursday, November 29, 2007, 9:43:48 PM, you wrote: Fifth thing: better use an STUArray, don't drag IO in if it's not necessary. I don't understand the ST monad. it's just a subset of IO monad, with renamed operations

Re: [Haskell-cafe] fast Array operations: foldl, drop

2007-11-30 Thread Henning Thielemann
On Fri, 30 Nov 2007, Ketil Malde wrote: Bryan O'Sullivan [EMAIL PROTECTED] writes: For higher dimensions, there are enough options in terms of traversal direction and what exactly e.g. a fold should fold over (single elements? lower-dimensional slices?) that a sensible API doesn't

Re: [Haskell-cafe] Design of a Physics Interface

2007-11-30 Thread Henning Thielemann
On Fri, 30 Nov 2007, Luke Palmer wrote: But I can't figure out a good way to represent bodies in this world. I considered: newBody :: (Position,Velocity) - World - (Body,World) Where Body is an ADT with an internal representation of an Integer or something. The problem with this is that

Re: [Haskell-cafe] Advice for clean code.

2007-12-04 Thread Henning Thielemann
On Tue, 4 Dec 2007, Dougal Stanton wrote: On 04/12/2007, Felipe Lessa [EMAIL PROTECTED] wrote: I always thought show was meant for returning a String that could be used to recreate the original data if you copy-pasted it in your code or if you used read (i.e. read . show == id). Reading

Re: check if program uses haskell 98 only? Re: [Haskell-cafe] regex package for yhc?

2007-12-06 Thread Henning Thielemann
On Thu, 6 Dec 2007, Thomas Hartman wrote: On a related note... is there some easy way to be sure that a program I am compiling uses only haskell 98? (Because any pure haskell 98 should always compile on yhc... right?) You can for instance use 'haskell98' as dependent package instead of

[Haskell-cafe] group-by (Was: Nested guards?)

2007-12-07 Thread Henning Thielemann
On Fri, 7 Dec 2007, Simon Peyton-Jones wrote: | And I think that the solution is not to make the language larger and larger | everytime someone wants a feature but to give people the tools to provide | features without language changes. Of course that would be even better! (Provided of

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-07 Thread Henning Thielemann
On Fri, 7 Dec 2007, Andrew Coppin wrote: Ian Lynagh wrote: On Tue, Dec 04, 2007 at 03:07:01PM -0800, Ryan Ingram wrote: Is there a reason why strictness is defined as f _|_ = _|_ instead of, for example, forall x :: Exception. f (throw x) = throw x Errors and exceptions are

Re: [Haskell-cafe] Literate HTML

2007-12-07 Thread Henning Thielemann
On Fri, 7 Dec 2007, Neil Mitchell wrote: Hi I want literate Haskell, but where the literate bit forming a document is actually HTML, not latex. Does anyone have any idea how to go about this? The numeric-quest library was the first and only one that I have seen in this style. I could only

Re: [Haskell-cafe] Point and link

2007-12-08 Thread Henning Thielemann
On Sat, 8 Dec 2007, Bit Connor wrote: On Dec 8, 2007 8:19 PM, Andrew Coppin [EMAIL PROTECTED] wrote: Andrew Coppin wrote: Well, for starters, take a look at KLogic. http://alts.homelinux.net/shots/195-0.jpg This is the kind of thing I'd like to end up with. Such a GUI would also

Re: [Haskell-cafe] IO is a bad example for Monads

2007-12-10 Thread Henning Thielemann
On Mon, 10 Dec 2007, Dan Piponi wrote: When someone comes to me and says I have this Python script that scans through these directories and finds the files that meet these criteria and generates a report based on this template, could I do it better in Haskell? it'd be good to have a better

Re: [Haskell-cafe] Re: group-by (Was: Nested guards?)

2007-12-10 Thread Henning Thielemann
On Tue, 11 Dec 2007, Anthony Clayden wrote: I agree with Henning that HAVING is a 'terrible hack', but then SQL altogether is a terrible hack. Somehow, yes. As that paper points out, HAVING is unnecessary - it's just a filter on the result set of group-by. Yep. It's crucial that in

Re: [Haskell-cafe] IO is a bad example for Monads

2007-12-10 Thread Henning Thielemann
On Mon, 10 Dec 2007, Paul Moore wrote: On 10/12/2007, Henning Thielemann [EMAIL PROTECTED] wrote: I raise my question once again: Must Haskell's tutorials be tailored to impatient programmers? Does Haskell need quickdirty hackers? Haskell is the most practical functional language I have

Re: [Haskell-cafe] Re: IO is a bad example for Monads

2007-12-11 Thread Henning Thielemann
On Tue, 11 Dec 2007, ChrisK wrote: I look at it this way: Every person who adds Haskell, however shallowly, to their repertoire acts as an example that may spur others to learn Haskell, perhaps deeply. And that is a win not because of language chauvinism, but because of concept

Re: [Haskell-cafe] library to read/write audio files

2007-12-11 Thread Henning Thielemann
On Tue, 11 Dec 2007, Jed Brown wrote: Perhaps you are looking for storablevector which is a direct generalization of bytestring from Word8 to any Storable. It is not in hackage yet, but seems stable. There isn't a `lazy' version, but that could be changed.

Re: [Haskell-cafe] library to read/write audio files

2007-12-11 Thread Henning Thielemann
On Tue, 11 Dec 2007, John Lato wrote: I've been working on a library to encode/decode audio files (wave, aiff, etc.) to and from lazy bytestrings, and it's finally in a form where I'm willing to share. It's available at http://mml.music.utexas.edu/jwlato/HSoundFile/, lightly cabalized and

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

2007-12-11 Thread Henning Thielemann
On Tue, 11 Dec 2007 [EMAIL PROTECTED] wrote: The Haskell one is dominated by the technical terms, while the Python one is by more generic features. Let's break them down: Plese, not again. Did you follow the earlier phases of that thread? ___

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, Mattias Bengtsson wrote: I found myself writing this for an Euler-problem: digits :: Int - [Int] digits i | i 10= [i] | otherwise = i `mod` 10 : digits ( i `div` 10 ) And i realised it was quite some time ago (before this function) i had actually

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

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, Emre Sahin wrote: How do you think the description could be improved? Why don't you let Haskell speak for itself? Instead of putting such buzzwords nobody really understands (and cares), put random problem descriptions and one-line solutions in Haskell. Well

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, Reinier Lamers wrote: Back in my Introduction to Functional Programming course, Daan Leijen demonstrated how to print integers in Haskell using function composition. Something along the lines of: printint :: Int - [Char] printint = map chr . map (+0x30) . reverse . map

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

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, apfelmus wrote: gwern wrote: Now, the Main Page on haskell.org is not protected, so I could just edit in one of the better descriptions proposed, but as in my Wikipedia editing, I like to have consensus especially for such visible changes. Hey, why has the

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

2007-12-14 Thread Henning Thielemann
On Wed, 12 Dec 2007, Bill Wood wrote: On Wed, 2007-12-12 at 11:19 +, Andrew Coppin wrote: . . . ...and normal programmers care about the Fibonacci numbers because...? Seriously, there are many, many programmers who don't even know what Fibonacci numbers *are*. And even I can't

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

2007-12-14 Thread Henning Thielemann
On Fri, 14 Dec 2007, Henning Thielemann wrote: Worst case analysis of AVL trees also leads to Fibonacci numbers, as far as I remember. The number of possibilities to arrange bricks of a certain width is also Fibonacci number. In general I think that Fibonacci numbers serve as simple non

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-14 Thread Henning Thielemann
On Wed, 12 Dec 2007, Don Stewart wrote: ndmitchell: A much simpler version: main = print . length . words = getContents Beautiful, specification orientated, composed of abstract components. My thoughts too when reading the initial post was that it was all very low level

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Henning Thielemann
On Mon, 17 Dec 2007, Nicholls, Mark wrote: After many years of OOP though my brain is wired up to construct software in that 'pattern'a problem for me at the moment is I cannot see how to construct programs in an OO style in HaskellI know this is probably not the way to approach

Re: [Haskell-cafe] New to Haskell: The End

2007-12-18 Thread Henning Thielemann
On Tue, 18 Dec 2007, Cristian Baboi wrote: Haskell strengts as I see them: - it is lazy with class - it is strongly typed - it has automatic memory management - it has a standard library - it has a compiler - it is available on several platforms - it has a community - it is free Is

Re: [Haskell-cafe] New to Haskell

2007-12-18 Thread Henning Thielemann
On Tue, 18 Dec 2007, Benja Fallenstein wrote: Hi Cristian, On Dec 18, 2007 10:53 AM, Cristian Baboi [EMAIL PROTECTED] wrote: - the lambda expressions can be written (input) but cannot be printed (output) Yes, since two different lambda expressions can denote the same function. I

Re: [Haskell-cafe] New to Haskell

2007-12-18 Thread Henning Thielemann
On Tue, 18 Dec 2007, Benja Fallenstein wrote: Hi Henning, On Dec 18, 2007 3:53 PM, Henning Thielemann [EMAIL PROTECTED] wrote: Since this was discussed already here, I summed it up in: http://www.haskell.org/haskellwiki/Show_instance_for_functions I find the discussion under

Re: [Haskell-cafe] New to Haskell

2007-12-18 Thread Henning Thielemann
On Tue, 18 Dec 2007, Benja Fallenstein wrote: Hi Henning, On Dec 18, 2007 5:17 PM, Henning Thielemann [EMAIL PROTECTED] wrote: The mathematical definition of function I know of, says that functions are special relations, and relations are sets of pairs. Their is nothing about intension

Re: [Haskell-cafe] Storable types

2007-12-20 Thread Henning Thielemann
On Thu, 20 Dec 2007, Alex Sandro Queiroz e Silva wrote: Hallo fellow Brazilian, Clerton Filho escreveu: Hi, I'm newbie in Haskell, and I have some doubts... In this programming language, do we have storable values? Case affirmative, what are the storable types in Haskell, and how

Re: [Haskell-cafe] Printing and Referential transparency excuse

2007-12-25 Thread Henning Thielemann
On Mon, 24 Dec 2007, Cristian Baboi wrote: While reading the Haskell language report I noticed that function type is not an instance of class Read. I was told that one cannot define them as an instance of class Show without breaking referential transparency or printing a constant. f ::

[Haskell-cafe] ambiguous types although 'asTypeOf'

2007-12-25 Thread Henning Thielemann
I thought I understand monomorphism restriction. But it seems, I don't. I have boilt down my problem to the following test. Don't try to make any sense of it, it is just the smallest code I could come up with. test :: (Integral a, RealFrac a) = a test = let c = undefined in asTypeOf

Re: [Haskell-cafe] ambiguous types although 'asTypeOf'

2007-12-27 Thread Henning Thielemann
On Tue, 25 Dec 2007, Felipe Lessa wrote: On Dec 25, 2007 4:27 PM, Henning Thielemann [EMAIL PROTECTED] wrote: test :: (Integral a, RealFrac a) = a test = let c = undefined in asTypeOf (round c) c When compiling I get: Compiling StorableInstance ( src

Re: [Haskell-cafe] Getting links to Haddock documentation in Hackage

2007-12-30 Thread Henning Thielemann
On Sat, 29 Dec 2007, Adam Langley wrote: Some packages[1] have links on their Hackage pages to the haddock generated documentation for each exported module[2]. However, many[3] don't. What's the secret to getting this generated documentation to work with Hackage? Even packages for which

[Haskell-cafe] Web server (Was: Basic question concerning data constructors)

2007-12-30 Thread Henning Thielemann
On Sun, 30 Dec 2007, Joost Behrends wrote: A similar point: The tutorials teach, that = has a similar meaning than = in mathematics. But there is a big difference: it is not reflexive. The the right side is the definition of the left. Thus x=y has still some kind of temporality, which

[Haskell-cafe] Re: check if program uses haskell 98 only?

2008-01-03 Thread Henning Thielemann
On Thu, 6 Dec 2007, Henning Thielemann wrote: On Thu, 6 Dec 2007, Thomas Hartman wrote: On a related note... is there some easy way to be sure that a program I am compiling uses only haskell 98? (Because any pure haskell 98 should always compile on yhc... right?) You can for instance

Re: [Haskell-cafe] Re: Difference lists and ShowS

2008-01-03 Thread Henning Thielemann
On Thu, 3 Jan 2008, Achim Schneider wrote: Henning Thielemann [EMAIL PROTECTED] wrote: Sometimes I believed that I understand this reason, but then again I do not understand. I see that left-associative (++) like in ((a0 ++ a1) ++ a2) ++ a3 would cause quadratic time

Re: [Haskell-cafe] Difference lists and ShowS (Was: The Worker/Wrapper Transformation)

2008-01-03 Thread Henning Thielemann
On Thu, 3 Jan 2008, Daniel Fischer wrote: Am Donnerstag, 3. Januar 2008 14:48 schrieb Henning Thielemann: Sometimes I believed that I understand this reason, but then again I do not understand. I see that left-associative (++) like in ((a0 ++ a1) ++ a2) ++ a3 would cause quadratic

RE: [Haskell-cafe] Refactoring status

2008-01-04 Thread Henning Thielemann
On Thu, 3 Jan 2008, Peter Verswyvelen wrote: I believe type signatures are the very essence of Haskell documentation! I'd much rather see a program with type signatures for functions and little (or no) comments over programs with no type signatures and ambigious comments (if any comments

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