Birbirlerini tanımlanmış varsayılan örnek örneklerine sahip olmanın bir yolu var mı?Birbirine ait varsayılan tür örnekleri
{-# LANGUAGE DataKinds, KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
data Tag = A | B | C
class Foo (a :: *) where
type Bar a (b :: Tag)
type Bar a A =()
type Bar a B = Bar a A
type Bar a C = Bar a A
instance Foo Int where
type Bar Int A = Bool
test :: Bar Int B
test = True
ama bu işe yaramazsa: Bu çalışma gibi bir şey almaya çalışıyorum
Couldn't match type `Bar Int 'B' with `Bool'
In the expression: True
In an equation for `test': test = True
Not Bu işe yaramazsa o ya:
test :: Bar Int B
test =()