Re: Cast from and to CChar

2003-10-28 Thread Christian Buschmann
Marcin 'Qrczak' Kowalczyk wrote:
This is the same - instance Show Char displays non-ASCII characters
that way. You get the same effect if you just type ''.
Thanks to you and John for the hints.
But what is the good reason that show is doing it that way? Wouldn't it 
be better to output the '' as a '' instead of a code? I thought that 
Char in Haskell is working with Unicodes?

  christian

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


gtk2hs

2003-06-13 Thread Christian Buschmann
Hi!
I tried to implement a simple counter with gtk2hs. To increase my 
counter I defined following event:

onClicked btn $ do si - textBufferGetStartIter tb
   ei - textBufferGetEndIter tb
   val - textBufferGetText tb si ei False
   textBufferSetText tb $ show $ (+1) $ read val
But now I don't want always read the textfield to get my counter-value, 
I would like to save the state of my increased value and would like to 
pass it to the next call of the function.
How can I do this?

thanks
  Christian


This is the complete code:

import Gtk

quitDialog :: IO Bool
quitDialog = .
main :: IO ()
main = do
   initGUI
   --main window
   win - windowNew
   onDelete win (\_-(quitDialog= (return . not )))
   onDestroy win mainQuit
   vb - vBoxNew True 5
   hb - hBoxNew True 5
   btn - buttonNewFromStock stockExecute
   btn2 - buttonNewFromStock stockQuit
   tv - textViewNew
   tb - textBufferNew Nothing
   textBufferSetText tb 0
   textViewSetEditable tv False
   textViewSetCursorVisible tv False
   textViewSetBuffer tv tb
   boxPackStartDefaults vb tv
   boxPackStartDefaults vb hb
   boxPackStartDefaults hb btn
   boxPackStartDefaults hb btn2
   hgf - onClicked btn $ do si - textBufferGetStartIter tb
 ei - textBufferGetEndIter tb
 val - textBufferGetText tb si ei False
 textBufferSetText tb $ show $ (+1) $ 
read val
   disconnect hgf
   onClicked btn2 $ do quit - quitDialog
   if quit then
  widgetDestroy win
  else return ()
   containerAdd win vb
   widgetShowAll win
   mainGUI

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Fudgets

2003-06-08 Thread Christian Buschmann
Hi!
Is there any easy way to display an IO String with Fudgets?
I know how to display a String:
  import Fudgets

  main :: IO ()
  main = fudlogue (shellF Prog showMe)
  showMe = (Hello  `labLeftOfF` displayF) ==
   mapF getString == (buttonF ClickMe!)
  getString :: Click - String
  getString Click = World!
But if I change the getString-function to:

  getString :: Click - IO String
  getString Click = return World! --or any other kind of function 
which returns an IO String

I get an error message. Is there any way, without using unsafePerformIO, 
to display my IO String?

thanks
  Christian Buschmann
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe