I've seen this '[]
and ':
syntax in a few places, most notably in heterogeneous lists packages like HList or HVect.
For example, the heterogeneous vector HVect
is defined as
data HVect (ts :: [*]) where
HNil :: HVect '[]
(:&:) :: !t -> !(HVect ts) -> HVect (t ': ts)
In GHCi, with extension TemplateHaskell
or DataKinds
, I get this
> :t '[]
'[] :: template-haskell-2.13.0.0:Language.Haskell.TH.Syntax.Name
> :t '(:)
'(:) :: template-haskell-2.13.0.0:Language.Haskell.TH.Syntax.Name
I had the impression that this has to do with dependent types and kinds, etc., not with template haskell.
The search engines, and hoogle, and hayoo, handle queries with '[]
or ':
rather badly, hence the question: What is the name of these '[]
and ':
things? Pointers to documentation or tutorials would be most welcome.