summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds/T13659.hs
blob: 199ff08a8dcd2358a4d85bcb2663499a39937b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies, TypeOperators, DataKinds, FlexibleInstances #-}

{- Defines a C-like printf function using DataKinds extensions. -}

module T13659 where

-- format string parameterized by a list of types
data Format (fmt :: [*]) where
  X :: Format '[]                   -- empty string, i.e. ""
  L :: a -> String -> Format '[]    -- string literal, e.g. "hello"
  S :: a -> Format '[String]        -- "%s"
  I :: Format a -> Format '[Int, a] -- "%d"