いまよくわかってないこと
私は何か言語を学ぶとき、入門書とかを読んでても頭に入らず途中で投げ出す人間なのですが、何かを作るに際して新たな言語を選択すると覚えてくという人間なのです。必要な知識を必要なときにつける系の。
で、個人的にRFCのビュアーが欲しいと思って、GUIとかC++で書きたくないしGTKとか知らんのでじゃぁHaskellでやろうと思ったわけですよ。自然な流れですね。
んでいろいろ調べながら書いていってて、どっかで初心者のうちは関数宣言の型を省略しないで書いたほうが覚える的なのを見たのでそうしようとしているわけです。
で、書いているのですが、どうも型エラーが抜けないところがあるのです。全部コンパイラに推論させれば何事もなく通るのですが、自分で型書くとどうもエラーで。
それが
http://www.flast.jp/browser/rfcv/tree_view.hs
これの一番下の方にあるsetCellLayout関数なんですが、コメントアウトを外すとエラーになるんですね。
http://projects.haskell.org/gtk2hs/docs/gtk-docs-0.11.0/Graphics-UI-Gtk-ModelView-CellLayout.html#v%3AcellLayoutSetAttributes
ここを参考に同じように書いているのですが、(model row)の部分がどうもダメっぽくて...
ちなみにghcのエラーはこんなの
[1 of 1] Compiling Main.TreeView ( tree_view.hs, tree_view.o ) tree_view.hs:42:48: Could not deduce (row ~ [String]) from the context (TreeModelClass (model row), TypedTreeModelClass model, TreeViewColumnClass col, CellLayoutClass col) bound by the type signature for setCellLayout :: (TreeModelClass (model row), TypedTreeModelClass model, TreeViewColumnClass col, CellLayoutClass col) => CellRendererText -> model row -> col -> Int -> IO () at tree_view.hs:(39,5)-(42,51) `row' is a rigid type variable bound by the type signature for setCellLayout :: (TreeModelClass (model row), TypedTreeModelClass model, TreeViewColumnClass col, CellLayoutClass col) => CellRendererText -> model row -> col -> Int -> IO () at tree_view.hs:39:5 In the second argument of `drop', namely `ind' In the second argument of `($)', namely `drop nth ind' In the second argument of `(:=)', namely `head $ drop nth ind'
これって多分モナドなんでしょうが、何かおかしいんでしょうか。教えてーぺろぺろ。