2014-09-30 66 views
-3

當試圖從榆樹教程中,我得到了一個錯誤編譯傍「找不到變量Text.color」找不到變量Text.Color

textGreen = rgb 160 200 160 
txt f = leftAligned << f << monospace << Text.color textGreen << toText 
msg = "SPACE to start, WS and &uarr;&darr; to move" 

誤差是指設置在第二線,我」 m試圖設置Text.color。 非常感謝您提供任何幫助。

+0

很難找到問題的根源不完全模塊源和精確的編譯器輸出。 – CheatEx 2014-10-02 07:36:54

回答

1

您是否有Text進口? import Text和你列出的代碼將被編譯。

您的txt函數真的是您期望的類型嗎?

> txt f = leftAligned << f << monospace << Text.color textGreen << toText` 
<function> : (Text.Text -> Text.Text) -> String -> Graphics.Element.Element 

如果是這樣,這將編譯和運行:

import Text    exposing (monospace, fromString) 
import Color   exposing (rgb) 
import Graphics.Element exposing (leftAligned) 

textGreen = rgb 160 200 160 
txt f = leftAligned << f 
        << monospace 
        << Text.color textGreen 
        << fromString 
msg = "SPACE to start, WS and &uarr;&darr; to move" 

main = txt identity msg