-, , , . , .
:
data TList (xs :: [*]) where
Nil :: TList '[]
(:.) :: x -> TList xs -> TList (x ': xs)
infixr 4 :.
:
class TApplies f (xs :: [*]) r | f xs -> r where ...
instance TApplies g ys q => TApplies (y -> g) (y ': ys) q where
( , ), , , : " " TApplies ". , " "? :
. tvsleft β tvsright, , S (tvsright) S (tvsleft), S - .
, , - , {q}, - {y, g, ys}. , , .
, . ! , . , , instance TApplies (y -> g) (y ': ys) q where ..., .
: {-# LANGUAGE UndecidableInstances #-} . , , , . UndecidableInstances, : " , ".
, . , tApply (+) (1 :. 2 :. Nil) " " - . , tApply (+) (1 :. "s" :. Nil) " "! , . , .
, :
instance (a ~ a') => TApplies a '[] a' where
instance (TApplies g ys q, y ~ y') => TApplies (y -> g) (y' ': ys) q where
, defaulting kicks in "3". No instance for (Num [Char]), .
, , , , . instance TApplies (y -> g) (y' ': ys) q - , , , , y y' , . , , , y ~ y', (+) 1 2.
:
{-# LANGUAGE GADTs #-}
data Cons a b
data Nil
data TList xs where
Nil :: TList Nil
(:.) :: x -> TList xs -> TList (Cons x xs)
, DataKinds .