fay-0.20.0.0: src/Fay/Compiler/GADT.hs
-- | Convert GADTs into normal data types.
module Fay.Compiler.GADT
(convertGADT
) where
import Language.Haskell.Exts.Annotated hiding (name)
-- | Convert a GADT to a normal data type.
convertGADT :: GadtDecl a -> QualConDecl a
convertGADT d = case d of
GadtDecl s name typ -> QualConDecl s tyvars context
(ConDecl s name (convertFunc typ))
where
tyvars = Nothing
context = Nothing
convertFunc :: Type a -> [BangType a]
convertFunc (TyCon _ _) = []
convertFunc (TyFun s x xs) = UnBangedTy s x : convertFunc xs
convertFunc (TyParen _ x) = convertFunc x
convertFunc _ = []