当我向 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)))
我收到以下错误:
config1.hs:10:1: Parse error in pattern: normalize
你能帮我吗?
埃里克·麦考利