注:ワイヤレスカードがコンピューターで壊れており、これにhaskellをインストールできないため、タイプミス(大文字など)がある可能性があるため、コードを再入力しています(メモリスティックxDを持っていません)
私は Config を定義するために使用してき
Config line values 2 2
ましたが、この 1 つの関数「開始」が好きではありません。f -> f を取るものは何でもうまくいきます...
data Config = Config {
line :: Line,
nums :: [Nums],
indent :: Indent,
run :: Run
} deriving (Eq, Show)
class (Result f) => Test f where
start :: Line -> [Nums] -> f
instance Test Config where
start line nums = Config line nums 0 0
私が走れば
> start 2 [0,0,0]
返すべきもの
> Config 2 [0,0,0] 0 0
エラーが発生します:
Ambiguous type variable `f0' in the constraint:
(Test f0) arising from a use of `start'
Probable fix: add a type signature that fixes these type variable(s)
ランニング
> :t Config 2 [0,0,0] 0 0
与える
> Config 2 [0,0,0] 0 0 :: Config
どちらが正しい