小编Eri*_*ric的帖子

如何在Haskell中调用Ptr GLubyte类型的函数 - > IO()

在OpenGL Raw库中有以下功能:

glPolygonStipple :: Ptr GLubyte -> IO ()
Run Code Online (Sandbox Code Playgroud)

此函数的C对应接受指向数组的指针,但如何在Haskell程序中使用数组/列表调用此函数?

opengl haskell ffi

4
推荐指数
1
解决办法
245
查看次数

在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

haskell parse-error type-variables

1
推荐指数
1
解决办法
192
查看次数

标签 统计

haskell ×2

ffi ×1

opengl ×1

parse-error ×1

type-variables ×1