{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE PatternSignatures #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | -- Module : Generics.MultiRec.ConNames -- Copyright : (c) 2008 Universiteit Utrecht -- License : BSD3 -- -- Maintainer : generics@haskell.org -- Stability : experimental -- Portability : non-portable -- -- Generic constructor names. -- ----------------------------------------------------------------------------- module ConNames where import Generics.MultiRec.Base import Generics.MultiRec.Constructor class ConNames (f :: (* -> *) -> (* -> *) -> * -> *) where conNames :: f s r ix -> [String] instance (ConNames f, ConNames g) => ConNames (f :+: g) where conNames (_ :: (f :+: g) r s ix) = conNames (undefined :: f r s ix) ++ conNames (undefined :: g r s ix) instance (ConNames f) => ConNames (f :>: ix) where conNames (_ :: (f :>: ix) r s xi) = conNames (undefined :: f r s ix) instance Constructor c => ConNames (C c f) where conNames c = [conName c] instance ConNames (K x) where conNames _ = [] instance ConNames (f :*: g) where conNames _ = [] instance ConNames (I a) where conNames _ = []