{-# LANGUAGE DataKinds                #-}
{-# LANGUAGE TypeOperators            #-}
# LANGUAGE FunctionalDependencies    #
{-# LANGUAGE TypeFamilies             #-}
# LANGUAGE PolyKinds                 #
{-# LANGUAGE KindSignatures           #-}
{-# LANGUAGE ScopedTypeVariables      #-}

  instance (   engine ( ) ,   parts ( ) ) = >
--          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# LANGUAGE FlexibleContexts          #

  instance ( b ~ Parts a ,   a ( ) ) = >    ( )
--                                             ^^^^^^^^^^^^^^^^
# LANGUAGE FlexibleInstances         #

module Car.Language where

import GHC.TypeLits (Symbol)

-- eDSL

data Car (name :: Symbol) (engine :: EngineTag x) (parts :: PartsTag a)

-- Extension points:
data EngineTag a
data PartsTag a

-- Construction of extensions

-- Single type construction
type family Engine (a :: *) :: EngineTag a

-- List of types construction
type family Parts (p :: [*]) :: PartsTag p

# LANGUAGE DataKinds                #
# LANGUAGE TypeOperators            #
# LANGUAGE TypeFamilies             #
# LANGUAGE KindSignatures           #
# LANGUAGE ScopedTypeVariables      #
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                             ^^^^^^^^^^^^^^^^
 eDSL
 Extension points:
 Construction of extensions
 Single type construction
 List of types construction
# LANGUAGE FunctionalDependencies    #
# LANGUAGE PolyKinds                 #

  instance (   engine ( ) ,   parts ( ) ) = >
# LANGUAGE FlexibleContexts          #

  instance ( b ~ Parts a ,   a ( ) ) = >    ( )
# LANGUAGE FlexibleInstances         #

module Car.Language where

import GHC.TypeLits (Symbol)


data Car (name :: Symbol) (engine :: EngineTag x) (parts :: PartsTag a)

data EngineTag a
data PartsTag a


type family Engine (a :: *) :: EngineTag a

type family Parts (p :: [*]) :: PartsTag p
