我有以下代碼:問題與ISubset
type Drawable = '["object" ::: Object, "transform" ::: M44 GL.GLfloat]
objXfrm :: "transform" ::: M44 GL.GLfloat
objXfrm = Field
objRec :: "object" ::: Object
objRec = Field
drawObject :: (Drawable `ISubset` a) => M44 GL.GLfloat -> PlainRec a -> IO()
drawObject camera obj =
withVAO vao $ do
GL.currentProgram $= Just (program shdr)
setUniforms shdr (modelView =: (rGet objXfrm obj !*! camera))
GL.polygonMode $= (GL.Line, GL.Line)
GL.drawElements GL.Triangles inds GL.UnsignedInt nullPtr
where Object {objVAO = vao, objNumIndices = inds, objShader = shdr}
= rGet objRec obj
當我得到drawObject
擺脫類型的它編譯罰款,但與I型得到
Could not deduce (IElem * ("transform" ::: V4 (V4 GL.GLfloat)) a)
arising from a use of `rGet'
from the context (ISubset * Drawable a)
...
Could not deduce (IElem * ("object" ::: Object) a)
arising from a use of `rGet'
from the context (ISubset * Drawable a)
的類型GHC推導對我來說是
drawObject
:: (IElem * ("object" ::: Object) rs,
IElem * ("transform" ::: V4 (V4 GL.GLfloat)) rs) =>
V4 (V4 GL.GLfloat)
-> Rec rs Data.Functor.Identity.Identity -> IO()
而且,作爲一個類型簽名工作正常,但一個與ISubset
沒有。如果我將參數轉換爲ISubset
,則錯誤完全相同。這裏發生了什麼?
這將真正幫助,如果你可以要求使用不具有對許多不確定的包,除了乙烯依賴性小例子的問題。 – kosmikus
@kosmikus今天我可以得到一個;昨晚我只想讓問題發佈併入睡。 – Dan