避免孤立可输入的实例

时间:2015-01-06 10:55:56

标签: haskell

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> 

0 个答案:

没有答案