[Haskell-cafe] minor refactoring problem

2011-11-29 Thread Martin DeMello
I have the following functions: makePair :: (String, String) - IO PairBox parseFile :: String - [(String, String)] importFile :: Editor - String - IO () importFile ed path = do s - readFile path ps - mapM (\x - makePair (x, )) (lines s) es - return $ V.fromList ps writeIORef ed es

Re: [Haskell-cafe] containers-deepseq?

2011-11-29 Thread Joachim Breitner
Hi, Am Dienstag, den 29.11.2011, 07:43 +0200 schrieb Michael Snoyman: Since the release of deepseq 1.2, we've had a bit of a problem: when using the newest versions of packages on Hackage, there is no NFData instance available for the containers types. When GHC 7.4 comes out with its newer

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Stefan Holdermans
Martin, importFile :: Editor - String - IO () importFile ed path = do s - readFile path ps - mapM (\x - makePair (x, )) (lines s) es - return $ V.fromList ps writeIORef ed es loadFile :: Editor - String - IO () loadFile ed path = do s - readFile path ps - mapM makePair

Re: [Haskell-cafe] containers-deepseq?

2011-11-29 Thread Michael Snoyman
On Tue, Nov 29, 2011 at 10:29 AM, Joachim Breitner m...@joachim-breitner.de wrote: Hi, Am Dienstag, den 29.11.2011, 07:43 +0200 schrieb Michael Snoyman: Since the release of deepseq 1.2, we've had a bit of a problem: when using the newest versions of packages on Hackage, there is no NFData

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Martin DeMello
On Tue, Nov 29, 2011 at 12:35 AM, Stefan Holdermans ste...@vectorfabrics.com wrote: Have you considered abstracting over the bits in which importFile and loadFile differ? For example:  processFile :: (String - IO [PairBox]) - Editor - String - IO ()  processFile f ed path = do    s -

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Stefan Holdermans
Martin, (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). That trick is of course completely orthogonal. One could just as well write: processFile :: (String - [a]) - (a - (String,

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Martin DeMello
On Tue, Nov 29, 2011 at 12:55 AM, Stefan Holdermans ste...@vectorfabrics.com wrote: Martin, (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). That trick is of course completely

Re: [Haskell-cafe] Overloaded Strings as default

2011-11-29 Thread Jon Fairbairn
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: On 29 November 2011 07:28, Daniel Díaz Casanueva dhelta.d...@gmail.com wrote: Hi Cafe, I only feel curious about what would be the consequences of becoming the Overloaded Strings feature (currently, an extension) to be default in

Re: [Haskell-cafe] containers-deepseq?

2011-11-29 Thread Joachim Breitner
Hi, Am Dienstag, den 29.11.2011, 10:36 +0200 schrieb Michael Snoyman: On Tue, Nov 29, 2011 at 10:29 AM, Joachim Breitner m...@joachim-breitner.de wrote: Am Dienstag, den 29.11.2011, 07:43 +0200 schrieb Michael Snoyman: Since the release of deepseq 1.2, we've had a bit of a problem: when

Re: [Haskell-cafe] containers-deepseq?

2011-11-29 Thread Michael Snoyman
On Tue, Nov 29, 2011 at 12:11 PM, Joachim Breitner m...@joachim-breitner.de wrote: Hi, Am Dienstag, den 29.11.2011, 10:36 +0200 schrieb Michael Snoyman: On Tue, Nov 29, 2011 at 10:29 AM, Joachim Breitner m...@joachim-breitner.de wrote: Am Dienstag, den 29.11.2011, 07:43 +0200 schrieb

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Holger Siegel
Am 29.11.2011 um 09:16 schrieb Martin DeMello: I have the following functions: makePair :: (String, String) - IO PairBox parseFile :: String - [(String, String)] importFile :: Editor - String - IO () importFile ed path = do s - readFile path ps - mapM (\x - makePair (x, )) (lines

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Stefan Holdermans
Martin, Quick question: what's the difference between importFile ed = readfile = fromRawFile = setEditor ed and importFile = readfile = fromRawFile = setEditor that the former compiles but the latter doesn't? Note that, in Haskell, function application has higher priority then any

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Vo Minh Thu
2011/11/29 Stefan Holdermans ste...@vectorfabrics.com: Martin, (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). That trick is of course completely orthogonal. One could just as well

Re: [Haskell-cafe] containers-deepseq?

2011-11-29 Thread John Lato
Message: 22 Date: Tue, 29 Nov 2011 12:18:41 +0200 From: Michael Snoyman mich...@snoyman.com Subject: Re: [Haskell-cafe] containers-deepseq? By the way, this is the part of situation that cabal-src is coming to solve, and it *is* solved... except that the result is a lot of re-compiling.

Re: [Haskell-cafe] containers-deepseq?

2011-11-29 Thread Michael Snoyman
On Tue, Nov 29, 2011 at 2:41 PM, John Lato jwl...@gmail.com wrote: Message: 22 Date: Tue, 29 Nov 2011 12:18:41 +0200 From: Michael Snoyman mich...@snoyman.com Subject: Re: [Haskell-cafe] containers-deepseq? By the way, this is the part of situation that cabal-src is coming to solve, and it