[Haskell-cafe] seems like I'm on the wrong track

2009-12-01 Thread Michael P Mossey
Perhaps someone could either (1) help me do what I'm trying to do, or (2) show me a better way. I have a problem that is very state-ful and I keep thinking of it as OO, which is driving me crazy. Haskell is several times harder to use than Python in this instance, probably because I'm doing it

Re: [Haskell-cafe] better way to do this?

2009-10-06 Thread Michael P Mossey
Michael P Mossey wrote: Also note that I added the Random class constraint to 'shuffle'. I haven't tested this but it might be necessary. Or not? Okay I figured this part out too. The members of the list you are shuffling have no class constraint on them because the 'shuf

Re: [Haskell-cafe] better way to do this?

2009-10-06 Thread Michael P Mossey
n a row give good behavior? Is it a bad idea? Is it system-dependent? Also note that I added the Random class constraint to 'shuffle'. I haven't tested this but it might be necessary. Or not? Thanks, Mike Michael P Mossey wrote: Duncan Coutts wrote: So you end up with pure

Re: [Haskell-cafe] better way to do this?

2009-10-06 Thread Michael P Mossey
Duncan Coutts wrote: So you end up with pure functions like: shuffle :: RandomGen g => g -> [x] -> [x] Thanks for the help, Duncan. I'm confused on one point. Don't you always need the new state of the generator back? So wouldn't this need to be: shuffle :: RandomGen g => g -> [x] -> (g,[x

[Haskell-cafe] Doing people's homework?

2009-09-28 Thread Michael P Mossey
I'm not really hip to the culture here so this is just an observation, but some of the recent questions posted to this list (and beginn...@haskell.org) look a lot like someone's homework. Is anyone here concerned about avoiding giving the full answer, or maybe it's really none of our business (w

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-09 Thread Michael P Mossey
Been poking around. Maybe IORef has something to do with this? I found a qtHaskell example that seems to make use of IORef in order to accomplish something similar to what I want. Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything

[Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-09 Thread Michael P Mossey
I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need a hint that could help me figure out the next step, which I might be able to infer from the qtHaskell API

[Haskell-cafe] can someone point me to more help about Database.HDBC.ODBC?

2009-05-29 Thread Michael P Mossey
I'm trying to use Database.HDBC.ODBC to connect to a MySQL server, and I cannot figure out the docs. I want to establish a connection, and I know the server url, username, and password. According to these docs... http://software.complete.org/static/hdbc-odbc/doc//HDBC-odbc/Database-HDBC-ODBC.ht

Re: [Haskell-cafe] the problem of design by negation

2009-05-24 Thread Michael P Mossey
Richard O'Keefe wrote: Design-by-negativity can *be* a way of being creative. I've lost count of the number of times that I've been explaining to someone why something can't be done, and suddenly realised that one of the reasons was invalid and seen how to do it. The key is not whether you explo

[Haskell-cafe] tips on using monads

2009-05-17 Thread Michael P Mossey
I've got one of those algorithms which "threatens to march off the right edge" (in the words of Goerzen et al). I need something like a State or Maybe monad, but this is inside the IO monad. So I presume I need StateT or MaybeT. However, I'm still (slowly) learning about monads from first princi

Re: [Haskell-cafe] "subscribing" to the comments, online Real World Haskell

2009-04-24 Thread Michael P Mossey
Michael P Mossey wrote: However, I would like some ability to subscribe to specific comments. I want to see if people have replied to me or what the latest discussion is. Okay, to follow up my own post, I discovered the subscription button for each chapter. That's good. However, using

[Haskell-cafe] "subscribing" to the comments, online Real World Haskell

2009-04-24 Thread Michael P Mossey
I love that Real World Haskell is online, here: I love that it has a comment section embedded with every paragraph. However, I would like some ability to subscribe to specific comments. I want to see if people have replied to me or what the latest disc

[Haskell-cafe] installing Sqlite3 driver for windows

2009-04-22 Thread Michael P Mossey
I'm working from Real World Haskell, trying to install HDBC and the Sqlite3 driver on Windows XP. It was easy enough to use Cabal to install HDBC. However, for the Sqlite3 driver things get fuzzy. I downloaded hdbc-sqlite3_2.1.0.0.zip, but don't know what I'm supposed to do with it. Also, it

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Michael P Mossey
I've just about got this parser working, but wondering about something. Turns out I need "try" inside the "lookahead" here. parseText :: Parser String parseText = manyTill anyChar $ lookAhead (try (string "//")) Without try, if I give it an input with a single slash, like "some/text" It stops

[Haskell-cafe] Parsec question

2009-04-16 Thread Michael P Mossey
I want to write a parser that can read a file with this format: the file has sections which are demarcated by keywords. Keywords always begin with two forward slashes and consist of letters, digits, and underscore. The text can be anything, including special characters. For instance: //keywor

Re: [Haskell-cafe] Best text editor

2009-04-13 Thread Michael P Mossey
Xiao-Yong Jin wrote: Michael P Mossey writes: lines above for alignment positions, and advances one position at a time). Maybe I'll write one. I do have a bit of experience with emacs lisp. Is there something we can learn from python-mode? I haven't written python code since I sta

Re: [Haskell-cafe] Best text editor

2009-04-13 Thread Michael P Mossey
Ketil Malde wrote: Michael Mossey writes: I'm a beginner, but I'll chime in and say I use Emacs with haskell-mode. It's auto-indentation is a bit complex in behavior which is unappealing (I feel like I never know what it's going to do when I hit tab), but I would be curious what someone with m