[Haskell-cafe] How to use clipboard in Gtk2Hs

2006-09-16 Thread Yu, Jae-Myoung
I'm making a text editor with Gtk2Hs, and I want to implement copy  paste with TextView. I read the api document but I can't find how to use the Gtk.Clipboard object. Without context menu basically included in the TextView widget, How can I implement copy  paste?

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


[Haskell-cafe] Deferred instance declarations (context without type variables)

2006-09-16 Thread Misha Aizatulin
hello,

  I have a question about context in type signature. I would like to
write a function, say (f :: T - T) which also relies on an instance of
class C being defined for T. The problem is, I don't want this instance
defined at the same time f is defined, instead I would like to defer
this definition until f is called (in some other module). Naively the
code would look like this:
=
module DefineF where

class C a where
  fC :: a - a

data T = T

f :: (C T) = T - T
f T = fC T
=
module CallF where

instance C T where
  fC = id

call = f T
=
  The definition of f in DefineF won't compile because All of the type
variables .. are already in scope. Could you recommend any other way to
achieve what I am trying to do?

  An interesting thing is that I can easily make the code compile with
the same meaning by changing the 
declaration of T to include a dummy type variable:
 data T a = T
  it's just a pity that I have to trick the compiler in such an ugly
way.

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


Re: [Haskell-cafe] How to use clipboard in Gtk2Hs

2006-09-16 Thread Duncan Coutts
On Sat, 2006-09-16 at 18:32 +0900, Yu, Jae-Myoung wrote:
 I'm making a text editor with Gtk2Hs, and I want to implement copy 
 paste with TextView. I read the api document but I can't find how to
 use the Gtk.Clipboard object. Without context menu basically included
 in the TextView widget, How can I implement copy  paste? 

Btw, it's best to ask Gtk2Hs questions on the Gtk2Hs users list:
[EMAIL PROTECTED]

The copy  paste for TextView works with the normal keybindings, eg
ctl-c/ctl-v/ctl-x (or any other custom ones that have been setup).

To do manual or custom clipboard stuff needs the Clipboard object which
we have not bound yet. If that's a priority for you we can have a go at
binding that before the upcoming Gtk2Hs 0.9.11 release.

If you want it to help then we'll gladly accept patches via darcs send.

Duncan

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


Re: [Haskell-cafe] Serialising types with existential data constructors

2006-09-16 Thread Misha Aizatulin
 Klaus Ostermann and I allude to this non-trivial extensibility problem 
 in our GPCE 2006 paper
 and we started to look into ways (not in that paper) to resolve
 the problem in a principled way.

  I'm really looking forward to that! For now I'll probably use Template
Haskell to register all instances that have to be serialized and output
the mapping head-type in the end.

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