xmonadを構成していますが、数十のインスタンスを開始する必要があるため、xとyの位置、幅、高さ、テキストの整列のパラメーターを受け取る関数を使用する方がよいと判断しました。
-- mydzen.hs
import Data.List
-- | Return a string that launches dzen with the given configuration.
myDzen :: Num a => a -> a -> a -> Char -> String -> String
myDzen y x w ta e =
intercalate " "
[ "dzen2"
, "-x" , show x
, "-w" , show w
, "-y" , show y
, "-h" , myHeight
, "-fn" , quote myFont
, "-bg" , quote myDBGColor
, "-fg" , quote myFFGColor
, "-ta" , [ta]
, "-e" , quote e
]
quote :: String -> String
quote x = "'" x "'"
-- dummy values
myHeigth = "20"
myFont = "bitstream"
myDBGColor = "#ffffff"
myFFGColor = "#000000"
Could not deduce (Show a) arising from a use of `show'
from the context (Num a)
bound by the type signature for
myDzen :: Num a => a -> a -> a -> Char -> String -> String
at mydzen.hs:(5,1)-(17,13)
Possible fix:
add (Show a) to the context of
the type signature for
myDzen :: Num a => a -> a -> a -> Char -> String -> String
In the expression: show x
In the second argument of `intercalate', namely
`["dzen2", "-x", show x, "-w", ....]'
In the expression:
intercalate " " ["dzen2", "-x", show x, "-w", ....]
もちろん、署名を削除したり、に変更Num a
したりShow a
すると問題は解決しますが、その理由はわかりません。'引数' x
、w
およびほとんどすべての種類の数(、、 ecc)であると想定されていy
ます。100
550.2
1366 * 0.7
私はhaskellを初めて使用しますが、これまでエラーを(明確に)理解したり、何が問題なのかを見つけることができませんでした。