Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread Iain Barnett
On 18 Jun 2008, at 9:46 am, Jules Bean wrote: This is exactly the sort of message that haskell-cafe does not normally contain. Let's not start now. Reactions/arguments like the ones on this thread are perfect for Haskell - recursive and exponential. :) Could we have closure too? :-)

Re: [Haskell-cafe] Libraries for Commercial Users

2009-10-08 Thread Iain Barnett
On 8 Oct 2009, at 00:41, Curt Sampson wrote: On 2009-10-02 09:03 -0600 (Fri), John A. De Goes wrote: [Haskell] is missing many key libraries that would be of great commercial value. Just out of curiousity, can you give me some examples of what you feel these are? Relational database

[Haskell-cafe] a library for control of terminal driver modes?

2009-10-11 Thread Iain Barnett
I'm looking for a library like Perl's Term-Readkey, so that I can turn on and off the echo for secure password input from a terminal. Anyone know which library I need to use for this? Iain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Documentation (was: ANN: text 0.5, a major revision of the Unicode text library)

2009-10-11 Thread Iain Barnett
On 11 Oct 2009, at 13:58, John Lato wrote: For anyone writing introductions to generic programming, take this as a plea from Haskellers everywhere. If one of the RWH authors can't understand how to make use of these techniques, what hope do the rest of us have? John Lato P.S. Some might

Re: [Haskell-cafe] a library for control of terminal driver modes?

2009-10-12 Thread Iain Barnett
On 11 Oct 2009, at 15:30, Andrew Coppin wrote: Iain Barnett wrote: I'm looking for a library like Perl's Term-Readkey, so that I can turn on and off the echo for secure password input from a terminal. Anyone know which library I need to use for this? The package ansi-terminal allows you

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-24 Thread Iain Barnett
On 24 Oct 2009, at 07:47, Curt Sampson wrote: If you're doing something with any technological difficulty, however, such as the next Twitter, Rails won't provide much of the help you really need. Twitter was (originally, at least) done using ROR. What is it that Haskell can do that Ruby

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-24 Thread Iain Barnett
On 25 Oct 2009, at 03:42, Curt Sampson wrote: There's the key difference between us, I suppose. You believe that knowing the syntax and libraries of a language is the hardest part of a programming project. I believe it's a nearly trivial part. I certainly didn't say that. Do you always

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-25 Thread Iain Barnett
On 25 Oct 2009, at 08:31, Magnus Therning wrote: Also, as I'm sure you've found out re libraries, more isn't necessarily better. Definitely. Choice can become a real pain, especially in the face of lacking documentation. I'd argue that many, if not most, commonly used libraries

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-25 Thread Iain Barnett
Curt, I really do think you should lay off characterising other people's comments. If you want clarification ask for it or ask a question. I never said Haskell was failing, for example, but I would like an example of it succeeding in the area that Ruby is being so heavily criticised for.

[Haskell-cafe] hopefully, a very quick question about ByteString lib

2009-10-27 Thread Iain Barnett
[1 of 1] Compiling Main ( sha1.lhs, interpreted ) import qualified Data.ByteString as B main = B.getLine = B.putStrLn Ok, modules loaded: Main. *Main :main *** Exception: no buffering And just to make sure it's not something to do with GHCi or anything like that main =

Re: [Haskell-cafe] hopefully, a very quick question about ByteString lib

2009-10-27 Thread Iain Barnett
On 27 Oct 2009, at 15:47, Thomas DuBuisson wrote: If you wanted to make sure it didn't have to do with ghci then you should have compiled the original code, not tested different functions. That is a very good point! On 27 Oct 2009, at 16:00, Daniel Fischer wrote: Look at the sources:

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-27 Thread Iain Barnett
On 25 Oct 2009, at 15:51, Curt Sampson wrote: Funny, I do too. Still, when Luxuria opened for them in Vancouver in the '90s, I started to think about what Howard Devoto was doing Anyone who recognises The Mark E. Smith is worthy of being master of all he surveys. But in others,

[Haskell-cafe] wxMac/wxHaskell focus problem, a quick solution

2009-10-29 Thread Iain Barnett
I was trying to go through some of the wxHaskell examples, and they wouldn't work on my (Tiger) mac. Same thing happened with a few other wx apps I downloaded from Hackage. A bit of a rummage on the internet turned up an issue with wxMac[1]. You need to put the haskell executable in an OSX

Re: [Haskell-cafe] wxMac/wxHaskell focus problem, a quick solution

2009-10-29 Thread Iain Barnett
On 29 Oct 2009, at 15:41, Gregory Crosswhite wrote: You don't have to turn a program into an application in order to make the GUI work This is true, but I don't think it's better to import extra code where simple packaging (folders and a plist), which is actually very convenient, can do

Re: [Haskell-cafe] wxMac/wxHaskell focus problem, a quick solution

2009-10-29 Thread Iain Barnett
On 29 Oct 2009, at 20:52, Miguel Mitrofanov wrote: Open up XCode and there are a lot of different types of projects to choose from, and then you have to know how to use the IDE. This is just a quick project set up for anything you want to do that is straightforward. So... Does it mean

[Haskell-cafe] HDBC convert [SqlValue] without muchos boilerplate

2010-02-11 Thread Iain Barnett
Hi, I'm trying to get to grips with HDBC and have the following problem. When I run a query that returns a result set, each row comes back as a [SqlValue]. Naively, I thought the following function would convert a [SqlValue] into a string, but instead I get the error below. convrow2 ::

Re: [Haskell-cafe] HDBC convert [SqlValue] without muchos boilerplate

2010-02-11 Thread Iain Barnett
On 11 Feb 2010, at 10:05, Vasyl Pasternak wrote: But fromSql function could convert everything to String, so you never need to use `show`, just simply write convrow2 :: [SqlValue] - String convrow2 (x:xs) = foldl (\i j - i ++ | ++ (fromSql j)) (fromSql x) xs But, IMO, this is more

Re: [Haskell-cafe] Random Number

2009-06-07 Thread Iain Barnett
On 7 Jun 2009, at 8:33 pm, ptrash wrote: Hi, is the are way (or a build in method) in haskell to get a random number from a number bottom to a number top? Something like let randomNumber = random 1 30 to get a random number between 1 and 30. rand :: Int - Int - IO Int rand low high =

Re: [Haskell-cafe] Convert IO Int to Int

2009-06-10 Thread Iain Barnett
On 10 Jun 2009, at 12:55 pm, ptrash wrote: Now I have tried to write a Method which gives me a Number of random numbers the same way but it doesn't work. randomList :: Int - [Integer] randomList 0 = [] randomList n = do r - randomRIO (1, 10)

[Haskell-cafe] n00b question: defining datatype

2009-07-23 Thread Iain Barnett
Hi, I'm trying to get my head around datatypes, and wondering how I might define a simple Task datatype in Haskell. data Task = Task { title :: String, completed :: Bool } Ok, that's straightforward, but sometimes tasks become a list of tasks themselves data Task = Task { title :: String,

Re: [Haskell-cafe] n00b question: defining datatype

2009-07-23 Thread Iain Barnett
Ok, thanks to everyone, that's certainly answered my question and given me some more avenues to pursue. I can see now that because I can pattern match against the empty list it's not really a problem to have it there. I didn't realise I could use Maybe in the constructor because it's a monad, but

[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] 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: 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] gbp sign showing as unknown character by GHC

2009-08-20 Thread Iain Barnett
2009/8/20 Ketil Malde ke...@malde.org Stuart Cook sco...@gmail.com writes: GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude map Data.Char.ord 饁 [39233]== 0x9941 Prelude putStrLn 饁 A ==

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

2009-08-20 Thread Iain Barnett
Got this back from the bug tracker 6.12.1 will have Unicode support in the IO library which mostly fixes this problem. The rest is fixed by #3398. Iain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Doing people's homework?

2009-09-29 Thread Iain Barnett
On 29 Sep 2009, at 03:19, Casey Hawthorne wrote: If you do a student's homework, you are cheating that student out of an education. He/She may realize that t late in the future. -- Regards, Casey I'm not sure I agree with that. If they're old enough to be doing Haskell homework then

Re: [Haskell-cafe] Doing people's homework?

2009-09-29 Thread Iain Barnett
On 29 Sep 2009, at 12:48, Daniel Fischer wrote: Am Dienstag 29 September 2009 13:04:38 schrieb Iain Barnett: Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something

Re: [Haskell-cafe] Building fastcgi from hackage on windows.

2008-08-07 Thread Iain Barnett
On 7 Aug 2008, at 8:58 pm, Edward Ing wrote: I am using the cabal system to build the hackage version of fastcgi. I get the below messages with the runghc Setup.lhs build command. Network\FastCGI.hsc:59:21: fcgiapp.h: No such file or directory Network\FastCGI.hsc: In function `main':

Re: [Haskell-cafe] Building fastcgi from hackage on windows.

2008-08-08 Thread Iain Barnett
, and that the task of building on XP is quite different. Where are include headers and libraries found in Windows XP system? What fastcgi implementation would you need for a Windows XP? These are the probably the important questions. Edward Ing On Thu, Aug 7, 2008 at 7:54 PM, Iain Barnett [EMAIL PROTECTED

[Haskell-cafe] Random question

2008-09-24 Thread Iain Barnett
Hi, I have a function, that produces a random number between two given numbers rand :: Int - Int - IO Int rand low high = getStdRandom (randomR (low,high)) (Naively) I'd like to write something like take (rand 1 10 ) [1..10] and see [1,2,3,4] ... or anything but nasty type-error

Re: [Haskell-cafe] Random question

2008-09-24 Thread Iain Barnett
wrote: Iain Barnett wrote: Hi, I have a function, that produces a random number between two given numbers rand :: Int - Int - IO Int rand low high = getStdRandom (randomR (low,high)) (Naively) I'd like to write something like take (rand 1 10 ) [1..10] and see [1,2,3,4] ... or anything

Re: [Haskell-cafe] Random question

2008-09-24 Thread Iain Barnett
of the other solutions presented. Thanks for the links, I'll give them a read. On Wed, Sep 24, 2008 at 5:10 PM, Lev Walkin [EMAIL PROTECTED] wrote: forgot return, of course: myTake :: IO [Int] myTake = do n - rand 1 10 return $ take n [1..10] Lev Walkin wrote: Iain Barnett wrote

[Haskell-cafe] Re: Random question

2008-10-05 Thread Iain Barnett
of IO tutorials it just seems to be the 'do' syntax for assigning a value to a symbol, but of course, :t getLine getLine :: IO String On 24 Sep 2008, at 10:03 pm, Iain Barnett wrote: Hi, I have a function, that produces a random number between two given numbers rand :: Int - Int - IO Int

Re: [Haskell-cafe] Re: Random question

2008-10-07 Thread Iain Barnett
On 5 Oct 2008, at 7:06 pm, Henning Thielemann wrote: Instead of separate calls to 'take' and 'drop' you may prefer 'splitAt': requeue z xs = let (prefix,pivot:suffix) = splitAt (z-1) xs in prefix ++ suffix ++ [pivot] Thanks. Took me a while to get the function to shuffle

[Haskell-cafe] Constraints at construction

2008-10-09 Thread Iain Barnett
If I were to create an object in C#, for instance, I could add code to the constructor that might limit the type further e.g. public class Car { string model; int wheels; public Car ( string model, int no_of_wheels ) { if ( no_of_wheels = 2 )

Re: [Haskell-cafe] Constraints at construction

2008-10-09 Thread Iain Barnett
PROTECTED] On Behalf Of Iain Barnett Sent: 09 October 2008 2:03 pm To: haskell-cafe@haskell.org Subject: [Haskell-cafe] Constraints at construction If I were to create an object in C#, for instance, I could add code to the constructor that might limit the type further e.g. public class Car

Re: [Haskell-cafe] Interesting new user perspective

2008-10-10 Thread Iain Barnett
On 9 Oct 2008, at 9:33 pm, Andrew Coppin wrote: I think it's just the teaching of the language that needs work, not so much the language itself. As a newer user myself, I'd agree with this statement. I'd like to see far more mundane tasks solved in tutorials. The number of times

Re: [Haskell-cafe] Interesting new user perspective

2008-10-10 Thread Iain Barnett
On 10 Oct 2008, at 7:05 pm, Jonathan Cast wrote: On Fri, 2008-10-10 at 19:08 +0100, Iain Barnett wrote: In Haskell it is. Parsec makes recursive descent parsers as easy to use in Haskell as regexps are in Perl. No reason not to expose newcomers to Haskell to the thing it does best. jcc

Re: [Haskell-cafe] Re: Interesting new user perspective

2008-10-11 Thread Iain Barnett
On 11 Oct 2008, at 6:34 pm, apfelmus wrote: Andrew Coppin wrote: Martin DeMello wrote: http://blog.moertel.com/articles/2006/10/18/a-type-based-solution- to-the-strings-problem is a brilliant example of a common workaday problem found in other languages, and solved elegantly in Haskell

Re: [Haskell-cafe] Re: Interesting new user perspective

2008-10-11 Thread Iain Barnett
On 11 Oct 2008, at 9:02 pm, Svein Ove Aas wrote: On Sat, Oct 11, 2008 at 9:30 PM, Iain Barnett [EMAIL PROTECTED] wrote: Personally, I use stored procedures with a database as they protect from sql injection attacks (unless you write some really stupid procedures). Isn't this what

Re: [Haskell-cafe] Constraints at construction

2008-10-12 Thread Iain Barnett
On 12 Oct 2008, at 9:28 pm, Henning Thielemann wrote: On Thu, 9 Oct 2008, Iain Barnett wrote: If I were to create an object in C#, for instance, I could add code to the constructor that might limit the type further e.g. public class Car { string model; int wheels