module Language.Haskell.TH.Compat.Data.V211 (
dataD', unDataD,
newtypeD', unNewtypeD,
dataInstD', unDataInstD,
newtypeInstD', unNewtypeInstD,
unInstanceD,
) where
import Language.Haskell.TH
(CxtQ, ConQ, TypeQ, DecQ,
Cxt, Con, Type, Name, TyVarBndr, Kind,
Dec (DataD, NewtypeD, DataInstD, NewtypeInstD, InstanceD),
dataD, newtypeD, dataInstD, newtypeInstD, conT)
dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name]
-> DecQ
dataD' cxt n bs cs ds = dataD cxt n bs Nothing cs $ mapM conT ds
unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type])
unDataD (DataD cxt n bs mk cs ds) = Just (cxt, n, bs, mk, cs, ds)
unDataD _ = Nothing
newtypeD' :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name]
-> DecQ
newtypeD' cxt n bs c ds = newtypeD cxt n bs Nothing c $ mapM conT ds
unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type])
unNewtypeD (NewtypeD cxt n bs mk c ds) = Just (cxt, n, bs, mk, c, ds)
unNewtypeD _ = Nothing
dataInstD' :: CxtQ -> Name -> [TypeQ] -> [ConQ] -> [Name]
-> DecQ
dataInstD' cxt n as cs ds = dataInstD cxt n as Nothing cs $ mapM conT ds
unDataInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, [Con], [Type])
unDataInstD (DataInstD cxt n as mk cs ds) = Just (cxt, n, as, mk, cs, ds)
unDataInstD _ = Nothing
newtypeInstD' :: CxtQ -> Name -> [TypeQ] -> ConQ -> [Name]
-> DecQ
newtypeInstD' cxt n as c ds = newtypeInstD cxt n as Nothing c $ mapM conT ds
unNewtypeInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, Con, [Type])
unNewtypeInstD (NewtypeInstD cxt n as mk c ds) = Just (cxt, n, as, mk, c, ds)
unNewtypeInstD _ = Nothing
unInstanceD :: Dec -> Maybe (Cxt, Type, [Dec])
unInstanceD (InstanceD _ cxt ty decs) = Just (cxt, ty, decs)
unInstanceD _ = Nothing