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

2008-01-13 Thread apfelmus
Henning Thielemann wrote: David Benbennick wrote: But how can I implement memoization for a more complicated function? For example, perhaps I want to memoize f :: String - Int - Double - String - Bool There was a long thread about a sophisticated technique called blue prints, which allows

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

2008-01-13 Thread apfelmus
Luke Palmer wrote: David Benbennick wrote: It would be nice if I could just tell the compiler I command you to memoize this function, and have it produce the required code automatically. Tru dat! But it's not clear what the best way for the compiler writer to do that is. For example, if I

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

2008-01-13 Thread jerzy . karczmarczuk
Henning Thielemann writes: Caching is not the default, but you can easily code this by yourself: Define an array and initialize it with all function values. Because of lazy evaluation the function values are computed only when they are requested and then they persist in the array. One should

Re: [Haskell-cafe] Solving a geometry problem with Haskell

2008-01-13 Thread Rafael Almeida
On Sat, 12 Jan 2008 23:36:43 +0100, Daniel Fischer [EMAIL PROTECTED] wrote: Am Samstag, 12. Januar 2008 22:48 schrieb Luke Palmer: On Jan 12, 2008 9:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote: After some profiling I found out that about 94% of the execution time is spent in the

Re: AW: [Haskell-cafe] Solving a geometry problem with Haskell

2008-01-13 Thread Rafael Almeida
On Sun, 13 Jan 2008 11:48:09 +0100, Nicu Ionita [EMAIL PROTECTED] wrote: Hi Rafael, I have just two ideas, that could improve your strategy to reduce the computation time: 1. perhaps there is also a minimum (not only a maximul) for the values you should try Yeah, that's a good one, the

[Haskell-cafe] Access to list

2008-01-13 Thread Fernando Rodriguez
Hi, If I define the follwoing functions: car (x:_) = x car [] = [] cdr (_:xs) = xs cdr [] = [] and try to apply them to some list, such as car [1,2,3] I get this odd error: interactive:1:9: No instance for (Num [a]) arising from the literal `3' at interactive:1:9 Possible fix:

Re: [Haskell-cafe] Access to list

2008-01-13 Thread jerzy . karczmarczuk
Fernando Rodriguez writes: car (x:_) = x car [] = [] ... and try to apply them to some list, such as car [1,2,3] I get this odd error: No instance for (Num [a]) arising from the literal `3' ... The error is really a bit cryptic (who cares, Nums or whatever...) but the error is

Re: [Haskell-cafe] Access to list

2008-01-13 Thread Jed Brown
On 13 Jan 2008, [EMAIL PROTECTED] wrote: If I define the follwoing functions: car (x:_) = x car [] = [] This won't typecheck. It helps to add a type signature car :: [a] - a The first element of an empty list is undefined, so you can do what Prelude.head does and write: car [] =

Re: [Haskell-cafe] Access to list

2008-01-13 Thread Tom Phoenix
On Jan 13, 2008 7:55 AM, Fernando Rodriguez [EMAIL PROTECTED] wrote: If I define the follwoing functions: car (x:_) = x car [] = [] What's the type signature for that function? Cheers! --Tom Phoenix ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Access to list

2008-01-13 Thread Felipe Lessa
On Jan 13, 2008 2:07 PM, Tom Phoenix [EMAIL PROTECTED] wrote: On Jan 13, 2008 7:55 AM, Fernando Rodriguez [EMAIL PROTECTED] wrote: If I define the follwoing functions: car (x:_) = x car [] = [] What's the type signature for that function? car :: [[a]] - [a] -- Felipe.

Re: [Haskell-cafe] Access to list

2008-01-13 Thread jerzy . karczmarczuk
Jed Brown writes: On 13 Jan 2008, [EMAIL PROTECTED] wrote: If I define the follwoing functions: car (x:_) = x car [] = [] This won't typecheck. It helps to add a type signature car :: [a] - a Good will, wrong diagnosis. This WILL check. car :: forall a. [[a]] - [a] J.

[Haskell-cafe] MonadPrompt + Gtk2Hs = ?

2008-01-13 Thread Felipe Lessa
(This e-mail is a literate Haskell file.) Ryan Ingram enlightened us with MonadPrompt as a very nice abstraction for turn-based games, allowing easy programming and testing. http://www.mail-archive.com/haskell-cafe@haskell.org/msg33040.html http://ryani.freeshell.org/haskell/ I wonder how

Re: [Haskell-cafe] MonadPrompt + Gtk2Hs = ?

2008-01-13 Thread Duncan Coutts
On Sun, 2008-01-13 at 14:53 -0200, Felipe Lessa wrote: Problem solved? Not really: - This kind of implementation hides lots of subtle bugs. For example, because of postGUIAsync being used in Print case, the user will see multiple dialog boxes at once and -- strangely enough -- he'll

[Haskell-cafe] Possibility to port vshaskell to VS2008?

2008-01-13 Thread Philipp Riemer
Because my university is in the MSNDAA-program I could download the new Visual Studio 2008 Professional, what I've done today. Now I tried to install the vshaskell-extension to start learning Haskell but the installer only quits with the message that (of course) VS2005 is not installed. Now is my

Re: [Haskell-cafe] MonadPrompt + Gtk2Hs = ?

2008-01-13 Thread Felipe Lessa
On Jan 13, 2008 4:01 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Sun, 2008-01-13 at 14:53 -0200, Felipe Lessa wrote: You could use another thread :-) LOL, at first I thought of mail threads =). That is have an output thread that reads a queue from your game engine and only looks for the

[Haskell-cafe] Patterns overlapped?

2008-01-13 Thread Fernando Rodriguez
Hi, When I compile this code, ghc complains about some overlapped patterns in function depth. What on Earth is ghc talking about? O:-) data BinTree a = EmptyTree | NodeBT a (BinTree a) (BinTree a) deriving Show emptyBT = EmptyTree depth emptyBT = 0

Re: [Haskell-cafe] Patterns overlapped?

2008-01-13 Thread Brandon S. Allbery KF8NH
On Jan 13, 2008, at 13:59 , Fernando Rodriguez wrote: When I compile this code, ghc complains about some overlapped patterns in function depth. What on Earth is ghc talking about? O:-) emptyBT = EmptyTree depth emptyBT = 0 depth (NodeBT _ left right) = max (1 + depth left) (1 + depth

[Haskell-cafe] Re: Patterns overlapped?

2008-01-13 Thread Fernando Rodriguez
Hello Fernando, Hi, When I compile this code, ghc complains about some overlapped patterns in function depth. What on Earth is ghc talking about? O:-) data BinTree a = EmptyTree | NodeBT a (BinTree a) (BinTree a) deriving Show emptyBT = EmptyTree depth emptyBT = 0 depth (NodeBT _ left right)

Re: [Haskell-cafe] Re: Patterns overlapped?

2008-01-13 Thread Brandon S. Allbery KF8NH
On Jan 13, 2008, at 14:05 , Fernando Rodriguez wrote: depth emptyBT = 0 depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right) Sorry, the exact error is: Warning: Pattern match(es) are overlapped In the definition of `depth': depth (NodeBT _ left right) = ...

Re: [Haskell-cafe] Patterns overlapped?

2008-01-13 Thread jerzy . karczmarczuk
Fernando Rodriguez writes: What on Earth is ghc talking about? O:-) (overlapping paterns) emptyBT = EmptyTree depth emptyBT = 0 depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right) GHC is always right... Your first clause is GENERIC,

[Haskell-cafe] Re: Patterns overlapped?

2008-01-13 Thread Fernando Rodriguez
Hello Brandon S. Allbery KF8NH, depth emptyBT = 0 depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right) If you use a variable in a pattern match, it creates a new binding which irrefutably matches the corresponding argument. In other words, you get a new local variable emptyBT,

[Haskell-cafe] Re: Patterns overlapped?

2008-01-13 Thread jerzy . karczmarczuk
Brian Sniffen writes: [[send to me as a private message, probably by mistake]] Or, if you really want to use emptyBT for some reason, with depth x | x == emptyBT = 0 -- Brian T. Sniffen OK, but then it is necessary to define the Eq instance for the trees Jerzy Karczmarczuk

Re: [Haskell-cafe] MonadPrompt + Gtk2Hs = ?

2008-01-13 Thread Duncan Coutts
On Sun, 2008-01-13 at 16:37 -0200, Felipe Lessa wrote: On Jan 13, 2008 4:01 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Sun, 2008-01-13 at 14:53 -0200, Felipe Lessa wrote: Are you linking using -threaded or not? If not then you need another trick to use cooperative scheduling between

[Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Hugh Perkins
What are the possibilities for website construction using Haskell? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Derek Elkins
On Sun, 2008-01-13 at 20:59 +0100, Hugh Perkins wrote: What are the possibilities for website construction using Haskell? http://hackage.haskell.org/packages/archive/pkg-list.html http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming I'm sure you can figure it out from

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Hugh Perkins
On Jan 13, 2008 8:13 PM, Derek Elkins [EMAIL PROTECTED] wrote: http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming Good link. Lots of options apparently :-) I'm sure you can figure it out from here, or at least come back with a more specific question. Which ones

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Don Stewart
hughperkins: On Jan 13, 2008 8:13 PM, Derek Elkins [EMAIL PROTECTED] wrote: http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming Good link. Lots of options apparently :-) I'm sure you can figure it out from here, or at least come back with a more specific

[Haskell-cafe] Re: MonadPrompt + Gtk2Hs = ?

2008-01-13 Thread apfelmus
Felipe Lessa wrote: (abridged) Ryan Ingram enlightened us with MonadPrompt as a very nice abstraction for turn-based games, allowing easy programming and testing. I wonder how nicely it fits on a Gtk2Hs application. =) The problem lies in the fact that Gtk is event-driven, so every time we ask

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Neil Mitchell
Hi Which ones are most widely used? HWS and Wash Server Pages sounds interesting? Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions (http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/) My academic website (http://www-users.cs.york.ac.uk/~ndm/) uses some custom code

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Don Stewart
ndmitchell: Hi Which ones are most widely used? HWS and Wash Server Pages sounds interesting? Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions (http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/) I thought haskell-src-exts was an extended Language.Haskell

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Neil Mitchell
Hi Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions (http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/) I thought haskell-src-exts was an extended Language.Haskell parser? Do you mean HSP -- haskell server pages? No, I mean haskell-src-exts. It's a translator from

[Haskell-cafe] hash-cons

2008-01-13 Thread Tony Finch
I've been thinking about hashlife recently. I've written part of a fairly didactic C implementation http://dotat.at/prog/misc/hashlife.c but I there are more interesting things that can be done with it. In particular, the core calc2() function is essentially implementing lazy evaluation, so it

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Don Stewart
ndmitchell: Hi Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions (http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/) I thought haskell-src-exts was an extended Language.Haskell parser? Do you mean HSP -- haskell server pages? No, I mean haskell-src-exts. It's

Re: [Haskell-cafe] Possibility to port vshaskell to VS2008?

2008-01-13 Thread Peter Verswyvelen
It might be even better to port it to the freely available downloadable Visual Studio Shell: http://msdn2.microsoft.com/en-us/vsx2008/products/bb933751.aspx The F# plugin works for that environment, giving a very good free IDE. Cheers, Peter (on Fedora 8 using, woohoo, my first steps on Linux :)

[Haskell-Cafe] Add number of downloads to hackageDB page?

2008-01-13 Thread Hugh Perkins
I seem to remember a thread about this a while back actually, but... Any chance of adding the number of downloads to the hackageDB page? For those packages that are included in ghc, hugs etc, perhaps add a green tick with included in ghc, included in hugs, etc? That way it should be relatively

Re: [Haskell-cafe] Possibilities for website construction using Haskell?

2008-01-13 Thread Anton van Straaten
Don Stewart wrote: Note that using string overloading we can remove some of the toHtml's... {-# LANGUAGE OverloadedStrings #-} instance IsString Html where fromString = toHtml main = do time - getClockTime putStrLn . prettyHtml $ (header (thetitle testing))

[Haskell-cafe] Yi editor tutorial

2008-01-13 Thread Andrew Birkett
Hi, I've recently started using Yi, the haskell editor. I found it slightly non-trivial to get started, so I've written up my installation method and a beginners guide tutorial which I hope will be of interest to other people who'd like to try Yi. It lives at:

[Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Neil Mitchell
Hi, It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different arities, and its rejected by Haskell. Why does this not simply desugar to: f [] = [1] f x =

Re: [Haskell-Cafe] Add number of downloads to hackageDB page?

2008-01-13 Thread Duncan Coutts
On Sun, 2008-01-13 at 23:18 +0100, Hugh Perkins wrote: I seem to remember a thread about this a while back actually, but... Any chance of adding the number of downloads to the hackageDB page? For those packages that are included in ghc, hugs etc, perhaps add a green tick with included in

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Conal Elliott
That eta-expansion desugaring would lose sharing. Offhand, I don't know of a desugaring that would do the trick and preserve sharing. Any ideas? - Conal On Jan 13, 2008 3:12 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread ajb
G'day all. Quoting Neil Mitchell [EMAIL PROTECTED]: It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different arities, and its rejected by Haskell. I

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread ajb
G'day all. Quoting Conal Elliott [EMAIL PROTECTED]: That eta-expansion desugaring would lose sharing. Offhand, I don't know of a desugaring that would do the trick and preserve sharing. Any ideas? How about this? f = let body = sort . nub in \xs - case xs of [] - [1]

Re: [Haskell-cafe] Re: 0/0 1 == False

2008-01-13 Thread Jonathan Cast
On 11 Jan 2008, at 11:25 PM, Achim Schneider wrote: Jonathan Cast [EMAIL PROTECTED] wrote: On 11 Jan 2008, at 10:12 AM, Achim Schneider wrote: David Roundy [EMAIL PROTECTED] wrote: Prelude let x=1e-300/1e300 Prelude x 0.0 Prelude x/x NaN The true answer here is that x/x == 1.0 (not 0 or

[Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Achim Schneider
Neil Mitchell [EMAIL PROTECTED] wrote: i.e. lift the arities to the longest argument list. Is there a reason this isn't done? Most likely not, there are being made up right now. Because f = sort.nub is different from f x = (\x - sort.nub x) or f = sort.nub.id or f =

[Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Achim Schneider
Achim Schneider [EMAIL PROTECTED] wrote: Most likely not, there are being made up right now. s/there/they/ f x = (\x - sort.nub x) s/x// -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying,

Re: [Haskell-cafe] Re: 0/0 1 == False

2008-01-13 Thread Jonathan Cast
On 12 Jan 2008, at 3:23 AM, Kalman Noel wrote: Achim Schneider wrote: Actually, lim( 0 ) * lim( inf ) isn't anything but equals one, and the anything is defined to one (or, rather, is _one_ anything) to be able to use the abstraction. It's a bit like the difference between eight pens and a box

Re: [Haskell-cafe] Re: 0/0 1 == False

2008-01-13 Thread Jonathan Cast
On 12 Jan 2008, at 3:33 AM, Cristian Baboi wrote: On Sat, 12 Jan 2008 13:23:41 +0200, Kalman Noel [EMAIL PROTECTED] wrote: Achim Schneider wrote: Actually, lim( 0 ) * lim( inf ) isn't anything but equals one, and the anything is defined to one (or, rather, is _one_ anything) to be able to

Re: [Haskell-cafe] Re: 0/0 1 == False

2008-01-13 Thread Jonathan Cast
On 12 Jan 2008, at 4:06 AM, Achim Schneider wrote: Kalman Noel [EMAIL PROTECTED] wrote: Achim Schneider wrote: Actually, lim( 0 ) * lim( inf ) isn't anything but equals one, and the anything is defined to one (or, rather, is _one_ anything) to be able to use the abstraction. It's a bit like

Re: [Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Jonathan Cast
On 13 Jan 2008, at 4:15 PM, Achim Schneider wrote: Neil Mitchell [EMAIL PROTECTED] wrote: i.e. lift the arities to the longest argument list. Is there a reason this isn't done? Most likely not, there are being made up right now. I'm glad you are capable of ever so nobly assigning the

[Haskell-cafe] jumping to code every and anywhere : what about installing tagfile and source ?

2008-01-13 Thread Marc Weber
I feel this is the right place to think about this? (I'll crosspost a small announcement on ghc as well pointing to this thread) Copied from http://hackage.haskell.org/trac/hackage/ticket/207#preview: == Introduction == I personally depend on tags because the source code only tells what is

[Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Jonathan Cast
On 13 Jan 2008, at 4:56 PM, [EMAIL PROTECTED] wrote: Jonathan Cast writes: On 13 Jan 2008, at 4:15 PM, Achim Schneider wrote: ... never mind... I'm glad you are capable of ever so nobly assigning the purest imaginable motives to the designers of Haskell. You are an inspiration to us

[Haskell-cafe] Re: 0/0 1 == False

2008-01-13 Thread Achim Schneider
Jonathan Cast [EMAIL PROTECTED] wrote: You don't get 1, you start off with it. If you start off with anything, you can often end up with it as well. Enlightenment comes when you realize that sometimes you don't, and you acquire the ability to change your mind. n = 12 n = 1 * n

[Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Achim Schneider
Jonathan Cast [EMAIL PROTECTED] wrote: On 13 Jan 2008, at 4:15 PM, Achim Schneider wrote: Neil Mitchell [EMAIL PROTECTED] wrote: i.e. lift the arities to the longest argument list. Is there a reason this isn't done? Most likely not, there are being made up right now. I'm glad

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Neil Mitchell
Hi Conal, On 1/13/08, Conal Elliott [EMAIL PROTECTED] wrote: That eta-expansion desugaring would lose sharing. Ah, that will be it. 1. Equations with different arities more often signal bugs than correct intentions. I don't believe that. I suspect the type system will mop these up. 2.

[Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Achim Schneider
Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different arities, and its rejected by Haskell. Why

Re: [Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Jonathan Cast
On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote: Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread jerzy . karczmarczuk
Neil Mitchell writes: I quite like the idea of permitting equations to have different arities. It removes restrictions, makes things more regular etc. More regular??? My goodness... Of course, it removes restrictions. But in the history of humanity rarely the removal of restrictions made

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Jonathan Cast
On 13 Jan 2008, at 5:38 PM, [EMAIL PROTECTED] wrote: Neil Mitchell writes: I quite like the idea of permitting equations to have different arities. It removes restrictions, makes things more regular etc. More regular??? My goodness... Of course, it removes restrictions. But in the history

[Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Achim Schneider
Jonathan Cast [EMAIL PROTECTED] wrote: On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote: Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1]

Re: [Haskell-cafe] Re: All equations must have the same arity - why?

2008-01-13 Thread Jonathan Cast
On 13 Jan 2008, at 5:49 PM, Achim Schneider wrote: Jonathan Cast [EMAIL PROTECTED] wrote: On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote: Answer #2: Because you can't write f x = case x of [] - [1] - sort.nub But why not? Because arities aren't lifted to the longest

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Roman Leshchinskiy
Neil Mitchell wrote: Hi, It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different arities, and its rejected by Haskell. Why does this not simply desugar

[Haskell-cafe] How to add ENV variable in runhaskell shell script

2008-01-13 Thread Steve Lihn
Hi, In perl scripts (unix), one can do == #!/usr/local/bin/perl BEGIN { $ENV{LD_LIBRARY_PATH} = ...; } do my perl stuff == The setting of ENV variable before the program runs allows me to fix the shell environments. In this case, I need to specify where to look for the shared library. How do

Re: AW: [Haskell-cafe] Solving a geometry problem with Haskell

2008-01-13 Thread Quân Ta
I haven't solved this problem yet, but I think it has more to do with multiplicative partition than with perfect-square. - Quan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How to add ENV variable in runhaskell shell script

2008-01-13 Thread Liyang HU
Hi, On 1/14/08, Steve Lihn [EMAIL PROTECTED] wrote: In perl scripts (unix), one can do #!/usr/local/bin/perl BEGIN { $ENV{LD_LIBRARY_PATH} = ...; } I've not tested this (what a great line to start a post...), but see if this works for you: #! /usr/bin/env LD_LIBRARY_PATH=/path/to/libs

Re: [Haskell-cafe] How to add ENV variable in runhaskell shell script

2008-01-13 Thread Brandon S. Allbery KF8NH
On Jan 13, 2008, at 23:16 , Liyang HU wrote: On 1/14/08, Steve Lihn [EMAIL PROTECTED] wrote: In perl scripts (unix), one can do #!/usr/local/bin/perl BEGIN { $ENV{LD_LIBRARY_PATH} = ...; } I've not tested this (what a great line to start a post...), but see if this works for you: #!

Re: [Haskell-cafe] How to add ENV variable in runhaskell shell script

2008-01-13 Thread Cale Gibbard
On 13/01/2008, Steve Lihn [EMAIL PROTECTED] wrote: Hi, In perl scripts (unix), one can do == #!/usr/local/bin/perl BEGIN { $ENV{LD_LIBRARY_PATH} = ...; } do my perl stuff == The setting of ENV variable before the program runs allows me to fix the shell environments. In this case, I

Re: [Haskell-cafe] Solving a geometry problem with Haskell

2008-01-13 Thread Cale Gibbard
On 12/01/2008, Hugh Perkins [EMAIL PROTECTED] wrote: On Jan 12, 2008 10:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote: After some profiling I found out that about 94% of the execution time is spent in the ``isPerfectSquare'' function. I guess that Haskell's referential transparence means

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread ajb
G'day all. Quoting Neil Mitchell [EMAIL PROTECTED]: I don't believe that. I suspect the type system will mop these up. As previously noted, anything involving undefined (thanks to seq) is not equivalent. While undefined is arguably uncommon, error most certainly isn't: f1 (x:xs) = {-

[Haskell-cafe] Computer Science Books using Haskell

2008-01-13 Thread PR Stanley
Hi Can the list recommend books that use Haskell - or any FP language but preferably Haskell - to illustrate the principles of compilers and/or algorithms? I think most of you would understand if I said that I'd prefer FP code instead of funny math symbols that don't translate into ANSI

[Haskell-cafe] ANNOUNCE: HStringTemplate -- An Elegant, Functional, Nifty Templating Engine for Haskell

2008-01-13 Thread Sterling Clover
HStringTemplate is a port of Terrence Parr’s lovely StringTemplate (http://www.stringtemplate.org) engine to Haskell. It is available, cabalized, at: darcs get http://code.haskell.org/HStringTemplate/ As interest has grown in using Haskell for web applications, there has been an increasing

Re: [Haskell-cafe] Computer Science Books using Haskell

2008-01-13 Thread Don Stewart
Hi Paul, One textbook on algorithms with a functional approach is by Fethi Rabhi and Guy Lapalme: Algorithms: A functional programming approach published by Addison-Wesley, 235 pages, ISBN 0-201-59604-0 I'd imagine they wouldn't use many OCR unfriendly characters. Purely Functional Data