Re: haskell newbie seeking for advice

2003-08-14 Thread Glynn Clements
Jose A.Ortega Ruiz wrote: as stated in the subject, i'm a newcomer to haskell programming: i've read some tutorials and (portions of) a couple of books and am really fascinated with the language. but my haskell coding experience is limited to toy programs and short exercises. so i decided to

Re: Yet Another Monad Tutorial

2003-08-14 Thread Derek Elkins
On Wed, 13 Aug 2003 13:26:34 +0200 blaat blaat [EMAIL PROTECTED] wrote: I have a long reply, perhaps I'll post it later. Here's a more pragmatic short one. What did we lose? Well, introspection comes to mind. A monad is strange in the sense that, actually, there does not seem to be any

Re: Editor in Linux for Hint/Helium

2003-08-14 Thread Glynn Clements
Tim Stitt wrote: I'm using the Helium interpreter/compiler with the Hint interface within Linux. Unfortunately, I want an editor that allows me to jump to the row/column of the source when I receive an error. Does anyone know of a good editor in Linux to do this or the commands for Emacs

Re: idiom for producing comma-seperated lists?

2003-08-14 Thread Antony Courtney
Ketil Z. Malde wrote: Antony Courtney [EMAIL PROTECTED] writes: -- Example: format a list of strings, using a comma as a seperator: mkSepStr :: [String] - String mkSepStr xs = foldrs (\x s - x ++ , ++ s) xs t0 = mkSepStr [] -- == t1 = mkSepStr [hello]-- == hello

Re: Another typing question

2003-08-14 Thread Konrad Hinsen
On Tuesday 05 August 2003 15:23, Wolfgang Jeltsch wrote: There probably are ways to achieve this with Haskell's type system. The exact solution depends on what exactly you want. For just distinguishing between lists of different lengths you could use tuples like (a,a) (list of length 2)

Re: [newbie] UTF-8

2003-08-14 Thread Marcin 'Qrczak' Kowalczyk
Dnia pon 11. sierpnia 2003 00:49, Wolfgang Jeltsch napisa: The main problem is that you need binary I/O. Haskell 98 only provides text I/O. You don't need binary I/O for UTF-8 now; because implementations use ISO-8859-1, UTF-8 octets can be faked as characters by (chr . fromIntegral). The

Re: IO Bool - Bool

2003-08-14 Thread Brandon Michael Moore
On Thu, 14 Aug 2003, Wolfgang Jeltsch wrote: On Thursday, 2003-08-14, 17:05, CEST, Kevin S. Millikin wrote: On Wednesday, August 13, 2003 11:20 PM, Tn X-10n [SMTP:[EMAIL PROTECTED] wrote: is it possible to convert IO Bool to Bool? Sure. Which Bool do you want? True? toTrue

Re: idiom for producing comma-seperated lists?

2003-08-14 Thread Ketil Z. Malde
Antony Courtney [EMAIL PROTECTED] writes: -- Example: format a list of strings, using a comma as a seperator: mkSepStr :: [String] - String mkSepStr xs = foldrs (\x s - x ++ , ++ s) xs t0 = mkSepStr [] -- == t1 = mkSepStr [hello]-- == hello t2 = mkSepStr

RE: .. Drowning in stateful, side-effect riddled, spaghetti code? We have the answer. fdps[]c.

2003-08-14 Thread Bayley, Alistair
Hey there! Stateful side-effect-laden spaghetti programming sucks, and so does the cost.. feel like your [sic] getting ripped off? ... We tear up your code and give you and your colleagues a fresh start .. - Save you a lot of money by eliminating side-effects - Develop new code in

RE: Database interface

2003-08-14 Thread Tim Docker
[EMAIL PROTECTED] wrote: If I may interject, that's precisely how a Scheme DB interface is designed. The main function is a left-fold. Not quite though: it provides for a premature termination: A major procedure: DB1:fold-left PROC INITIAL-SEED QUERY-OBJECT Premature termination sounds

[String]-[[Bool]] 2

2003-08-14 Thread Tn X-10n
[String] contains = ["1 0 0","1 0 0","0 1 0"] this [String] is read from a file. the file shows only: i convert it by using Lines. but i stuck wif the output. 1 0 0 1 0 0 1 0 1 if 1 then False 0 then True the expected result show be [[False,True,True],[False,True,True],[True,False,True]] My code

Re: Another typing question

2003-08-14 Thread Wolfgang Jeltsch
On Tuesday, 2003-08-05, 15:22, CEST, Nick Name wrote: [...] Is there any way to parametrize a type by a value, rather than another type? What I would like to do is to define list of length 3 and list of length 4 as separate parametrization of the same type, such that I could write

RE: Yet Another Monad Tutorial

2003-08-14 Thread Jeff Newbern
Alistair, Hhhmmm. That is an interesting issue, and I am unsure how to treat it in the tutorial. I did attempt to explain the ability of the monad to isolate impure computations, but I think I need to make a better explanation of what an action is and how it is used. As for the question of

Re: Yet Another Monad Tutorial

2003-08-14 Thread blaat blaat
To many questions, not enough mail. First, thanks for all your replies. Second, I stand totally corrected on the fact that we cannot break down monads. Functions of type m a-b are called impure, see also unsafePerformIO. I am questioning (a) the exact relation between monads, monadic IO, IO in

Re: Yet Another Monad Tutorial

2003-08-14 Thread Antony Courtney
Peter G. Hancock wrote: Jeff Newbern wrote (on Tue, 12 Aug 2003 at 17:20): ? The functions exported from the IO module do not perform I/O themselves. They return I/O actions, which describe an I/O operation to be performed. The I/O actions are combined within the IO monad (in a

AW: Yet Another Monad Tutorial

2003-08-14 Thread Markus . Schnell
The overall message I have taken from your post is that I need to be more precise to convey the correct information and avoid confusion (or worse, misinformation). As I understood it, the tutorial should be instructive. So I would not try to be more precise at the beginning, because too much

RE: Database interface

2003-08-14 Thread oleg
I'll probably generalise the query function to do a fold, rathen than always accumulate a list: doquery :: Process - String - (a - b - IO b) - b - IO b If I may interject, that's precisely how a Scheme DB interface is designed. The main function is a left-fold. Not quite though: it

Re: Yet Another Monad Tutorial

2003-08-14 Thread Dominic Fox
I suspect that tutorials should at some point mention some definitions of monads, monoids et al --- since this is where the power (sorry, QA) comes from. I was reading an overview-for-non-specialists of category theory earlier today, and was surprised by the familiarity of much of it - based

Re: [String] - [[Bool]]

2003-08-14 Thread tahara
i am new wif haskell, i would like to know how can i get a list of string and convert it to a list of a list of bool [String]- [[Bool]] for example a [String] [0 1 0 1 0 1,0 0 0 0 0 0 ,1 0 0 0 1 0] it return true if 0 and false if 1. the [String] is read from a file. map (\x - map

haskell newbie seeking for advice

2003-08-14 Thread Jose A . Ortega Ruiz
hi all, as stated in the subject, i'm a newcomer to haskell programming: i've read some tutorials and (portions of) a couple of books and am really fascinated with the language. but my haskell coding experience is limited to toy programs and short exercises. so i decided to try my hand at a

Re: Yet Another Monad Tutorial

2003-08-14 Thread Jeff Newbern
Peter, Thank you for criticism. This is exactly the kind of feedback I need. The overall message I have taken from your post is that I need to be more precise to convey the correct information and avoid confusion (or worse, misinformation). I should have said that a function which performs a

Re: Another typing question

2003-08-14 Thread Jon Cast
On Tuesday, 2003-08-05, 15:22, CEST, Nick Name wrote: snip This is called dependent types and is not a feature of haskell (nor of any language that I know); there was cayenne (try a google search) but I don't believe it is still mantained. snip BTW, why is there no general interest

Re: IO Bool - Bool

2003-08-14 Thread Adrian Hey
On Thursday 14 August 2003 06:20, Tn X-10n wrote: htmldiv style='background-color:'DIV PBRhai guys/Pis it possible to convert IO Bool to Bool?/DIV/divbr clear=allhrGet 10mb of e-mail space with a href=http://g.msn.com/8HMTENSG/2737??PS=;MSN Hotmail Extra Storage/a at only S$36 per year

Fwd: Re: Yet Another Monad Tutorial

2003-08-14 Thread blaat blaat
From: Derek Elkins [EMAIL PROTECTED] blaat blaat [EMAIL PROTECTED] wrote: [...] However, given that observation, the fact that IO is a monad I find to be a _rather arbitrary design decision_; why not define a small term language which may be passed to the OS? That would be confusing to use or

Outlook

2003-08-14 Thread birene
hey there, i thought you'd like to check this out You really owe it to yourself and your family to take a look, With the money you save, put it towards a new car! --- http://btrack.iwon.com/r.pl?redir=http://[EMAIL PROTECTED]/index.asp?RefID=198478 --- for no more

Re: Yet Another Monad Tutorial

2003-08-14 Thread Jeff Newbern
Hello, I have put up all-in-one archives of the tutorial for people who prefer to read it offline. http://www.nomaware.com/monads/monad_tutorial.tgz and http://www.nomaware.com/monads/monad_tutorial.zip Thanks, Jeff Newbern [EMAIL PROTECTED] __ Do you Yahoo!?

Re: Database interface

2003-08-14 Thread Thomas L. Bevan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I still want to use HaskellDB (or at least the relational calculus part of it), so I was thinking of splitting it into two pieces: a library that submits SQL queries and returns the results (database interface), and a library that constructs

Re: IO Bool - Bool

2003-08-14 Thread Wolfgang Jeltsch
On Thursday, 2003-08-14, 17:05, CEST, Kevin S. Millikin wrote: On Wednesday, August 13, 2003 11:20 PM, Tn X-10n [SMTP:[EMAIL PROTECTED] wrote: is it possible to convert IO Bool to Bool? Sure. Which Bool do you want? True? toTrue :: IO Bool - Bool toTrue x = True Or False?

Re: Yet Another Monad Tutorial

2003-08-14 Thread Ross Paterson
On Tue, Aug 12, 2003 at 03:04:39PM -0400, Antony Courtney wrote: So then, in your view, what *is* an IO action? One conceptual model is that an IO action with type (IO a) denotes a function of type World - (World,a). But the IO monad is not a state monad, because other agents may change the

RE: IO Bool - Bool

2003-08-14 Thread Kevin S. Millikin
On Wednesday, August 13, 2003 11:20 PM, Tn X-10n [SMTP:[EMAIL PROTECTED] wrote: is it possible to convert IO Bool to Bool? Sure. Which Bool do you want? True? toTrue :: IO Bool - Bool toTrue x = True Or False? toFalse :: IO Bool - Bool toFalse x = False Maybe that's not what you had

RE: Yet Another Monad Tutorial

2003-08-14 Thread Bayley, Alistair
From: Wolfgang Jeltsch [mailto:[EMAIL PROTECTED] For example, the function readFile is pure. For a specific string s the expression readFile s always yields the same result: an I/O action which searches for a file named s, reads its content and takes this content as the result of

Re: IO Bool - Bool

2003-08-14 Thread Keith Wansbrough
PBRhai guys/Pis it possible to convert IO Bool to Bool? No, it's not... and for good reason! See the discussion at http://www.haskell.org/hawiki/ThatAnnoyingIoType and http://www.haskell.org/hawiki/UsingIo In general, the HaWiki has answers to lots of newbie questions like this - you might

Re: IO Bool - Bool

2003-08-14 Thread Wolfgang Jeltsch
On Thursday, 2003-08-14, 07:20, CEST, Tn X-10n wrote: hai guys is it possible to convert IO Bool to Bool? No. The reason for introducing the IO type is to preserve the purity of Haskell, i.e., to ensure that expression evaluation doesn't depend on the state of the outside world and doesn't

Re: Yet Another Monad Tutorial

2003-08-14 Thread Derek Elkins
On Wed, 13 Aug 2003 09:44:36 +0200 blaat blaat [EMAIL PROTECTED] wrote: Hmmm, I personally always thought of the IO monad as being a synonym for Program So. What is a Program? [...] For what is the interpretation of an object of type IO a? Well, it is a bit of a hack atop of Haskell,

[String]-[[Bool]]

2003-08-14 Thread Tn X-10n
a string is a list of Char which can be '1', '0', '/n'and spaces ' '. ["1 0 1 0 0 1 /n"]Get free gift vouchers every week with MSN Premium Vouchers ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Yet Another Monad Tutorial

2003-08-14 Thread blaat blaat
Hmmm, I personally always thought of the IO monad as being a synonym for Program (or, for functions wich return an IO a, a subroutine with side-effects which returns a value of type a). We can build mini programs (like putStr), and compose them in a sequential manner (including something alike

RE: Database interface

2003-08-14 Thread Tom Pledger
Tim Docker writes: | Tom Pledger writes: | | This is a pretty good way to stop those nasty vague SQL row types at | the Haskell border and turn them into something respectable. Perhaps | it would even be worth constraining the extracted type to be in | DeepSeq | | doquery

Re: haskell newbie seeking for advice

2003-08-14 Thread Iavor Diatchki
hi, Jose A.Ortega Ruiz wrote: hi all, as stated in the subject, i'm a newcomer to haskell programming: i've read some tutorials and (portions of) a couple of books and am really fascinated with the language. but my haskell coding experience is limited to toy programs and short exercises. so i

Database interface

2003-08-14 Thread Tom Pledger
Thomas L. Bevan writes: | Does anyone know if there is work being done on a standard Haskell | database interface. I suspect that there isn't. The pattern seems to be that someone gets an interface working well enough for some purposes, and perhaps shares it, but is too modest and/or busy to

RE: Database interface

2003-08-14 Thread Tim Docker
Tom Pledger writes: This is a pretty good way to stop those nasty vague SQL row types at the Haskell border and turn them into something respectable. Perhaps it would even be worth constraining the extracted type to be in DeepSeq doquery :: (DeepSeq v) = Process -

Re: [String]-[[Bool]] 2

2003-08-14 Thread Ketil Z. Malde
Tn X-10n [EMAIL PROTECTED] writes: change :: String - Bool change 1  = True change 0  = False conv :: [String] - [Bool]==unable to declare [[Bool]] Again: a String is a list of ? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Re: [String] - [[Bool]]

2003-08-14 Thread Ketil Z. Malde
Tn X-10n [EMAIL PROTECTED] writes: i am new wif haskell, i would like to know how can i get a list of string and convert it to a list of a list of bool [String]- [[Bool]] What is the definition of a String? (I.e. what is a String a list of?) Write a function to convert one of these to the

RE: Yet Another Monad Tutorial

2003-08-14 Thread Bayley, Alistair
-Original Message- From: Jeff Newbern [mailto:[EMAIL PROTECTED] Alistair, Hhhmmm. That is an interesting issue, and I am unsure how to treat it in the tutorial. I did attempt to explain the ability of the monad to isolate impure computations, but I think I need to make a better

RE: Database interface

2003-08-14 Thread Bayley, Alistair
-Original Message- From: Thomas L. Bevan [mailto:[EMAIL PROTECTED] This type of interface is fine as far as it goes, but there is only ever a loose coupling between the database and application. The HaskellDB work implemented a relational calculus that ensured that all queries

Re: Yet Another Monad Tutorial

2003-08-14 Thread Jeff Newbern
Alistair, Thanks for your message regarding the debate about monads and purity. What do you think about these additions as a discussion of the issue? Does this address everything you think is needed? Is there a clearer way to explain it? Thanks, Jeff In the section No Way Out: -- The

RE: Yet Another Monad Tutorial

2003-08-14 Thread Phil Molyneux
I think the crucial distinction is to think about is the difference between calculating a value (such as a character) compared to calculating an action (such as a computation that reads a character) --- one is wholly in your programming language while the other interacts with something outside

.. Drowning in debt? We have the answer. fdps[]c.

2003-08-14 Thread koxwhdsinsad
Hey There! Debt sucks, and so do the repayments.. feel like your getting ripped off? .. We tear up your debt and give you and your family a fresh start .. - Save you a lot of money by eliminating late fees - Settle your accounts for a substantially reduced amount - Stop creditors calling you on

[newbie] UTF-8

2003-08-14 Thread Danon'.
Hi, We try to make a program which write on stdout the UTF-8 character corresponding to an input unicode value. And this under MacOS X, Debian linux, and Windows. It seems to be easy, but we can't have found anything valuable, on the net. Would you mind to help us? Niko. Ps: excuse my poor

Help with Exceptions on I/O

2003-08-14 Thread Alexandre Weffort Thenorio
I have a program which creates textfiles out of other files. Since theprogram is runned from windows I output some text strings (Like "Filecreated succefully") and I need to stop the program before it quits so thatthe user can read the line outputted to know what went on and then he canpress