module Data.Derive.DataAbstract(makeDataAbstract) where
import Data.Derive.DSL.HSE
import Data.Derive.DSL.DSL
import Data.Derive.Internal.Derivation
makeDataAbstract :: Derivation
makeDataAbstract = derivationCustomDSL "DataAbstract" custom $
List [Instance ["Typeable"] "Data" (App "Just" (List [List [App
"InsDecl" (List [App "()" (List []),App "FunBind" (List [App "()"
(List []),List [App "Match" (List [App "()" (List []),App "Ident"
(List [App "()" (List []),String "gfoldl"]),List [App "PVar" (List
[App "()" (List []),App "Ident" (List [App "()" (List []),String
"k"])]),App "PVar" (List [App "()" (List []),App "Ident" (List [
App "()" (List []),String "r"])]),App "PVar" (List [App "()" (List
[]),App "Ident" (List [App "()" (List []),String "x"])])],App
"UnGuardedRhs" (List [App "()" (List []),App "App" (List [App "()"
(List []),App "Var" (List [App "()" (List []),App "UnQual" (List [
App "()" (List []),App "Ident" (List [App "()" (List []),String
"r"])])]),App "Var" (List [App "()" (List []),App "UnQual" (List [
App "()" (List []),App "Ident" (List [App "()" (List []),String
"x"])])])])]),App "Nothing" (List [])])]])]),App "InsDecl" (List [
App "()" (List []),App "PatBind" (List [App "()" (List []),App
"PVar" (List [App "()" (List []),App "Ident" (List [App "()" (List
[]),String "gunfold"])]),App "UnGuardedRhs" (List [App "()" (List
[]),App "App" (List [App "()" (List []),App "Var" (List [App "()"
(List []),App "UnQual" (List [App "()" (List []),App "Ident" (List
[App "()" (List []),String "error"])])]),App "Lit" (List [App "()"
(List []),App "String" (List [App "()" (List []),Concat (List [
String "Data.gunfold not implemented on abstract data type: ",
DataName]),Concat (List [String
"Data.gunfold not implemented on abstract data type: ",DataName])]
)])])]),App "Nothing" (List [])])]),App "InsDecl" (List [App "()"
(List []),App "PatBind" (List [App "()" (List []),App "PVar" (List
[App "()" (List []),App "Ident" (List [App "()" (List []),String
"toConstr"])]),App "UnGuardedRhs" (List [App "()" (List []),App
"App" (List [App "()" (List []),App "Var" (List [App "()" (List []
),App "UnQual" (List [App "()" (List []),App "Ident" (List [App
"()" (List []),String "error"])])]),App "Lit" (List [App "()" (
List []),App "String" (List [App "()" (List []),Concat (List [
String "Data.gunfold not implemented on abstract data type: ",
DataName]),Concat (List [String
"Data.gunfold not implemented on abstract data type: ",DataName])]
)])])]),App "Nothing" (List [])])]),App "InsDecl" (List [App "()"
(List []),App "PatBind" (List [App "()" (List []),App "PVar" (List
[App "()" (List []),App "Ident" (List [App "()" (List []),String
"dataTypeOf"])]),App "UnGuardedRhs" (List [App "()" (List []),App
"App" (List [App "()" (List []),App "Var" (List [App "()" (List []
),App "UnQual" (List [App "()" (List []),App "Ident" (List [App
"()" (List []),String "error"])])]),App "Lit" (List [App "()" (
List []),App "String" (List [App "()" (List []),Concat (List [
String "Data.gunfold not implemented on abstract data type: ",
DataName]),Concat (List [String
"Data.gunfold not implemented on abstract data type: ",DataName])]
)])])]),App "Nothing" (List [])])])]]))]
custom = customContext context
context :: FullDataDecl -> Context () -> Context ()
context d _ = CxTuple () [ClassA () (qname t) [tyVar x] | x <- dataDeclVars $ snd d, t <- ["Typeable","Data"]]