Re: [Haskell-cafe] implementing a text editor swap file

2012-01-18 Thread Gracjan Polak
Erik de Castro Lopo mle+hs at mega-nerd.com writes:

 
 Matthew Farkas-Dyck wrote:
 
  http://hackage.haskell.org/package/bytestring-mmap
 
 Since he's editing text, its a pity there isn't a text-mmap
 package .

Well, this one:

http://hackage.haskell.org/package/mmap

works not only for Text but also for Windows and Macs.

-- 
Gracjan




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Matthew Farkas-Dyck
http://hackage.haskell.org/package/bytestring-mmap


On 17/01/2012, Martin DeMello martindeme...@gmail.com wrote:
 I'm writing a gtk2hs-based text editor, and would like to implement
 continuous (swap-file based) autosave the way vim and emacs do it. Any
 suggestions for how to implement this in a cross-platform manner?

 Also, is there a library that returns standard config file locations
 on a per-platform basis?

 martin

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Erik de Castro Lopo
Matthew Farkas-Dyck wrote:

 http://hackage.haskell.org/package/bytestring-mmap

Since he's editing text, its a pity there isn't a text-mmap
package :-).

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Martin DeMello
Says posix only. But googling for it brought up System.IO.MMap, which
does seem to be cross-platform.

martin

On Tue, Jan 17, 2012 at 5:46 PM, Matthew Farkas-Dyck
strake...@gmail.com wrote:
 http://hackage.haskell.org/package/bytestring-mmap


 On 17/01/2012, Martin DeMello martindeme...@gmail.com wrote:
 I'm writing a gtk2hs-based text editor, and would like to implement
 continuous (swap-file based) autosave the way vim and emacs do it. Any
 suggestions for how to implement this in a cross-platform manner?

 Also, is there a library that returns standard config file locations
 on a per-platform basis?

 martin

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Matthew Farkas-Dyck
On 17/01/2012, Erik de Castro Lopo mle...@mega-nerd.com wrote:
 Matthew Farkas-Dyck wrote:

 http://hackage.haskell.org/package/bytestring-mmap

 Since he's editing text, its a pity there isn't a text-mmap
 package :-).

Yeah, I had the same thought.

 Erik
 --
 --
 Erik de Castro Lopo
 http://www.mega-nerd.com/

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Martin DeMello
On Tue, Jan 17, 2012 at 5:49 PM, Erik de Castro Lopo
mle...@mega-nerd.com wrote:
 Matthew Farkas-Dyck wrote:

 http://hackage.haskell.org/package/bytestring-mmap

 Since he's editing text, its a pity there isn't a text-mmap
 package :-).

Further question - my internal data representation is a vector of
strings (it's a line-based editor). Is there a more efficient strategy
to keep an mmap buffer in sync with the vector than simply allocating
some large fixed size per line?

martin

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Erik de Castro Lopo
Martin DeMello wrote:

 Further question - my internal data representation is a vector of
 strings (it's a line-based editor).

String or ByteString or Text?

If its either of the first two, I think you should definitely look at
Text.

 Is there a more efficient strategy
 to keep an mmap buffer in sync with the vector than simply allocating
 some large fixed size per line?

Very much dependent on whether you are using String or one of the
other two I would think.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Martin DeMello
On Tue, Jan 17, 2012 at 6:24 PM, Erik de Castro Lopo
mle...@mega-nerd.com wrote:
 Martin DeMello wrote:

 Further question - my internal data representation is a vector of
 strings (it's a line-based editor).

 String or ByteString or Text?

 If its either of the first two, I think you should definitely look at
 Text.

Just plain String, mostly because it's what Gtk.Entry works with. I'll
take a look at Text.

martin

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] implementing a text editor swap file

2012-01-17 Thread Erik de Castro Lopo
Martin DeMello wrote:

 Just plain String, mostly because it's what Gtk.Entry works with. I'll
 take a look at Text.

Ah, maybe not. If your output representation *has* to be String its
probably not worth using Text as an internal representation.

I suspect that Gtk should really be updated to allow the use of Text
instead of String.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe