haskell-ja > Archives > 2012/07/22

2012/07/22 04:04:02 UTCcutsea110
#
{-# LANGUAGE TypeFamilies #-}
module Test where

class A a where
  type R a :: *
  f :: a -> R a

class C a where
  g :: a -> b

instance A Int where
  type R Int = C a => a
  f = undefined
#
こんなことをしたいと思ったんだけど
#
ghci> :l Test.hs
[1 of 1] Compiling Test             ( Test.hs, interpreted )

Test.hs:12:3:
    Illegal polymorphic or qualified type: forall a. C a => a
    In the type synonym instance declaration for `R'
    In the instance declaration for `A Int'
Failed, modules loaded: none.
#
ダメ?