[Haskell-cafe] Problems with GHC API and error handling

2013-06-15 Thread Daniel F
Hello, everyone. I am in need of setting up custom exception handlers when using GHC API to compile modules. Right now I have the following piece of code: * Main.hs: -- import GHC import GHC.Paths

Re: [Haskell-cafe] Haskell Platform 2013.2.0.0 64bit.pkg

2013-06-15 Thread aditya bhargava
As a side note, I have stopped having cabal issues since I started using hsenv. It sandboxes packages for you. So if you have install problems you just need to delete a local .hsenv directory instead of reinstalling everything. On Jun 12, 2013 11:15 PM, Richard A. O'Keefe o...@cs.otago.ac.nz

[Haskell-cafe] Improved ghc-pkg cache warnings

2013-06-15 Thread Andrew Pennebaker
When ghc-pkg observes your cache is out of date, it displays a helpful warning, recommending ghc-pkg recache. However, sometimes running this command does not fix the problem, because it targets the wrong cache. For out of date global caches, ghc-pkg --global recache successfully clears the

[Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Christopher Howard
I'm working through some beginner-level keyboard problems I found at users.csc.calpoly.edu. One problem is the Saddle Points problem: quote: Write a program to search for the saddle points in a 5 by 5 array of integers. A saddle point is a cell whose value is greater than or equal to any

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Tommy Thorn
I expect you'll get many replies... row (Grid s l) n = if (n = s) then [] else l !! n col g@(Grid s l) n = if (n = s) then [] else col_ g n 0 where col_ (Grid s l) n i = if (i = s) then [] else (head l !! n) : col_ (Grid s (tail l)) n (i + 1) While such low-level approach (focus on the

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Christopher Howard
On 06/15/2013 04:39 PM, Tommy Thorn wrote: There's not enough context to answer the specific question, but lazy evaluation isn't magic and the answer is probably no. Tommy Perhaps to simplify the question somewhat with a simpler example. Suppose you have code: let f x = if (x

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Christopher Howard
On 06/15/2013 05:02 PM, Christopher Howard wrote: On 06/15/2013 04:39 PM, Tommy Thorn wrote: Perhaps to simplify the question somewhat with a simpler example. Suppose you have code: let f x = if (x 4) then f 0 else (sin x + 2 * cos x) : f (x + 1) After calculating

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Clark Gaebel
Yes. In general, GHC won't CSE for you. - Clark On Saturday, June 15, 2013, Christopher Howard wrote: On 06/15/2013 04:39 PM, Tommy Thorn wrote: There's not enough context to answer the specific question, but lazy evaluation isn't magic and the answer is probably no. Tommy

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Tikhon Jelvis
There's a very good StackOverflow question which covers this: When is memoization automatic in GHC?[1]. I found it really cleared up the issue for me. [1]: http://stackoverflow.com/questions/3951012/when-is-memoization-automatic-in-ghc-haskell On Sat, Jun 15, 2013 at 9:13 PM, Clark Gaebel