{-# OPTIONS_GHC -fth -fno-warn-missing-methods -cpp #-}-- | Derivation for the @Serial@ class used by SmallCheck. Following-- the guidelines in the SmallCheck README-- <http://www.cs.york.ac.uk/fp/darcs/smallcheck/README>, we implement-- both @series@ and @coseries@. The generated instances use the-- SmallCheck instance combinators in the proscribed way.moduleData.Derive.Serial(makeSerial)whereimportLanguage.Haskell.TH.All#ifdef GUESSimportSmallCheckimportData.DeriveGuessexample=(,)"Serial"[d|instanceSeriala=>Serial(DataNamea)whereseries=cons0CtorZero\/cons1CtorOne\/cons2CtorTwo\/cons2CtorTwo'coseriesd=[\t->casetofCtorZero->t0CtorOnex1->t1x1CtorTwox1x2->t2x1x2CtorTwo'x1x2->t3x1x2|t0<-alts0d,t1<-alts1d,t2<-alts2d,t3<-alts2d]|]#endifmakeSerial::DerivationmakeSerial=derivationserial'"Serial"serial'dat=[instance_context["Serial"]"Serial"dat[ValD(VarP(mkName"series"))(NormalB(foldl1With(VarE(mkName"\\/"))((map(\(ctorInd,ctor)->(AppE(VarE(mkName("cons"++show(ctorArityctor))))(ConE(mkName(ctorNamector)))))(id(zip[0..](dataCtorsdat))))++[])))[],FunD(mkName"coseries")[(Clause[(VarP(mkName"d"))](NormalB(CompE((map(\(ctorInd,ctor)->(BindS(VarP(mkName("t"++showctorInd)))(AppE(VarE(mkName("alts"++show(ctorArityctor))))(VarE(mkName"d")))))(id(zip[0..](dataCtorsdat))))++[(NoBindS(LamE[(VarP(mkName"t"))](CaseE(VarE(mkName"t"))((map(\(ctorInd,ctor)->(Match(ConP(mkName(ctorNamector))((map(\field->(VarP(mkName("x"++showfield))))(id[1..ctorArityctor]))++[]))(NormalB(applyWith(VarE(mkName("t"++showctorInd)))((map(\field->(VarE(mkName("x"++showfield))))(id[1..ctorArityctor]))++[])))[]))(id(zip[0..](dataCtorsdat))))++[]))))]++[])))[])]]]