在OpenGL Raw库中有以下功能:
glPolygonStipple :: Ptr GLubyte -> IO ()
Run Code Online (Sandbox Code Playgroud)
此函数的C对应接受指向数组的指针,但如何在Haskell程序中使用数组/列表调用此函数?
当我向GHC提交代码时
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, ScopedTypeVariables #-}
class Modular s a | s -> a where modulus :: s -> a
newtype M s a = M {unM :: a} deriving (Eq, Show)
normalize :: (Modular s a, Integral a) => a -> M s a
normalize x :: M s a = M (x `mod` (modulus (undefined :: s)))
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
config1.hs:10:1: Parse error in pattern: normalize
Run Code Online (Sandbox Code Playgroud)
你能帮我吗?
Eric Macaulay