Re: [Haskell-cafe] New slogan for haskell.org

2007-11-26 Thread Thomas Davie
On 26 Nov 2007, at 15:50, Henning Thielemann wrote: On Mon, 26 Nov 2007, Thomas Davie wrote: On 26 Nov 2007, at 15:15, Henning Thielemann wrote: On Thu, 4 Oct 2007, Don Stewart wrote: The Haskell website has the rather strange motivational text: Haskell is a general purpose, purely

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Thomas Davie
main = do let b = 0 let c = randomRIO (1,2) until (c == 1) increment b return b This is intended to print the number of consecutive heads (i.e., 2) before the first tail, but I get the following error: ERROR StPetersburg.hs:8 - Type

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Thomas Davie
On 27 Nov 2007, at 14:44, David Menendez wrote: On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to read more, Are we? I thought Haskell.org

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-28 Thread Thomas Davie
On 28 Nov 2007, at 13:41, Ian Lynagh wrote: On Wed, Nov 28, 2007 at 09:27:39AM +0100, Thomas Schilling wrote: Sorry, but are you talking of *one* homepage? This can all go into own wiki pages that are aimed at certain audiences, but this really can't all fit on the front page. I'm

Re: [Haskell-cafe] What is the role of $!?

2007-11-28 Thread Thomas Davie
On 29 Nov 2007, at 06:32, PR Stanley wrote: Hi Thanks for the response. JCC: In most languages, if you have some expression E, and when the computer attempts to evaluate E it goes in to an infinite loop, then when the computer attempts to evaluate the expression f(E), it also goes into

Re: [Haskell-cafe] Re: Trees

2007-12-03 Thread Thomas Davie
One could alway store a node's depth at each node -- then you must search for u and v, creating a list of what nodes you found at each depth, and finally, simply compare the lists -- O(n) in the depth of u and v. Bob On 3 Dec 2007, at 08:40, apfelmus wrote: Adrian Neumann wrote: data

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Thomas Davie
On 17 Dec 2007, at 10:46, Nicholls, Mark wrote: I can obviously at a later date add a new class Triangle, and not have to touch any of the above code…. Yes, and you can indeed do a similar thing in Haskell. The natural thing to do here would be to define a type Shape... data Shape =

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Thomas Davie
On 17 Dec 2007, at 11:14, Nicholls, Mark wrote: OK I'll have to digest this and mess about a bitbut can I make an observation at this point If I define Shape like data Shape = Circle Int | Rectangle Int Int | Square Int Isn't this now closed...i.e. the

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Thomas Davie
On 17 Dec 2007, at 12:22, Nicholls, Mark wrote: Ok... Thanks I need to revisit data and newtype to work out what the difference is I think. Beware in doing so -- type, and newtype are not the same either. type creates a type synonim. That is, if I were to declare type Jam = Int then

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Thomas Davie
On 12 Jan 2008, at 23:16, Hugh Perkins wrote: On Jan 12, 2008 10:54 PM, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 12 Jan 2008, Hugh Perkins wrote: I guess that Haskell's referential transparence means the answers to the isPerfectSquare will be cached, ie automatically memoized?

Re: [Haskell-cafe] Hackape package lackage

2010-03-22 Thread Thomas Davie
I'd love to see that map normalised by the population of the country – would be interesting to see where Haskell is popular. Bob On 22 Mar 2010, at 16:22, Don Stewart wrote: We're watching *massive* traffic right now due to HP release. It's not down, just very very busy. For fun, here's a

Re: [Haskell-cafe] [OT?] Haskell-inspired functions for BASH

2010-04-01 Thread Thomas Davie
Unfortunately though, h4sh seems to be broken, for one, there's no fps package (apparently required), and hsplugins won't build with 6.12.1. Bob On 1 Apr 2010, at 15:41, Jeremy Shaw wrote: How about: http://www.cse.unsw.edu.au/~dons/h4sh.html It brings a lot of familiar Haskell

Re: [Haskell-cafe] Re: Haskellers hate GUIs!!

2010-04-02 Thread Thomas Davie
On 2 Apr 2010, at 21:01, Brandon S. Allbery KF8NH wrote: On Apr 2, 2010, at 15:21 , Thomas Schilling wrote: On 2 April 2010 20:15, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: On Apr 2, 2010, at 10:41 , David Leimbach wrote: Having said that, are there any plans to make it really easy

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Thomas Davie
On 7 Apr 2010, at 02:53, Ben Millwood wrote: On Wed, Apr 7, 2010 at 2:22 AM, Thomas Schilling nomin...@googlemail.com wrote: I have set a maximum width on purpose so that it doesn't degrade too badly on big screens. I've never really trusted this argument - it's not required that the

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
Your instances of Finite are not quite right: bottom :: a bottom = doSomethingToLoopInfinitely. instance Finite () where allValues = [(), bottom] instance Finite Nothing where allValues = [bottom] Though at a guess an allValuesExculdingBottom function is also useful, perhaps the class

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 08:29, Ashley Yakeley wrote: On Wed, 2010-04-14 at 08:13 +0100, Thomas Davie wrote: Your instances of Finite are not quite right: bottom :: a bottom = doSomethingToLoopInfinitely. instance Finite () where allValues = [(), bottom] Bottom is not a value, it's

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:01, Jonas Almström Duregård wrote: But if one did start considering bottom to be a value, one would have to distinguish different ones. For instance, (error ABC) vs. (error PQR). Obviously this is not finite. Nor is it computable, since it must distinguish terminating

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:08, Jonas Almström Duregård wrote: f,g :: Bool - Int f x = 6 g x = 6 We can in Haskell compute that these two functions are equal, without solving the halting problem. Of course, this is the nature of generally undecidable problems. They are decidable in some

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:12, Jonas Almström Duregård wrote: f,g :: Bool - Int f x = 6 g x = 6 We can in Haskell compute that these two functions are equal, without solving the halting problem. what about these? f,g :: Bool - Int f x = 6 g x = x `seq` 6 As pointed out on #haskell by

[Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:17, Ashley Yakeley wrote: Thomas Davie wrote: Certainly bottom is a value, and it's a value in *all* Haskell types. This is a matter of interpretation. If you consider bottom to be a value, then all the laws fail. For instance, (==) is supposed to be reflexive

[Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:25, Ashley Yakeley wrote: Thomas Davie wrote: Because we consider that the Functor laws must hold for all values in the type (including bottom). This is not so for IO, which is an instance of Functor. fmap id undefined is not bottom. It isn't? fPrelude fmap id

[Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:31, Ashley Yakeley wrote: On Wed, 2010-04-14 at 09:29 +0100, Thomas Davie wrote: It isn't? fPrelude fmap id (undefined :: IO ()) *** Exception: Prelude.undefined ghci is helpfully running the IO action for you. Try this: seq (fmap id (undefined :: IO

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:35, Jonas Almström Duregård wrote: what about these? f,g :: Bool - Int f x = 6 g x = x `seq` 6 As pointed out on #haskell by roconnor, we apparently don't care, this is a shame... We only care that x == y = f x == g y, and x == y can't tell if _|_ == _|_. So

[Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:39, Ashley Yakeley wrote: Thomas Davie wrote: I guess this further reinforces my point though – we have a mixture of places where we consider _|_ when considering laws, and places where we don't consider _|_. This surely needs better defined somewhere. It's easy

Re: [Haskell-cafe] help with Haskell programming

2010-04-18 Thread Thomas Davie
I'm not certain exactly what you mean, but I *think* you mean: func :: (a - Bool) - (a - Bool) func = (not .) Bob On 18 Apr 2010, at 16:35, Mujtaba Boori wrote: Hello I am kinda newbie in Haskell you can help help me with some programming I am trying to make function like for example

Re: [Haskell-cafe] Re: help with Haskell programming

2010-04-18 Thread Thomas Davie
To do this, you need not just fmap (composition), but also ap, or the combined form, liftA2: func = liftA2 (||) Bob On 18 Apr 2010, at 18:21, Keith Sheppard wrote: Using composition can be tricky with more than one arg. I just want to be sure you're not really looking for something like:

Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

2010-05-27 Thread Thomas Davie
On 27 May 2010, at 15:25, Ionut G. Stan wrote: Hi, I was just wondering if there's any particular reason for which the two constructors of the Either data type are named Left and Right. I'm thinking that something like Success | Failure or Right | Wrong would have been a little better.

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Thomas Davie
On 3 Jun 2010, at 16:14, Gabriel Riba wrote: Extending sum types with data constructors would spare runtime errors or exception control, when applying functions to inappropriate branches, as in the example ... data List a = Nil | Cons a (List a) -- List!Nil and List!Cons

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Thomas Davie
On 28 Jun 2010, at 09:38, José Romildo Malaquias wrote: Is there in Haskell a non monadic function of type a - a - Bool which test for physical equality of two values? It would return True if only if both values are the same object in memory. For instance: value1 = good value2 = good

Re: [Haskell-cafe] How easy is it to hire Haskell programmers

2010-07-03 Thread Thomas Davie
On 3 Jul 2010, at 03:39, Don Stewart wrote: ivan.miljenovic: Hmm, interesting. Applicative and Traversable are two classes I've never used and don't really understand the purpose of. I have no idea what hsc2hs is. I keep hearing finger trees mentioned, but only in connection to papers

Re: [Haskell-cafe] Are you a Haskell expert? [How easy is it to hire Haskell programmers]

2010-07-03 Thread Thomas Davie
On 3 Jul 2010, at 11:04, Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/3/10 05:57 , Andrew Coppin wrote: Agreed. So let me rephrase: Why should _every_ Haskell library involve C? ;-) Who says they do, or should? Dons rather implied it... The

Re: [Haskell-cafe] lists of arbitrary depth

2010-07-13 Thread Thomas Davie
On 13 Jul 2010, at 10:11, Shlomi Vaknin wrote: Thank you all for replying! I am really beginning my baby steps in this fascinating language, and was just wondering if it was possible to naturally scan lists with arbitrary lists (aka trees :) ). Trees aren't lists, Trees are trees...

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-01 Thread Thomas Davie
On 1 Aug 2010, at 11:43, Ertugrul Soeylemez wrote: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: No, a pure function is one without any side effects. There are no functions with side effects in Haskell, unless you use hacks like unsafePerformIO. Every Haskell function is

Re: [Haskell-cafe] Re: Exercise in point free-style

2006-09-01 Thread Thomas Davie
Shorter, although perhaps less insightful. Bob On 2 Sep 2006, at 01:36, Lennart Augustsson wrote: An easy way to solve this is to ask lambdabot. Log on to the Haskell IRC channel: lennart: @pl \ f l - l ++ map f l lambdabot: ap (++) . map Notice how it's much shorter than the Hughes'

Re: [Haskell-cafe] smallest double eps

2006-09-30 Thread Thomas Davie
On 30 Sep 2006, at 17:19, Brian Hulley wrote: Lennart Augustsson wrote: Hang on, hang on, now I'm getting confused. First you asked for the smallest (positive) x such that 1+x /= x which is around x=4.5e15. 1 + 0 /= 0 0 is smaller than 4.5e15 So I don't understand this at all... But

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Thomas Davie
It's true that this is the typical way of learning Haskell, but I for one think it's a bad way of learning Haskell. Very few real world programs get by without the impure stuff, so if you give the newbie the impression that it isn't there (by postponing it) there's a chance he'll run into a

Re: [Haskell-cafe] Win32 help please

2007-02-04 Thread Thomas Davie
On 4 Feb 2007, at 17:59, Stefan O'Rear wrote: On Sun, Feb 04, 2007 at 10:42:23PM +1100, John Ky wrote: # hsc2hs mywin32.hsc # ghc -fffi mywin32.hs C:/system/ghc/ghc-6.6/libHSrts.a(Main.o):Main.c:(.text+0x1b): undefined reference to `__stginit_ZCMain'

Re: [Haskell-cafe] Haskell and GUI

2008-01-14 Thread Thomas Davie
There's also the HOC (Haskell Objective-C bridge), which lets you use Apple's Cocoa APIs. Bob On 14 Jan 2008, at 22:09, Torsten Otto wrote: Seeing my woes with FranTk - what else is out there that people use if a (simple) GUI is desired for a Haskell app? Just a few textboxes and a

Re: [Haskell-cafe] Doubting Haskell

2008-02-22 Thread Thomas Davie
A quick note here. This is a *really* excellent tutorial on a variety of subjects. It shows how monad operators can be used responsibly (to clarify code, not obfuscate it), it shows how chosing a good data structure and a good algorithm can work wonders for your code, and on a simplistic

Re: [Haskell-cafe] Re: ANN: haskell-src-exts 0.3.2

2008-03-17 Thread Thomas Davie
On 17 Mar 2008, at 23:41, Niklas Broberg wrote: Could this be used to add support for refactoring of source files containing language extensions? Because if I'm correct, the current most popular refactoring solution (I forgot the name) for Haskell does not support extensions. I supppose

Re: [Haskell-cafe] monadic debugging

2008-04-15 Thread Thomas Davie
On 16 Apr 2008, at 00:04, Bulat Ziganshin wrote: Hello Vasili, Wednesday, April 16, 2008, 2:53:32 AM, you wrote: I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc. Which debugger is currently preferred for monadic

Re: [Haskell-cafe] Fw: I have a problem

2008-04-24 Thread Thomas Davie
First, I'd refer you to this list's rules on homework, and what people will or won't answer. Secondly to that though, rather than provide a solution, I'll give you an idea that may lead to you coming up with a solution. First, try and write a function that can test if your first list is

Re: [Haskell-cafe] unapplying function definitions?

2008-05-04 Thread Thomas Davie
On 4 May 2008, at 17:33, PR Stanley wrote: Hi What on earth is unapplying function definitions? The following is taken from chapter 13 of the Hutton book: ...when reasoning about programs, function definitions can be both applied from left to right and unapplied from right to left. Well,

Re: [Haskell-cafe] IO Help

2008-05-08 Thread Thomas Davie
On 8 May 2008, at 16:31, Mark Wallsgrove wrote: Was there? I have been google'ing that problem for ages.. Just one more thing. I have to make a menu system where the user chooses what functionality they want. Because you cannot change a value once it is set I have used recursion so that

Re: [Haskell-cafe] inserting values in a binary tree

2008-05-09 Thread Thomas Davie
On 10 May 2008, at 00:35, PR Stanley wrote: Hi data Ord a = Tree a = Nil | Node (Tree a) a (Tree a) How would one go about inserting a value in a binary search tree of the above description? All you need to do is consider what the trees should look like in the two cases: If I try and

Re: [Haskell-cafe] Type Coercion

2008-05-28 Thread Thomas Davie
On 28 May 2008, at 09:34, PR Stanley wrote: Hi (16 :: Float) is a perfectly legitimate statement although I'm surprised that it's allowed in a type strong language such as Haskell. It's a bit like casting in good old C. What's going on here? It's not a coercion -- it happens at compile

Re: [Haskell-cafe] modelling C in Haskell ..

2008-05-30 Thread Thomas Davie
Yes, you must write them seperately as something like data A = A Int B data B = B1 Int | B2 Int Int one of the many wonders of Haskell -- it encourages you to split up your code into nice small chunks. Bob On 30 May 2008, at 08:46, Galchin, Vasili wrote: Hello, I don't want

Re: [Haskell-cafe] automatically deriving Map and Filter on datatypes etc.

2008-06-05 Thread Thomas Davie
Even deriving an instance of Functor seems rather implausable, what should it do for data Wierd a b = Nil | A a (Wierd a b) | B b (Wierd a b) Should fmap's function argument operate on 'a's, 'b's, or both? Bob On 5 Jun 2008, at 10:28, Miguel Mitrofanov wrote: Well, it's certainly not

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Thomas Davie
On 14 Jun 2008, at 12:45, Christoph Bauer wrote: Hi All, Topkata is a simple OpenGL Game written in Haskell. It's not very advanced. Goal so far is to guide a ball trough an labyrinth to the opposite corner. The web page shows an screenshot. It's only tested under Linux.

Re: [Haskell-cafe] ANN: Topkata

2008-06-15 Thread Thomas Davie
On 15 Jun 2008, at 07:41, Deborah Goldsmith wrote: On Jun 14, 2008, at 1:06 PM, Don Stewart wrote: tom.davie: In the mean time -- who knows enough to make ghc target ARM, and get this to link against the iPhone libraries? This would be quite a coup if it could be made to run there! I'd

Re: [Haskell-cafe] Re: How to do this in FP way?

2008-06-16 Thread Thomas Davie
One half of all Haskell coders will tell you that mutable state isn't a good starting point to learn Haskell, the other half will tell you the same because they want to be cool kids, too. And the one left over will point out that he asked how to do this the FP way, not the imperative way?

Re: [Haskell-cafe] Re: How to do this in FP way?

2008-06-16 Thread Thomas Davie
On 16 Jun 2008, at 18:28, Achim Schneider wrote: Thomas Davie [EMAIL PROTECTED] wrote: One half of all Haskell coders will tell you that mutable state isn't a good starting point to learn Haskell, the other half will tell you the same because they want to be cool kids, too. And the one

Re: [Haskell-cafe] Re: How to do this in FP way?

2008-06-16 Thread Thomas Davie
On 16 Jun 2008, at 19:24, Achim Schneider wrote: Thomas Davie [EMAIL PROTECTED] wrote: On 16 Jun 2008, at 18:28, Achim Schneider wrote: Thomas Davie [EMAIL PROTECTED] wrote: One half of all Haskell coders will tell you that mutable state isn't a good starting point to learn Haskell

Re: [Haskell-cafe] Qualified import syntax badly designed (?)

2008-07-09 Thread Thomas Davie
I think a better design for namespacing might be: import Data.Map as M implicit (Map) import Data.Map as M explicit (lookup) Why 'implicit' and 'explicit'? Do you mean something like 'include' and 'exclude'? To me at least, implicit and explicit make more sense. I don't want to exclude

Re: [Haskell-cafe] Data.Derive problems

2008-07-10 Thread Thomas Davie
On 10 Jul 2008, at 21:25, Ron Alford wrote: On Thu, Jul 10, 2008 at 3:18 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi Ron, I'm using GHC 6.8.3 with $ cabal --version cabal-install version 0.5.1 using version 1.4.0.1 of the Cabal library I installed Data.Derive from hackage, only to be

Re: [Haskell-cafe] a newbie's question

2005-04-21 Thread Thomas Davie
On Apr 21, 2005, at 3:47 PM, SCOTT J. wrote: Hi, I'm beginning to study Haskell, For the following a = [1,2,3] b = there do x - a y - b return (x , y) Winhugs cannot run it. Gives Syntax error in input (unexpected backslash ( lambda)) Your problem is that you're using monads to grab

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Thomas Davie
No, it introduces a variable of type array of 50 ints, which can be converted to pointer to int. It matters when you make a pointer of such arrays, an array of such arrays, or sizeof such array. In C++ the size can be matched by template parameter, and you can have separate overloadings for

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Thomas Davie
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote: Thomas Davie [EMAIL PROTECTED] writes: I'm not familiar with your C++ example (not being familiar with C++), but I think that it's a bit of a stretch of the imagination to say that C introduces a variable of type array of 50 ints

Re: [Haskell-cafe] Compiling with NHC98

2005-05-07 Thread Thomas Davie
Incidentally, if you aren't already familiar with make or some other build system, I strongly recommend looking into one. Even for a project with only two files, having a build system keep track of compilation dependencies makes things a lot less tedious. In random addition to this... hmake will

[Haskell-cafe] Type system extension

2005-05-15 Thread Thomas Davie
Hi, I'd just been writing some code and an interesting idea for an extension to Haskell's type system sprang into my head. I have no idea if people have played with it, but it looked vaguely useful to me, so I thought I'd see what everyone else thought. Supposing you have these types:

Re: [Haskell-cafe] Type system extension

2005-05-15 Thread Thomas Davie
On May 16, 2005, at 12:46 AM, Neil Mitchell wrote: Hi, Yes, sounds like a good idea. I'm not sure the right approach is to make the user give this information though - the code will very likely be something like doSomethingToAModule (SModule a b) = f a b from which you can derive the type

[Haskell-cafe] Type extensions

2005-06-01 Thread Thomas Davie
Hi, I was wondering if I hat missed something and it was possible to do this within the Haskell type system or not... Essentially I would like some sort of inderritance property for Haskell types, I often find myself wanting to for example extend a tree with black/white colouring, or

Re: [Haskell-cafe] Type extensions

2005-06-01 Thread Thomas Davie
On 1 Jun 2005, at 15:54, Henning Thielemann wrote: On Wed, 1 Jun 2005, Thomas Davie wrote: Hi, I was wondering if I hat missed something and it was possible to do this within the Haskell type system or not... Essentially I would like some sort of inderritance property for Haskell types

Re: [Haskell-cafe] Monadic vs pure style (was: pros and cons of sta tic typing and side effects)

2005-08-30 Thread Thomas Davie
On Aug 30, 2005, at 12:13 PM, Bayley, Alistair wrote:From: Duncan Coutts [mailto:[EMAIL PROTECTED]] This is often a misconception, that just because you find you need to'do' something in the middle of your algorithm, that you need to convert it wholly to monadic style. Yes. However, Wadler makes a

Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Thomas Davie
On 13 Sep 2005, at 14:45, Dhaemon wrote: Hello, I'm quite interested in haskell, but there is something I don't understand(intuitively). I've been crawling the web for an answer, but nothing talks to me... So I was hoping I could find some help here: How is evaluating an expression

Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Thomas Davie
On 13 Sep 2005, at 16:22, David Roundy wrote: On Tue, Sep 13, 2005 at 01:45:52PM +, Dhaemon wrote: Also, just for kicks, may I had this: I read the code of some haskell-made programs and was astonished. Yes! It was clean and all, but there were dos everywhere... Why use a function

Re: [Haskell-cafe] newbe question

2005-09-27 Thread Thomas Davie
The reason is that you can define =- as on operator so for example, in this (obfuscated) code: (=-) x y = x * y sq y = y =- y Thus, in your code, you had an operator on the LHS of the definition, and the interpreter baulked at it. Bob On 27 Sep 2005, at 10:34, [EMAIL PROTECTED] wrote:

Re: [Haskell-cafe] newbe question

2005-09-27 Thread Thomas Davie
On 27 Sep 2005, at 16:53, [EMAIL PROTECTED] wrote: On 27 Sep, Wolfgang Jeltsch wrote: Hello, obviously, Hugs thinks that =- is a special operator. In Haskell you have the ability to define your own operators, so it would be possible to define an operator =-. I would suggest that

Re: [Haskell-cafe] how to break foldl' ?

2005-09-30 Thread Thomas Davie
On 30 Sep 2005, at 11:33, gary ng wrote: Hi, say if I want to sum a list of numbers but only until it hits a max limit. Currently, I control it through the function and basically do nothing when the max is hit. However, if the list is very long, would this mean the same function would be

Re: [Haskell-cafe] how to break foldl' ?

2005-09-30 Thread Thomas Davie
Again, it depends how takeWhile is implemented -- if it's not tail recursive, the compiler will usually manage to run such functions in constant space. Bob On 30 Sep 2005, at 16:02, gary ng wrote: Once again, many thanks to all who taught me about this small little problem. Don't even

Re: [Haskell-cafe] file i/o

2006-01-03 Thread Thomas Davie
The other thing to mention, is that if you have the ability to change file formats, it may be better to make just a slight adjustment... If you make it look exactly like the haskell data structure you want: [(Foo, [1,2,3,4,5,6,7]) ,(Bar, [7,6,5,4,3,2,1]) ,...] Then your parser becomes even

Re: [Haskell-cafe] Re: Can I use Haskell for web programming

2006-01-21 Thread Thomas Davie
On Jan 21, 2006, at 8:34 PM, Maurício wrote: They both look cool. Do you think I'll be able to find someone to host professional sites using those libraries? [], Maurício Try http://contextshift.co.uk/vps.html ... or I guess any other virtual server hosts, but they're cheep

Re: [Haskell-cafe] Lists of Lists

2006-03-08 Thread Thomas Davie
On 8 Mar 2006, at 14:21, zell_ffhut wrote: Thank you, It's working as planed now Trying to do a function now that changes the value of an element of the list. In programming languages i've used in the past, this would be done somthing like - changeValue x i [xs] = [xs] !! i = x

Re: [Haskell-cafe] Porting GHC to OSX86?

2006-03-22 Thread Thomas Davie
On Mar 21, 2006, at 8:09 PM, Deling Ren wrote: Hi there, Has anyone made any attempt to port GHC to Mac OS X on x86? Wolfgang Thaller’s binary package runs over Rosetta but slow (not surprising). It can not be used to compile a native version either (I got some errors related to machine

Re: [Haskell-cafe] Re: Editors for Haskell

2006-05-25 Thread Thomas Davie
On May 25, 2006, at 6:14 PM, Jeremy O'Donoghue wrote: Hi Walt, I'm using Haskell (GHC and Hugs) on several different platforms. Windows, OS X and Linux systems. Assuming that you want your students to be able to use any of the above platforms, the only options I know of which work well on

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Thomas Davie
On 11 Aug 2010, at 12:39, Ertugrul Soeylemez wrote: Martijn van Steenbergen mart...@van.steenbergen.nl wrote: On 8/2/10 7:09, Ertugrul Soeylemez wrote: Given the definition of a Haskell function, Haskell is a pure language. The notion of a function in other languages is not: int

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Thomas Davie
On 11 Aug 2010, at 14:17, Ertugrul Soeylemez wrote: There is a fundamental difference between an IO computation's result and a Haskell function's result. The IO computation is simply a value, not a function. That's a rather odd distinction to make – a function is simply a value in a

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Thomas Davie
On 26 Aug 2010, at 08:01, michael rice wrote: Hmm... it was my understanding that the example was showing how to *avoid* having to create a lot of functions that do the same thing but have different numbers of arguments. From the Wiki page: Anytime you feel the need to define

Re: [Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Thomas Davie
On 13 Sep 2010, at 10:28, Gleb Alexeyev wrote: On 09/13/2010 12:23 PM, Michael Lazarev wrote: 2010/9/13 Henning Thielemannlemm...@henning-thielemann.de: It means that variables bound by let, may be instantiated to different types later. Can you give an example, please? testOk = let f =

Re: [Haskell-cafe] Generating arbitrary functions with QuickCheck?

2010-09-15 Thread Thomas Davie
On 15 Sep 2010, at 16:29, Matias Eyzaguirre wrote: Hi, I'v been reading a small paper/lesson on writing parser combinators in Haskell, and it seems more or less straightforward. In this case a parser is defined thusly: type Parser a = String - Maybe (a, String) And then it goes on to

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocolimplementation

2010-10-11 Thread Thomas Davie
While I agree with the potential benefits, I also worry that you will end up making something that is far less well tested in practice. For widely used and fairly low-level libraries like gnutls, openssl and zlib, I'm just skeptical that the benefits outweigh the risks and costs. Anyway,

Re: [Haskell-cafe] Serialization of (a - b) and IO a

2010-11-11 Thread Thomas Davie
On 11 Nov 2010, at 08:36, Luke Palmer wrote: On Thu, Nov 11, 2010 at 12:53 AM, Jesse Schalken jesseschal...@gmail.com wrote: I have had a look at hs-plugins, but it is unclear how to derive a simple pair of functions `(a - b) - ByteString` and `ByteString - Either ParseError (a - b)`, for

Re: [Haskell-cafe] Why is Haskell flagging this?

2010-12-18 Thread Thomas Davie
On 17 Dec 2010, at 21:44, Christopher Done wrote: On 17 December 2010 18:04, michael rice nowg...@yahoo.com wrote: === f :: [Int] - IO [Int] f lst = do return lst main = do let lst = f [1,2,3,4,5] fmap (+1) lst The problem is that you are applying fmap to

Re: [Haskell-cafe] GHC optimizations and unsafePerformIO - Was: Data.Typeable TypeRep Ord instance.

2011-01-01 Thread Thomas Davie
On 1 Jan 2011, at 12:38, Andreas Baldeau wrote: Thinking about this there might be one problem: Without having looked further into this I think perfomance might not be as expected. Using unsafePerformIO affects ghc's optimzations, doesn't it? So I wonder if it's a good idea (from a

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-18 Thread Thomas Davie
On 18 Apr 2009, at 22:44, Antoine Latter wrote: On Sat, Apr 18, 2009 at 9:03 AM, a...@cs.uu.nl wrote: Utrecht Haskell Compiler -- first release, version 1.0.0 The UHC team is happy to announce the first public

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-18 Thread Thomas Davie
On 19 Apr 2009, at 00:31, Antoine Latter wrote: On Sat, Apr 18, 2009 at 4:38 PM, Thomas Davie tom.da...@gmail.com wrote: This looks like the same error I got – see bug report 1 in the bug database – the configure script reports that you have uuagc even if you don't – cabal install

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Thomas Davie
On 19 Apr 2009, at 09:52, Duncan Coutts wrote: On Sun, 2009-04-19 at 00:41 +0200, Thomas Davie wrote: Apparently a user install of uuagc and fgl isn't good enough. Fun to know. I've found user installs don't work at all on OS X, various people in #haskell were rather surprised to discover

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Thomas Davie
On 19 Apr 2009, at 11:10, Duncan Coutts wrote: On Sun, 2009-04-19 at 10:02 +0200, Thomas Davie wrote: It really rather makes cabal install rather odd – because it doesn't actually install anything you can use without providing extra options! It should work fine, you'll need to give more

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Thomas Davie
I don't understand what makes user installs more convenient. Certainly, my preference would be for global all the time – I expect something that says it's going to install something to install it onto my computer, like any other installation program does. What is it that makes user

Re: [Haskell-cafe] Optimizing unamb by determining the state of a thunk?

2009-04-20 Thread Thomas Davie
On 20 Apr 2009, at 09:41, Peter Verswyvelen wrote: I was wandering if it would be possible to optimize unamb by checking if a value is already evaluated to head normal form. So f `unamb` g would then be extremely fast if either f or g is already evaluated to head normal form. Maybe

Re: [Haskell-cafe] Optimizing unamb by determining the state of a thunk?

2009-04-20 Thread Thomas Davie
On 20 Apr 2009, at 10:57, Peter Verswyvelen wrote: On Mon, Apr 20, 2009 at 10:23 AM, Thomas Davie tom.da...@gmail.com wrote: Really? Is it any less referentially transparent than unamb already is - i.e. it's referentially transparent, as long as the two values really are equal. I think

[Haskell-cafe] Cabal's default install location

2009-04-21 Thread Thomas Davie
There seems to be an assumption amongst the community that a user's home directory is the most useful place for cabal to install to by default. A few people have challenged that. I wanted to find out which one most people do actually prefer, so please go and vote on this poll.

Re: [Haskell-cafe] Being impure within a 'pure' function

2009-04-22 Thread Thomas Davie
On 22 Apr 2009, at 10:38, Daniel K. wrote: Hello, imagine the following situation: You want to implement e.g. Dijkstra's algorithm to find a shortest path between nodes u and v in a graph. This algorithm relies heavily on mutating arrays, so the type signature would look something like

[Haskell-cafe] Re: Cabal's default install location

2009-04-23 Thread Thomas Davie
[Moved from the UHC thread – lets stop treading on those guys toes, they did something very very shiny] On 23 Apr 2009, at 07:02, Richard O'Keefe wrote: It's irrelevant, because I _do_ have root access to my machine, How nice to be you. Since the argument is entirely about people who

Re: [Haskell-cafe] Re: Cabal's default install location

2009-04-23 Thread Thomas Davie
The results in the poll seem to have stabilised now, so I'll tell you what happened... For user installs: 103 For global installs: 52 Others: 9 Interesting Ideas: • Claus made the suggestion that there be no default, instead that cabal asks you which you prefer the

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-23 Thread Thomas Davie
On 23 Apr 2009, at 10:02, Matthijs Kooijman wrote: Some material I've read on typography -- can't find the reference now -- suggests ~65 is the best number of characters per line. The advice was, if your page is larger than that, you should make columns. That fits my observations. In

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Thomas Davie
On 25 Apr 2009, at 10:51, Daniel Fischer wrote: Am Samstag 25 April 2009 08:48:16 schrieb Thomas Davie: On 24 Apr 2009, at 14:37, Loup Vaillant wrote: 2009/4/23 Miguel Mitrofanov miguelim...@yandex.ru: On 23 Apr 2009, at 12:17, Thomas Davie wrote: Haskell is a very horizontal language

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Thomas Davie
On 25 Apr 2009, at 21:09, Jason Dusek wrote: There will always be some people who prefer longer lines. The real issue is, how do we deal with the fundamental disagreement here? It's not like we can have both. Also those people who like long lines -- will they all agree to a long line

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Davie
On 4 May 2009, at 23:15, Thomas Hartman wrote: {-# LANGUAGE NoMonomorphismRestriction #-} import Data.List import Control.Monad import Control.Applicative -- Can the function below be tweaked to quit on blank input, provisioned in the applicative style? -- which function(s) needs to be

Re: [Haskell-cafe] How to understand the fmap here ?

2009-05-05 Thread Thomas Davie
On 5 May 2009, at 11:27, z_axis wrote: The following code snippets is from xmonad: -- Given a window, find the screen it is located on, and compute -- the geometry of that window wrt. that screen. floatLocation :: Window - X (ScreenId, W.RationalRect) --... rr - snd `fmap` floatLocation w

  1   2   3   >