Int Num a => a Num a
GHC

newtype ()(1)
newtype Plain = Plain ByteString
deriving (Show, Eq)
newtype Encrypted = Encrypted ByteString
deriving (Show, Eq)
encrypt :: Plain -> Encrypted
encrypt m = ...
Plain , Encrypted

使
data Plain = Plain
data Encrypted = Encrypted
newtype Message a = Message ByteString
deriving (Show, Eq)
encrypt :: Message Plain -> Message Encrypted
encrypt m = ...
Plain , Encrypted 使 Message
append :: Message a -> Message a -> Message a
append x y = coerce $ (coerce @_ @ByteString x) ++ (coerce @_ @ByteString y)
newtype 使
使IDID使()
使使 newtype

type2.hs Plain Encrypted 使使GHC EmptyDataDecls GHC

type2.hs Message a a Message ByteString (Phantom type)EDSL

type2.hs Message Message Int Message Plain Encrypted Message a (kind)
Haskell * k1 -> k2 Constraint GHC DataKinds 使
{-# LANGUAGE DataKinds #-}
data Status = Plain | Encrypted
deriving (Show, Eq)
Status Plain Encrypted Status Plain Encrypted 22 Plain Encrypted Plain 使 Plain 2Haskell ' (e. g. 'Plain )( ' GHCwarning)

Message a GHC KindSignatures
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
data Status = Plain | Encrypted
deriving (Show, Eq)
newtype Message (a :: Status) = Message ByteString
deriving (Show, Eq)
Message Int

Message Vector Vector Message Plain Message Excrypted Vector 2 Message
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
data SomeMessage = forall a. Show (Message a) => SM (Message a) --
hoge :: Vector SomeMessage -> Vector Bool
hoge = ...
SomeMessage a forall 使 forall a b.
() SomeMessage
( unsafeCoerce 使 MagicDict )

Kind
id ()
foo :: (a -> b) -> SomeMessage -> b
foo f (SM x) = f x
a b f :: a -> b RankNTypes 使 type7.hs
foo :: (forall a. a -> b) -> SomeMessage -> b
foo f (SM x) = f x
a a f

Haskell()singleton type使
#