Re: [Haskell-cafe] Re: Planning for a website

2009-08-19 Thread Michael Snoyman
On Tue, Aug 18, 2009 at 10:22 PM, Max Desyatov explicitc...@googlemail.comwrote: Simon Michael si...@joyful.com writes: I can give a +1 vote for the Hack api and related libs. (Jinjing Wang is a one-man army.) Below hack you'll run happstack or another web-serving lib. Above hack you

Re: [Haskell-cafe] Keeping an indexed collection of values?

2009-08-19 Thread Sebastian Fischer
On Aug 18, 2009, at 9:19 PM, Job Vranish wrote: data IndexedCollection a = IndexedCollection { nextKey:: Int, availableKeys :: [Int], items:: (IntMap Int a) } deriving (Show) emptyIndexedCollection :: IndexedCollection a emptyIndexedCollection =

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-19 Thread Peter Verswyvelen
I don't really agree that in Haskell when it comes to simulation a program just is. That is the idealized story. At least when writing your own simulation engine, in practice you have to deal with operational details such as future unknown values that can block computations; to much laziness can

Re: [Haskell-cafe] Text.Html introduction

2009-08-19 Thread Malcolm Wallace
Based on the original Text.Html library by Andy Gill. See http://www.cse.ogi.edu/~andy/html/intro.htm for an introduction to that library. Try the Internet Archive: http://web.archive.org/web/*/http://www.cse.ogi.edu/~andy/html/intro.htm Regards, Malcolm

Re: [Haskell-cafe] Type family signatures

2009-08-19 Thread Thomas van Noort
Thank your for this elaborate explanation, you made my day! Thomas Ryan Ingram wrote: On Mon, Aug 17, 2009 at 12:12 AM, Thomas van Noorttho...@cs.ru.nl wrote: Somehow I didn't receive David's mail, but his explanation makes a lot of sense. I'm still wondering how this results in a type error

RE: [Haskell-cafe] Type family signatures

2009-08-19 Thread Simon Peyton-Jones
David is right that the program should be rejected. To be concrete, as he suggests, suppose type instance Fam Int = Bool type instance Fam Char = Bool Now suppose that 'unwrap' did typecheck. Then we could write: x :: Fam Int x = GADT 3 True y :: (Char, Bool) y = unwrap x Voila!

[Haskell-cafe] Re: Some trouble with AttoParsec.

2009-08-19 Thread Jason Dusek
Aha. From `Data.ByteString.Lazy` we have: null :: ByteString - Bool null Empty = True null _ = False So either users need to norm ByteStrings before testing them for emptiness or it needs to happen within the ByteString code... -- Jason Dusek

[Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread John D. Ramsdell
I've been studying equational unification. I decided to test my understanding of it by implementing unification and matching in Abelian groups. I am quite surprised by how little code it takes. Let me share it with you. John Test cases: 2x+y=3z 2x=x+y 64x-41y=a Code: -- Unification and

[Haskell-cafe] Re: Some trouble with AttoParsec.

2009-08-19 Thread Jason Dusek
2009/08/19 Jason Dusek jason.du...@gmail.com:  Aha. From `Data.ByteString.Lazy` we have:    null :: ByteString - Bool    null Empty = True    null _     = False  So either users need to norm ByteStrings before testing  them for emptiness or it needs to happen within the ByteString  

Re: [Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread Neil Mitchell
Hi, I ran your code thought HLint (http://community.haskell.org/~ndm/hlint), and it suggested a couple of things (mainly eta reduce). The most interesting suggestions are on your main function: main :: IO () main = do done - isEOF case done of True - return ()

Re[2]: [Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread Bulat Ziganshin
Hello Neil, Wednesday, August 19, 2009, 2:16:06 PM, you wrote: main = do done - isEOF unless done $ do prob - getLine test prob main main = untilM isEOF (getLine = test) -- Best regards, Bulat

Re: [Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread John D. Ramsdell
On Wed, Aug 19, 2009 at 6:16 AM, Neil Mitchellndmitch...@gmail.com wrote: Why not:  if done then return () else    do prob - getLine       test prob       main I've given up on using if-then-else in do expressions. They confuse emacs. There is a proposal for Haskell' to fix the problem,

Re: [Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread Neil Mitchell
Hi I've given up on using if-then-else in do expressions.  They confuse emacs.  There is a proposal for Haskell' to fix the problem, but until then, I will not use them in do expressions. It's a shame, there are ways of indenting them that work, but they're not as natural. It's a wart, but it

Re: [Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread John D. Ramsdell
On Wed, Aug 19, 2009 at 6:51 AM, Neil Mitchellndmitch...@gmail.com wrote: F# is new and has the offset rule. Haskell is old and has the optional offset rule: I thought F# uses OCaml syntax. Emacs does well with OCaml syntax. Guy Steele told this story at a conference. As part of the

[Haskell-cafe] Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
In an attempt to get a deeper understanding of several monads (State, ST, IO, ...) I skimmed over some of the research papers (but didn't understand all of it, I lack the required education) and decided to write a little program myself without using any prefab monad instances that should mimic the

[Haskell-cafe] Re: Planning for a website

2009-08-19 Thread Gour
Colin == Colin Paul Adams co...@colina.demon.co.uk writes: Colin So my major decision is what framework and html-generating Colin libraries to use. There is such a wide choice on the Haskell Colin Wiki. But I guess some are more maintained than others. For Colin instance, WASH attracts me, with

Re: [Haskell-cafe] Unifcation and matching in Abelian groups

2009-08-19 Thread Jules Bean
John D. Ramsdell wrote: On Wed, Aug 19, 2009 at 6:16 AM, Neil Mitchellndmitch...@gmail.com wrote: Why not: if done then return () else do prob - getLine test prob main I've given up on using if-then-else in do expressions. They confuse emacs. There is a proposal for

Re: [Haskell-cafe] Observations about foldM

2009-08-19 Thread Dan Doel
On Wednesday 19 August 2009 12:14:24 am Jason McCarty wrote: Interestingly, foldM can also be written as a left fold. To see this, note that it is a theorem that foldr f z xs = foldl f z xs as long as f is associative and z is a unit for f. It must also be the case that xs is finite in length,

Re: [Haskell-cafe] Observations about foldM

2009-08-19 Thread Eugene Kirpichov
2009/8/19 Dan Doel dan.d...@gmail.com: On Wednesday 19 August 2009 12:14:24 am Jason McCarty wrote: Interestingly, foldM can also be written as a left fold. To see this, note that it is a theorem that foldr f z xs = foldl f z xs as long as f is associative and z is a unit for f. This is not

[Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
Apparently this particular example happens to work on Mac and Linux because of different buffering (thanks Martijn for the help!) To make sure we have no buffering at all, the main function should be: main = do hSetBuffering stdout NoBuffering hSetBuffering stdin NoBuffering test Now I think

Re: [Haskell-cafe] Hugs used in circuit simulations code

2009-08-19 Thread Fernan Bolando
On Wed, Jul 29, 2009 at 10:54 AM, Daniel Fischerdaniel.is.fisc...@web.de wrote: Am Mittwoch 29 Juli 2009 03:32:20 schrieb Fernan Bolando: What is everybodies expereience in speed difference between C and interpreted haskell? That depends on what you do, unsurprisingly. But usually it's huge.

Re: [Haskell-cafe] Observations about foldM

2009-08-19 Thread Daniel Fischer
Am Mittwoch 19 August 2009 16:32:57 schrieb Eugene Kirpichov: 2009/8/19 Dan Doel dan.d...@gmail.com: On Wednesday 19 August 2009 12:14:24 am Jason McCarty wrote: Interestingly, foldM can also be written as a left fold. To see this, note that it is a theorem that foldr f z xs = foldl f z xs

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Try LineBuffering. I do linewise stuff with interact a lot. You'll find stuff like unlines . lines may help too. In fact I just wrote a blog post about this. http://leimy9.blogspot.com I'm trying to write some interactive code to automate working with serial console controlled power strips,

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
Thanks, but that doesn't really matter in my example, my code is just buggy, and I'm not sure why. For example if I change my test function so that it outputs lines only, then it still prints Welcome first before asking for input. See e.g. http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8316#a8328

Re: [Haskell-cafe] Re: Planning for a website

2009-08-19 Thread Colin Paul Adams
Gour == Gour g...@gour-nitai.com writes: Colin == Colin Paul Adams co...@colina.demon.co.uk writes: Colin So my major decision is what framework and html-generating Colin libraries to use. There is such a wide choice on the Colin Haskell Wiki. But I guess some are more maintained

Re: [Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Colin Paul Adams
Jon == Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: Jon I wrote: You can get the whole thing with darcs get --partial http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/nHTMLs Jon but that was a temporary url that I copied and pasted. The Jon correct

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
On Wed, Aug 19, 2009 at 8:12 AM, Peter Verswyvelen bugf...@gmail.comwrote: Thanks, but that doesn't really matter in my example, my code is just buggy, and I'm not sure why. For example if I change my test function so that it outputs lines only, then it still prints Welcome first before asking

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
I fixed it myself but it's really tricky :-) http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8316#a8330 http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8316#a8330The idea is, that when the input is requested, the output that is then generated must be in sync with the input. inp = S $ \s i - let r =

Re: [Haskell-cafe] Re: Planning for a website

2009-08-19 Thread Marc Weber
Excerpts from Colin Paul Adams's message of Wed Aug 19 17:13:14 +0200 2009: I'd much rather be using happstack's macid stuff, especially as I will have only very low usage, so i shouldn't have any scalability problems. See also this current thread:

[Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Jon Fairbairn
Colin Paul Adams co...@colina.demon.co.uk writes: Jon == Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: Jon darcs get --partial Jon http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/HTMLs Did you make any progress on this at Anglo-Haskell? Not really, owing to Microsoft site

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
This doesn't seem to be working for me interactively though on a Mac. I still get Welcome before I've entered text. On Wed, Aug 19, 2009 at 8:25 AM, Peter Verswyvelen bugf...@gmail.comwrote: I fixed it myself but it's really tricky :-) http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8316#a8330

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Argh... I too have been up too late :-). I edited THE WRONG FILE! No wonder your change didn't take effect! :-/ Time for coffee I suppose. On Wed, Aug 19, 2009 at 8:38 AM, David Leimbach leim...@gmail.com wrote: This doesn't seem to be working for me interactively though on a Mac. I still

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
Not at all, use it for whatever you want to :-) I'm writing this code because I'm preparing to write a bunch of tutorials on FRP, and I first wanted to start with simple console based FRP, e.g. making a little text adventure game, where the input/choices of the user might be parsed ala parsec,

Re: [Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Colin Paul Adams
Jon == Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: Will it be cabal-ized soon? Jon That depends on whether anyone wants it done sufficiently Jon strongly to do it. Then I guess I will - some time in October. -- Colin Adams Preston Lancashire

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
Expect more bugs with this though :-) Just found out that looping does not work, it hangs, e.g. test = do out Enter your first name: fstName - inp out Enter your second name: sndName - inp out (Welcome ++fstName++ ++sndName) out Goodbye!* **test* Doesn't seem to work :-) Back to the

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Have you spoken to Conal Elliott about this stuff? He might be interested. He was looking for doing this sort of thing on iPhones for a bit. Also, I was wondering if you thought this Monad might be useful as a way to automate tasks in an Expect like fashion. I've been struggling with a good way

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Yet this does work interact $ run test9 test9 = replicateM 9 test Will run test 9 times. I suppose if one constructed an infinite list you could loop as you wanted to. Yet, that might not be what you want. Dave On Wed, Aug 19, 2009 at 9:28 AM, Peter Verswyvelen bugf...@gmail.comwrote:

[Haskell-cafe] Haddock: Failed to create dependency graph (when adding sections with * or a module heading)

2009-08-19 Thread Jared Updike
I compiled and installed haddock-2.4.2 from the tarball source. Adding a few simple comments to the code here: https://dl.getdropbox.com/u/143480/doc/DualMap.hs and running haddock $ haddock -h -o doc Data/DualMap.hs Warning: Data.DualMap: could not find link destinations for:

Re: [Haskell-cafe] Observations about foldM

2009-08-19 Thread Edward Kmett
It is associativity that is required, not commutativity (in addition to the fact that the list is finite). This is why Data.Foldable provides operations for monoids over containers. Monoids just provide you with associativity and a unit, which lets you reparenthesize the fold however you want.

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Ryan Ingram
I posted a reply to your paste with a stricter version of S and some cleanup. Untested, though I believe it should work without seq. case provides all the strictness you need, I think! -- ryan On Wed, Aug 19, 2009 at 9:28 AM, Peter Verswyvelenbugf...@gmail.com wrote: Expect more bugs with

[Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Iain Barnett
Quick question: I've tested this in a couple of different terminals (roxterm and xterm), so I'm fairly sure it's GHC that's the problem. Have I missed a setting? GHCi, version 6.10.4 Prelude putStrLn £ � Hugs98 200609-3 Hugs putStrLn £ £ I get the same character output from a password generator

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Doesn't seem to compile. I nearly never use case statements in my code, so I'm not really sure what's going on. neat2.hs:14:39: parse error on input `=' Dave On Wed, Aug 19, 2009 at 10:23 AM, Ryan Ingram ryani.s...@gmail.com wrote: I posted a reply to your paste with a stricter version of S

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
I've corrected it. It still doesn't suffer looping. :-) On Wed, Aug 19, 2009 at 10:31 AM, David Leimbach leim...@gmail.com wrote: Doesn't seem to compile. I nearly never use case statements in my code, so I'm not really sure what's going on. neat2.hs:14:39: parse error on input `=' Dave

Re: [Haskell-cafe] Observations about foldM

2009-08-19 Thread Eugene Kirpichov
You're right. My bad, indeed. 2009/8/19 Daniel Fischer daniel.is.fisc...@web.de: Am Mittwoch 19 August 2009 16:32:57 schrieb Eugene Kirpichov: 2009/8/19 Dan Doel dan.d...@gmail.com: On Wednesday 19 August 2009 12:14:24 am Jason McCarty wrote: Interestingly, foldM can also be written as a

Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Iain Barnett
2009/8/19 David Leimbach leim...@gmail.com Interesting... GHCI bug? Didn't the readline dependency go away not too long ago? Could it be related? I just tried this Prelude putStrLn \£ ghc: panic! (the 'impossible' happened) (GHC version 6.10.4 for i386-unknown-linux): charType: '\163'

Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Alexander Dunlap
On Wed, Aug 19, 2009 at 11:08 AM, Iain Barnettiainsp...@gmail.com wrote: 2009/8/19 David Leimbach leim...@gmail.com Interesting... GHCI bug?  Didn't the readline dependency go away not too long ago?  Could it be related? I just tried this Prelude putStrLn \£ ghc: panic! (the 'impossible'

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
The cleaned up code didn't seem to work for me, it printed everything before asking input again. But I added a patch that looks like it supports looping, but I don't understand exactly what is going on :-) I added the delay function which makes appending to the output less strict. Note that in

Re[2]: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Bulat Ziganshin
Hello Alexander, Wednesday, August 19, 2009, 10:16:26 PM, you wrote: Could it be a terminfo problem of some sort? It seems suspicious that there is a difference between terminals. probably, terminals reports some unusual symbols. but any panic should be reported to GHC Trac - anyway --

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Ryan Ingram
Added a new version (tested, works with infinite loops, no early output, etc.) http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8316#a8343 I'll put up a short write-up after lunch. -- ryan On Wed, Aug 19, 2009 at 11:28 AM, Peter Verswyvelenbugf...@gmail.com wrote: The cleaned up code didn't

Re: Re[2]: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Iain Barnett
2009/8/19 Bulat Ziganshin bulat.zigans...@gmail.com probably, terminals reports some unusual symbols. but any panic should be reported to GHC Trac - anyway I've added a new ticket here, in case you feel you want to add to it (or not :) http://hackage.haskell.org/trac/ghc/ticket/3443 Iain

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Very cool! I am still wondering what the significance of the DList is with this though, or why it was needed to begin with. Dave On Wed, Aug 19, 2009 at 12:28 PM, Ryan Ingram ryani.s...@gmail.com wrote: Added a new version (tested, works with infinite loops, no early output, etc.)

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
Wow, very nice cleanup! That's really a good way for me to learn, thanks. Well, my intuition told me that strings and ++ wouldn't work, since what we want is an infinite list of output strings, and using ++ would result in (((s1++s2)++s3)++s4)++s5... which is highly inefficient and I think it

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread David Leimbach
Hmmm very interesting thinking on this. Perhaps ByteStrings would be a good way to go for efficiency of composition. I'd love to see some profiling of all of this as part of the lesson at some point. (Perhaps with vacuum visualization?) This thread has tackled 3 major tricky issue areas with

Re: [Haskell-cafe] Re: Where do I put the seq?

2009-08-19 Thread Peter Verswyvelen
Well I really wrote this code as an exercise, and it was a good one. Now I (or someone) needs to explain why it works. But is this monad really useful? I mean it would be straightforward to write this using the ST monad I guess? Anyway, the reason why I want this pure code is that even with a

Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Sebastian Sylvan
Both of these happen on Windows 7 64-bit for me too. On Wed, Aug 19, 2009 at 7:08 PM, Iain Barnett iainsp...@gmail.com wrote: 2009/8/19 David Leimbach leim...@gmail.com Interesting... GHCI bug? Didn't the readline dependency go away not too long ago? Could it be related? I just tried

Re: [Haskell-cafe] gbp sign showing as unknown character by GHC

2009-08-19 Thread Judah Jacobson
On Wed, Aug 19, 2009 at 10:31 AM, Iain Barnettiainsp...@gmail.com wrote: Quick question: I've tested this in a couple of different terminals (roxterm and xterm), so I'm fairly sure it's GHC that's the problem. Have I missed a setting? GHCi, version 6.10.4 Prelude putStrLn £ � Hugs98 

Re: [Haskell-cafe] Keeping an indexed collection of values?

2009-08-19 Thread Bernie Pope
2009/8/19 Job Vranish jvran...@gmail.com: My first hacked up attempt is as follows: data IndexedCollection a = IndexedCollection {     nextKey        :: Int,     availableKeys :: [Int],     items                :: (IntMap Int a) } deriving (Show) emptyIndexedCollection ::

Re: [Haskell-cafe] Control.Parallel on 6.10.4 - Mac OS X version

2009-08-19 Thread Kevin Smith
I ran the simple parallel hello world on my system. the output of the programs with N1 and N2 is shown below. I'm not sure how to interpret this - it looks like I am getting a little speedup on the real time. I'm running the 6.10.4 install package for Mac OS X on a intel core 2 mac book. Here is

[Haskell-cafe] Re: Unifcation and matching in Abelian groups

2009-08-19 Thread Chung-chieh Shan
John D. Ramsdell ramsde...@gmail.com wrote in article 7687290b0908190243y70541426x3d485267c4a94...@mail.gmail.com in gmane.comp.lang.haskell.cafe: I've been studying equational unification. I decided to test my understanding of it by implementing unification and matching in Abelian groups.

[Haskell-cafe] Re: Planning for a website

2009-08-19 Thread Gour
Colin == Colin Paul Adams co...@colina.demon.co.uk writes: Colin I'd much rather be using happstack's macid stuff, especially as I Colin will have only very low usage, so i shouldn't have any Colin scalability problems. Well, I do not have enough money to pay for Happs resources... Right,