这是我正在尝试但无法编译的内容:
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
import Data.Text as T
import Data.Int (Int64)
type family Incoming validationResult baseType
type instance Incoming Validated baseType = baseType
type instance Incoming ValidationErrors baseType = Either [T.Text] baseType
data Validated
data ValidationErrors
data Tag = Tag {unTag :: T.Text} deriving (Eq, Show)
data NewTag f = NewTag
{
ntClientId :: Incoming f Int64
, ntTag :: Incoming f Tag
}
deriving instance (Show baseType) => Show (Incoming Validated baseType)
deriving instance (Show baseType) => Show (Incoming ValidationErrors baseType)
编译错误:
23 38 error error:
• Illegal type synonym family application in instance:
Incoming Validated baseType
• In the stand-alone deriving instance for
‘(Show baseType) => Show (Incoming Validated baseType)’ (intero)
24 38 error error:
• Illegal type synonym family application in instance:
Incoming ValidationErrors baseType
• In the stand-alone deriving instance for
‘(Show baseType) => Show (Incoming ValidationErrors baseType)’ (intero)