2011-08-20 65 views
4

每當我在WxHaskell中使用一個字符串時,它認爲該字符串是一個字符(它只顯示第一個字符)。它僅在使用WxHaskell函數時發生,而不是像putStrLn這樣的函數。WxHaskell認爲我的字符串長度爲1個字符

例如,錯誤發生在這個代碼

module Main where 
import Graphics.UI.WX 

main = start hello 
hello = do f <- frame [text := "Hello"] 
      quit <- button f [text := "quit", on command := close f] 
      set f [layout := widget quit] 

它不會在這個節目發生:

module Main where 

main = putStrLn "hello" 
+1

運行此程序時,我得到一個標題爲「Hello」的表單,其中標有「quit」的單個按鈕。 – Rotsor

+0

這就是我尋求幫助的原因。我看不出什麼是錯的。我嘗試重新安裝,但沒有奏效。 – Anonymous

回答

4

我有這種行爲而回。原來是一個unicode問題。用某種unicode標誌重新編譯固定的東西,IIRC。

+1

聽起來很可能。如果解釋爲零終止的UTF-8,小端的UTF-16中的英文字母將看起來像是1個字符的字符串。 – hammar

+0

你知道它是哪個標誌嗎? – Anonymous

+0

我應該說我正在使用GHC。 – Anonymous

相關問題