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
手伝ってくれますか?
エリック・マコーレー