DataKinds
提升的数据类型似乎不会自动获取可分类的实例。使用StandaloneDeriving
很容易解决这个问题,但这会创建孤立实例。反正有没有避免这个?
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
module Orphan where
import Data.Typeable
deriving instance Typeable '[]
deriving instance Typeable '(:)
编译..
[1 of 1] Compiling Orphan ( orphan.hs, interpreted )
orphan.hs:10:1: Warning: Orphan instance: instance Typeable '[]
orphan.hs:11:1: Warning: Orphan instance: instance Typeable (':)
Ok, modules loaded: Orphan.
*Orphan>