Re: [Haskell-cafe] Re: Haskell tutorial for pseudo users?

2009-02-05 Thread Jonathan Cast
On Fri, 2009-02-06 at 08:30 +0100, Achim Schneider wrote: > Jonathan Cast wrote: > > On Mon, 2009-02-02 at 20:55 +, Andrew Coppin wrote: > > > Deniz Dogan wrote: > > > > Learn You a Haskell for Great Good (http://learnyouahaskell.com/) > > > > > > Mmm, interesting. > > > > > > Does anybody e

[Haskell-cafe] Re: Haskell tutorial for pseudo users?

2009-02-05 Thread Achim Schneider
Jonathan Cast wrote: > On Mon, 2009-02-02 at 20:55 +, Andrew Coppin wrote: > > Deniz Dogan wrote: > > > Learn You a Haskell for Great Good (http://learnyouahaskell.com/) > > > > Mmm, interesting. > > > > Does anybody else think it would be neat if GHCi really did > > colourise your input li

[Haskell-cafe] Re: Just how unsafe is unsafe

2009-02-05 Thread Achim Schneider
Peter Verswyvelen wrote: > I do have asked myself the question whether a "really random > generating" function could be regarded as "pure" somehow (actually > would a true random function still be a mathematical function?) > Wasn't there some agreement some time ago on this list that the universe

[Haskell-cafe] Re: [Haskell-beginners] Just how unsafe is unsafe

2009-02-05 Thread Thomas Davie
On 5 Feb 2009, at 22:11, Andrew Wagner wrote: So we all know the age-old rule of thumb, that unsafeXXX is simply evil and anybody that uses it should be shot (except when it's ok). I understand that unsafeXXX allows impurity, which defiles our ability to reason logically about haskell prog

Re: [Haskell-cafe] morphisms in IO

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:32 PM, Dan Weston wrote: > I truly have no idea what you are saying (and probably not even what I am > saying), but I suspect: > > a) You are calling IO the target category of applying the functor IO [taking > a to IO a and (a->b) to (IO a -> IO b)] to Hask. > > b) This c

Re: [Haskell-cafe] morphisms in IO

2009-02-05 Thread Miguel Mitrofanov
On 6 Feb 2009, at 05:52, Gregg Reynolds wrote: I'm working on a radically different way of looking at IO. Before I post it and make a fool of myself, I'd appreciate a reality check on the following points: a) Can IO be thought of as a category? I think the answer is yes. What couldn't? Ev

Re: [Haskell-cafe] Automation and COM

2009-02-05 Thread Michael Snoyman
On Wed, Feb 4, 2009 at 3:55 AM, Günther Schmidt wrote: > Hi, > > has anyone yet been using Sigbjorns COM package? > > Sigbjorn hasn't had the time yet to gather some docs on how to use it, so I > wonder if someone else could post some examples on how to use it. I'm asking > because I need to do s

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Michael Snoyman
On Thu, Feb 5, 2009 at 4:58 PM, Don Stewart wrote: > > A comparative analysis of the 10+ Haskell web frameworks would be > awesome. > > happstack, wash, fastcgi.., turbinado, perpubplat, riviera, salvia, > kibro, ella, what was that one launched yesterday? *ah, yesod... > Wow, that's a lot more

Re: [Haskell-cafe] morphisms in IO

2009-02-05 Thread Dan Weston
I truly have no idea what you are saying (and probably not even what I am saying), but I suspect: a) You are calling IO the target category of applying the functor IO [taking a to IO a and (a->b) to (IO a -> IO b)] to Hask. b) This category is hardly bereft, nor discrete. Its morphisms are IO

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread wren ng thornton
Gregg Reynolds wrote: On Thu, Feb 5, 2009 at 7:19 PM, wren ng thornton wrote: Gregg Reynolds wrote: as the formal semantics of the language are concerned, there's no essential difference between "getChar >>= \x -> getChar" and " Foo 3 = \x -> Foo 7 " for some data constructor Foo. I shoul

[Haskell-cafe] morphisms in IO

2009-02-05 Thread Gregg Reynolds
I'm working on a radically different way of looking at IO. Before I post it and make a fool of myself, I'd appreciate a reality check on the following points: a) Can IO be thought of as a category? I think the answer is yes. b) If it is a category, what are its morphisms? I think the answer

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 7:19 PM, wren ng thornton wrote: > Gregg Reynolds wrote: >> as the formal semantics of the language are concerned, there's no >> essential difference between "getChar >>= \x -> getChar" and " Foo 3 = \x -> Foo 7 " for some data constructor Foo. I should think th

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Creighton Hogg
On Thu, Feb 5, 2009 at 6:58 PM, Don Stewart wrote: > andrewcoppin: >> Jochem Berndsen wrote: >>> The HAppS project has been abandoned, see >>> http://groups.google.com/group/HAppS/msg/d128331e213c1031 . >>> >>> The Happstack project is intended to continue development. For more >>> details, see ht

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread wren ng thornton
Roman Cheplyaka wrote: * Peter Verswyvelen [2009-02-05 16:35:34+0100] On Thu, Feb 5, 2009 at 4:32 PM, Ketil Malde wrote: Peter Verswyvelen writes: 1) hg st darcs cha -s That seems to list all changes in the history. hg st lists local changes only. Can be done using darcs? darcs wha

[Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread mail
Jake McArthur writes: > | Just because the compiler is allowed (and even encouraged) to change the > | sequence where that won't change the results, considering this a > | sequence is still valid and meaningful. > > It can be helpful sometimes, but I don't think it should be the standard > way to

Re: [Haskell-cafe] Purely funcional LU decomposition

2009-02-05 Thread wren ng thornton
Rafael Gustavo da Cunha Pereira Pinto wrote: What I miss most is a data structure with O(1) (amortized) direct access. Finger trees get close, O(log(min(i,n-i))): http://hackage.haskell.org/packages/archive/containers/latest/doc/html/Data-Sequence.html (And Theta(1) amortized for all dequeue

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread ChrisK
Jonathan Cast wrote: On Fri, 2009-02-06 at 00:51 +0100, Peter Verswyvelen wrote: On Thu, Feb 5, 2009 at 8:20 PM, ChrisK wrote: Since this is strict there is no laziness and the code must evaluate the input and output "State RealWorld" to ensure they are not bottom or err

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread wren ng thornton
Gregg Reynolds wrote: Right, but that's only because the compiler either somehow knows about side effects or there is some other mechanism - e.g. an implicit World token that gets passed around - that prevents optiimization. As far as the formal semantics of the language are concerned, there's n

Re: [Haskell-cafe] Haskell tutorial for pseudo users?

2009-02-05 Thread Jonathan Cast
On Mon, 2009-02-02 at 20:55 +, Andrew Coppin wrote: > Deniz Dogan wrote: > > Learn You a Haskell for Great Good (http://learnyouahaskell.com/) > > Mmm, interesting. > > Does anybody else think it would be neat if GHCi really did colourise > your input like that? Bleah. More terminal hackin

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Don Stewart
andrewcoppin: > Jochem Berndsen wrote: >> The HAppS project has been abandoned, see >> http://groups.google.com/group/HAppS/msg/d128331e213c1031 . >> >> The Happstack project is intended to continue development. For more >> details, see http://happstack.com/faq.html . >> >> > So we've got HAppS,

Re: [Haskell-cafe] Haskell tutorial for pseudo users?

2009-02-05 Thread Don Stewart
andrewcoppin: > Deniz Dogan wrote: >> Learn You a Haskell for Great Good (http://learnyouahaskell.com/) > > Mmm, interesting. > > Does anybody else think it would be neat if GHCi really did colourise > your input like that? (Or at least display the prompt in a different > colour to user input a

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Andrew Coppin
Jochem Berndsen wrote: The HAppS project has been abandoned, see http://groups.google.com/group/HAppS/msg/d128331e213c1031 . The Happstack project is intended to continue development. For more details, see http://happstack.com/faq.html . So we've got HAppS, Happstack, WASH, Turbinado, probab

[Haskell-cafe] (Off-topic) CUDA

2009-02-05 Thread Andrew Coppin
And so, inspired by the marketing litrature, I just spent £££ on a very expensive new GPU that supports CUDA. The only problem is... I can't seem to get any software to use it. Does anybody know how to make this stuff actually work? (Also... Haskell on the GPU. It's been talked about for years

Re: [Haskell-cafe] Re: 1,000 packages, so let's build a few!

2009-02-05 Thread Andrew Coppin
Don Stewart wrote: The platform is a set of blessed libraries and tools. The distros will still need to package that. To do that for Windows, we're still going to need a windows packaging team, along side Debian, Arch, Gentoo, Mac etc. Right, so, let me make sure I understand this... 1. We

Re: [Haskell-cafe] Haskell tutorial for pseudo users?

2009-02-05 Thread Andrew Coppin
Deniz Dogan wrote: Learn You a Haskell for Great Good (http://learnyouahaskell.com/) Mmm, interesting. Does anybody else think it would be neat if GHCi really did colourise your input like that? (Or at least display the prompt in a different colour to user input and program output?) __

Re: [Haskell-cafe] Re: Haddock

2009-02-05 Thread Max Rabkin
On Thu, Feb 5, 2009 at 4:25 PM, David Waern wrote: > As for running arbitrary commands, I think we are opening up to a lot > of unfamiliar syntax. I'd like to hear what everyone thinks about > that. I personally find it useful to have Haddock comments readable in the source. And aren't there sec

[Haskell-cafe] Haddock Markup

2009-02-05 Thread David Waern
I got the subject line wrong, so I'm reposting this: Hi everyone, I received this question from Lennart Augustsson (via Simon M) and thought I'd send out an inquiry to the Haskell community in general (Lennart, I hope you don't mind): Lennart writes: > We have some local patches for haddock

[Haskell-cafe] Re: Monad explanation

2009-02-05 Thread ChrisK
All Haskell programs start as main :: IO () though... so they all get evaluated in the context of another IO () don't they? True for most cases now, but historically false. Haskell existed and people wrote programs for years before the Monad class and IO were created. A Haskell98 prog

[Haskell-cafe] Re: Haddock

2009-02-05 Thread David Waern
Hi everyone, I received this question from Lennart Augustsson (via Simon M) and thought I'd send out an inquiry to the Haskell community in general (Lennart, I hope you don't mind): Lennart writes: > We have some local patches for haddock that extends the <> > syntax so you can put TeX formulae i

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jonathan Cast
On Fri, 2009-02-06 at 00:51 +0100, Peter Verswyvelen wrote: > On Thu, Feb 5, 2009 at 8:20 PM, ChrisK > wrote: > Since this is strict there is no laziness and the code must > evaluate the input and output "State RealWorld" to ensure they > are not bottom or error. > Interes

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 15:52 -0800, David Leimbach wrote: > > > On Thu, Feb 5, 2009 at 2:38 PM, Jonathan Cast > wrote: > > On Thu, 2009-02-05 at 13:01 -0800, David Leimbach wrote: > > > > > > On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast > > wrot

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 2:38 PM, Jonathan Cast wrote: > On Thu, 2009-02-05 at 13:01 -0800, David Leimbach wrote: > > > > > > On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast > > wrote: > > > > On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: > > > > > > > > >

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Peter Verswyvelen
On Thu, Feb 5, 2009 at 8:20 PM, ChrisK wrote: > Since this is strict there is no laziness and the code must evaluate the > input and output "State RealWorld" to ensure they are not bottom or error. > Interesting. I also thought it was the passing of the RealWorld that caused the sequencing, I nev

Re: [Haskell-cafe] Signatures in defining functions

2009-02-05 Thread Peter Verswyvelen
Maybe you mean that f :: Int -> Int -> Int does not say much about what the function does since the Int arguments have no "name" in Haskell? E.g. the following might "mean" more, but is not valid Haskell: f :: numerator:Int -> denominator:Int -> quotient:Int In Haskell you regularly see docume

Re: [Haskell-cafe] Signatures in defining functions

2009-02-05 Thread Miguel Mitrofanov
It means Int -> (Int -> Int). -> is right associative. On 6 Feb 2009, at 01:28, TKM wrote: Hello, I'm kind of new with Haskell and I would like to know about the following: [some function]:: Int -> Int -> Int Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what d

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Lennart Augustsson
Perhaps you meant the type correct expression return 7 >>= \ x -> return 42 which the compiler will probably optimize to return 42, because by seeing the definition of return the compiler can see that it has no effects in the monad. This expression is very different from getChar >>= \ x -> ret

Re: [Haskell-cafe] Signatures in defining functions

2009-02-05 Thread Martijn van Steenbergen
Hi JTKM, TKM wrote: Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what does "Int -> Int -> Int" mean? There are many good tutorials and books online. Here's a link that directly answers your question: http://book.realworldhaskell.org/read/types-and-functions.html#i

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Peter Verswyvelen
Well, one could say that a truly random number function takes as input time and some constant unique identifier (serial number) of the TRND device and gives you the random value measured at that time by this device. Of course this would mean the random value is not really random, since "the potenti

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 13:01 -0800, David Leimbach wrote: > > > On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast > wrote: > > On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: > > > > > > On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner > > wro

[Haskell-cafe] Error in building profiling

2009-02-05 Thread Marco Túlio Gontijo e Silva
Hello, I'm trying to package ghc-paths for debian, and I got to this: $ ./setup configure --enable-library-profiling --disable-library-vanilla Configuring ghc-paths-0.1.0.5... $ ./setup build Preprocessing library ghc-paths-0.1.0.5... Building ghc-paths-0.1.0.5... /usr/bin/ar: creating dist/build

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter Verswyvelen wrote: | I do have asked myself the question whether a "really random generating" | function could be regarded as "pure" somehow (actually would a true | random function still be a mathematical function?) | | E.g. the function would

[Haskell-cafe] Signatures in defining functions

2009-02-05 Thread TKM
Hello, I'm kind of new with Haskell and I would like to know about the following: [some function]:: Int -> Int -> Int Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what does "Int -> Int -> Int" mean? Thank you for answering my question. Kind Regards, JTKM

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Henning Thielemann
Peter Verswyvelen schrieb: > 3) hg addrem > this adds new files and removes deleted files from local repos. > forgetting to add files is a common problem, and is really tricky since > no record is made of these files, so if after a couple of versions if a > developer finds out a file was missing,

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Max Rabkin
2009/2/5 Peter Verswyvelen : > Of course you could just put this random generator in the IO monad, but > certain algorithms- like Monte Carlo - intuitively don't seem to operate in > a IO monad to me. For PRNGs, only State is needed, not IO. But you might find the `randoms' function useful: it re

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Peter Verswyvelen
I do have asked myself the question whether a "really random generating" function could be regarded as "pure" somehow (actually would a true random function still be a mathematical function?) E.g. the function would return a true (not pseudo) random number, practically unpredictable (e.g. hardware

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Henning Thielemann
Yitzchak Gale schrieb: > Manlio Perillo wrote: >> However there is still a *big* problem: it is inefficient. >> >> Here is a Python version of the Chudnovsky algorithm [1] for computing Pi: >> http://paste.pocoo.org/show/102800/ >> On my system it takes 10 seconds. >> Here is an Haskell version: >>

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew Wagner wrote: | I understand that unsafeXXX allows impurity, which defiles our ability | to reason logically about haskell programs like we would like to. My | question is, to what extent is this true? My opinion is that unsafeXXX is acceptabl

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 16:11 -0500, Andrew Wagner wrote: > So we all know the age-old rule of thumb, that unsafeXXX is simply > evil and anybody that uses it should be shot (except when it's ok). > I understand that unsafeXXX allows impurity, which defiles our ability > to reason logically about h

[Haskell-cafe] Re: OpenAL

2009-02-05 Thread Paul Langevin
>Does the example code at >http://articles.bluishcoder.co.nz/Haskell/OpenAL work for anyone? sorry for the delay, Brian : I can hear the two sounds one after the other (I wish I knew how to hear them at the same time). However, I've got a strange error message from ALSA : " alsa_blitbuffer: Co

[Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Andrew Wagner
So we all know the age-old rule of thumb, that unsafeXXX is simply evil and anybody that uses it should be shot (except when it's ok). I understand that unsafeXXX allows impurity, which defiles our ability to reason logically about haskell programs like we would like to. My question is, to what ext

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast wrote: > On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: > > > > > > On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner > > wrote: > > I think the point of the Monad is that it > > works as a conta

Re: [Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread Andrew Wagner
bind is no more a sequencing operator than function composition is. Just as the order in which you pass two functions (ignoring the type issue for the moment) matters, the order in which you pass things to bind matters. The sense in which the order _doesn't_ matter is that of the order in which wha

Re: [Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | Jake McArthur writes: |> The problem with your description is that you said "and then." The |> result will be generated lazily. There is no sequencing here. Consider: |> |> ~do x <- [0..] |> ~ y <- [0..9] |> ~

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: > > > On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner > wrote: > I think the point of the Monad is that it > works as a container of stuff, that still > allows mathemat

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 12:25 PM, Andrew Wagner wrote: > On Thu, Feb 5, 2009 at 3:21 PM, David Leimbach wrote: > >> >> Well all I can tell you is that I can have (IO Int) in a function as a >> return, and the function is not idempotent in terms of the "stuff" inside IO >> being the same. >> >> Sou

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Andrew Wagner
On Thu, Feb 5, 2009 at 3:21 PM, David Leimbach wrote: > > Well all I can tell you is that I can have (IO Int) in a function as a > return, and the function is not idempotent in terms of the "stuff" inside IO > being the same. > > Sounds impure to me. > Right, thus IO is impure. but as long as th

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Tim Newsham
You are absolutely right. The statement "The values of the IO monad are programs that do IO. " is somewhat nonsensical. Values don't do anything, they just are. But values of the IO monad *describe* how to do IO; they can be seen as a recipe for doing IO. A recipe doesn't cook a dish, but when t

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner wrote: > I think the point of the Monad is that it works as a container of stuff, >>> that still allows mathematically pure things to happen, while possibly >>> having some opaque "other stuff" going on. >>> >> > This at least sounds, very wrong, eve

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 20:46 +0100, Lennart Augustsson wrote: > You are absolutely right. The statement > "The values of the IO monad are programs that do IO. " > is somewhat nonsensical. Values don't do anything, they just are. Technically, programs don't do anything either. I think of values

[Haskell-cafe] Success (was: cURL under Windows again)

2009-02-05 Thread Iliya Kuznetsov
The problem has solved. Solution, given by http://awson.livejournal.com/, is: 1. Copy libcurl-4.dll to libcurl.dll beause of namescheme 2. Before building haskell curl-1.3.4 _under windows_ you have to change #define CURL_EXTERN __declspec(dllimport) to #define CURL_EXTERN. After that, curl-7.19.

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 1:46 PM, Lennart Augustsson wrote: > You are absolutely right. The statement > "The values of the IO monad are programs that do IO. " > is somewhat nonsensical. Values don't do anything, they just are. Whew! So I'm not crazy. I was starting to wonder. > But values of t

[Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread mail
Jake McArthur writes: > The problem with your description is that you said "and then." The > result will be generated lazily. There is no sequencing here. Consider: > > ~do x <- [0..] > ~ y <- [0..9] > ~ return (x, y) > > Which list is generated first? > This is an implementation

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 11:22 AM, Gleb Alexeyev wrote: > Gregg Reynolds wrote: > >> Are you saying that using equations to add a level of indirection >> prevents optimization? I still don't see it - discarding x doesn't >> change the semantics, so a good compiler /should/ do this. How is >> this

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Lennart Augustsson
You are absolutely right. The statement "The values of the IO monad are programs that do IO. " is somewhat nonsensical. Values don't do anything, they just are. But values of the IO monad *describe* how to do IO; they can be seen as a recipe for doing IO. A recipe doesn't cook a dish, but when t

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Miguel Mitrofanov
Ahem... WHAT??? IO monad is impure??? What do you mean? On 5 Feb 2009, at 22:25, Andrew Wagner wrote: I think the point of the Monad is that it works as a container of stuff, that still allows mathematically pure things to happen, while possibly having some opaque "other stuff" going on.

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Miguel Mitrofanov
Let's put it this way: suppose you have two data types, say, Int and String; a value s of type String and a function f :: String -> (Int -> String) -> String This could be anything - may be, a function which looks for the first character '#' in it's first argument and replaces it with the se

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Andrew Wagner
> > I think the point of the Monad is that it works as a container of stuff, >> that still allows mathematically pure things to happen, while possibly >> having some opaque "other stuff" going on. >> > This at least sounds, very wrong, even if it's not. Monads are not impure. IO is, but it's only

Re: [Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | [1..2] >>= return . (^2) | | This says "generate the list [1..2] and then use it to generate a list | of squares". It's more than just application, it's a description of a | sequence of actions. The whole point of list

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread ChrisK
Gregg Reynolds wrote: getChar >>= \x -> getChar An optimizer can see that the result of the first getChar is discarded True, so 'x' is not used, and it can be garbage collected, and may not even be created. But that data dependency is simple not the data dependency that make IO sequent

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
2009/2/5 Gregg Reynolds > On Wed, Feb 4, 2009 at 8:18 PM, Richard O'Keefe wrote: > >> >> On 5 Feb 2009, at 10:20 am, Gregg Reynolds wrote: >> >>> That's a fairly common representation, seems to work for lots of people, >>> but it caused me no end of trouble. Values are mathematical objects; how

Re: [Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 11:47 -0700, m...@justinbogner.com wrote: > Jake McArthur writes: > > m...@justinbogner.com wrote: > > | Oops, sent this off list the first time, here it is again. > > | > > | Jake McArthur writes: > > |> m...@justinbogner.com wrote: > > |> | Bind is a sequencing operator ra

[Haskell-cafe] Re: Fastest regex package?

2009-02-05 Thread ChrisK
Eugene Kirpichov wrote: All in all, my question remains: what is the fastest way to do this kind of parsing on a lazy bytestring? Your example regular expression works the same in both Posix and Perl-ish semantics. Do you know the difference? Posix libraries look for the longest match of

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread Wolfgang Jeltsch
Am Donnerstag, 5. Februar 2009 16:16 schrieb Ross Paterson: > On Thu, Feb 05, 2009 at 03:03:35PM +0100, Wolfgang Jeltsch wrote: > > Anyway, can something be done so that not all packages depending > > (directly or indirectly) on type-level are without documentation? For > > example, type-level coul

[Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread mail
Jake McArthur writes: > m...@justinbogner.com wrote: > | Oops, sent this off list the first time, here it is again. > | > | Jake McArthur writes: > |> m...@justinbogner.com wrote: > |> | Bind is a sequencing operator rather than an application operator. > |> > |> In my opinion, this is a common m

[Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread mail
Jake McArthur writes: > m...@justinbogner.com wrote: > | Oops, sent this off list the first time, here it is again. > | > | Jake McArthur writes: > |> m...@justinbogner.com wrote: > |> | Bind is a sequencing operator rather than an application operator. > |> > |> In my opinion, this is a common m

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Achim Schneider
Gregg Reynolds wrote: > getChar >>= \x -> getChar > > An optimizer can see that the result of the first getChar is discarded > It isn't discarded. The first getChar results in a value of type IO Char, always and ever. Whether or not the Char inside the IO Char gets evaluated or not is anothe

[Haskell-cafe] RE: Define variable types

2009-02-05 Thread Tsunkiet Man
Hello, thank you guys for your responds. I got it working now =). Thanks a lot! Greetx JTKM ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | Oops, sent this off list the first time, here it is again. | | Jake McArthur writes: |> m...@justinbogner.com wrote: |> | Bind is a sequencing operator rather than an application operator. |> |> In my opinion, this is a

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gleb Alexeyev wrote: | Perhaps my example doesn't work, so I'll try another example. | As you know, (>>=) is just an (overloaded) higher-order function. | Let's consider another higher-order function, map. The expression | > map (\x -> 42) [1..3] | e

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jeremy Shaw
At Thu, 5 Feb 2009 11:06:22 -0600, Gregg Reynolds wrote: > Are you saying that using equations to add a level of indirection > prevents optimization? I still don't see it - discarding x doesn't > change the semantics, so a good compiler /should/ do this. How is > this different from optimizing o

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 11:12 AM, Andrew Wagner wrote: > > >> Are you saying that using equations to add a level of indirection >> prevents optimization? I still don't see it - discarding x doesn't >> change the semantics, so a good compiler /should/ do this. How is >> this different from optimiz

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gleb Alexeyev
Gregg Reynolds wrote: Are you saying that using equations to add a level of indirection prevents optimization? I still don't see it - discarding x doesn't change the semantics, so a good compiler /should/ do this. How is this different from optimizing out application of a constant function?

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Andrew Wagner
Are you saying that using equations to add a level of indirection > prevents optimization? I still don't see it - discarding x doesn't > change the semantics, so a good compiler /should/ do this. How is > this different from optimizing out application of a constant function? > No, no compiler sh

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:49 AM, Gleb Alexeyev wrote: > Gregg Reynolds wrote: > > I must be misunderstanding something. I don't know if it would be >> >> optimized out, but I see no reason why it couldn't be. There's no data >> dependency, right? > > Of course there is data dependency. In my ex

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread mail
Oops, sent this off list the first time, here it is again. Jake McArthur writes: > m...@justinbogner.com wrote: > | Bind is a sequencing operator rather than an application operator. > > In my opinion, this is a common misconception. I think that bind would > be nicer if its arguments were revers

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gleb Alexeyev
Gregg Reynolds wrote: > I must be misunderstanding something. I don't know if it would be optimized out, but I see no reason why it couldn't be. There's no data dependency, right? Of course there is data dependency. In my example, where IO is defined as a (generalized) algebraic datatype, t

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | Bind is a sequencing operator rather than an application operator. In my opinion, this is a common misconception. I think that bind would be nicer if its arguments were reversed. -BEGIN PGP SIGNATURE- Version: G

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:26 AM, wrote: > > x >>= f does not mean "apply f to x", it means "do x, and then do f with > the result of x". Bind is a sequencing operator rather than an > application operator. Sequencing is a side effect of data dependency. What I should have said is x >>= f means

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:00 AM, Lennart Augustsson wrote: > > There's nothing magic about IO when it comes to monad semantics. > If you take ghc's implementation of IO, it's a state monad. Doesn't that mean the semantics are defined by the implementation? My problem is that I'm not seeing how c

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread mail
Gregg Reynolds writes: > I think I've just about got monads figured out, but there's one detail that > still escapes me. As I understand it, a monad is a kind of programming trick > the uses data dependency to force evaluation order. x >>= f means apply f to > x; since the value of f x depends o

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Jeremy Shaw
Hello, The type IO (in many Haskell implemenations) is essentially: > type IO a = RealWorld -> (a, RealWorld) And >> would be implemented like: > (>>) :: IO a -> IO b -> IO b > action1 >>= action2 = \world0 -> > let (a, world1) = action1 world0 > (b, world2) = action2 world1 > in (b

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 9:53 AM, Gleb Alexeyev wrote: > Let's imagine that IO datatype is defined thus: > > >{-# LANGUAGE GADTs #-} > >{-# LANGUAGE NoImplicitPrelude #-} > > >import Prelude(Monad, Char) > >data IO a where > >GetChar :: IO Char > >Bind :: IO a -> (a -> IO b) -> IO b > > >get

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Gregg Reynolds
On Wed, Feb 4, 2009 at 8:18 PM, Richard O'Keefe wrote: > > On 5 Feb 2009, at 10:20 am, Gregg Reynolds wrote: > >> That's a fairly common representation, seems to work for lots of people, >> but it caused me no end of trouble. Values are mathematical objects; how, I >> asked myself, can they poss

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gregg Reynolds wrote: | As I understand it, a monad is a kind of programming trick the uses data dependency to force evaluation order. Actually, a monad does nothing more than supply some combinators. These combinators (and some trivial laws) are all

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Lennart Augustsson
There's nothing magic about IO when it comes to monad semantics. If you take ghc's implementation of IO, it's a state monad. The new state generated by x is passed to f, so there's no way to skip x. (Well, if the compiler can show that the state is not used anywhere then it can start removing thing

[Haskell-cafe] Re: Fastest regex package?

2009-02-05 Thread Eugene Kirpichov
I was wrong about BoyerMoore: it works about 2x faster than PCRE for this example, so seems like it does the trick (although I suspect that one could do even faster, so the question remains). 2009/2/5 Eugene Kirpichov : > Hello. > > What is the fastest regex package of the multitude of packages pr

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gleb Alexeyev
Gregg Reynolds wrote: However, consider: getChar >>= \x -> getChar An optimizer can see that the result of the first getChar is discarded and replace the entire expression with one getChar without changing the formal semantics. Let's imagine that IO datatype is defined thus: >{-# LANG

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Roman Cheplyaka
* Peter Verswyvelen [2009-02-05 16:35:34+0100] > On Thu, Feb 5, 2009 at 4:32 PM, Ketil Malde wrote: > > > Peter Verswyvelen writes: > > > > > 1) hg st > > > > darcs cha -s > > > That seems to list all changes in the history. > > hg st lists local changes only. Can be done using darcs? darc

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 9:27 AM, Bulat Ziganshin wrote: > Hello Gregg, > > Thursday, February 5, 2009, 6:20:06 PM, you wrote: > > > An optimizer can see that the result of the first getChar is > > discarded and replace the entire expression with one getChar without > > changing the formal semantics

Re: [Haskell-cafe] Re: Purely funcional LU decomposition

2009-02-05 Thread Rafael Gustavo da Cunha Pereira Pinto
On Wed, Feb 4, 2009 at 05:15, Neal Alexander wrote: > Array is no good man! Quad Tree matrices perform much nicer from what I've > seen. > > I wrote some matrix stuff based on D. Stott Parker's "Randomized Gaussian > elimination" papers > (http://www.cs.ucla.edu/~stott/ge/

  1   2   >