PageRenderTime 28ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/ghc-patch/0001-Initial-patch-containing-basic-goal-collection-code.patch

http://github.com/sebastiaanvisser/ghc-goals
Patch | 659 lines | 651 code | 8 blank | 0 comment | 0 complexity | 7e18dfdd89d583dc653a4f41b6c10d13 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. From 23b4e9bc9caf3aa0af0e586a818610c8dcb9959d Mon Sep 17 00:00:00 2001
  2. From: Sebastiaan Visser <sfvisser@cs.uu.nl>
  3. Date: Sun, 19 Apr 2009 21:31:08 +0200
  4. Subject: [PATCH] Initial patch containing basic goal collection code and integration with GHCi.
  5. ---
  6. compiler/ghc.cabal.in | 4 +-
  7. compiler/ghci/InteractiveUI.hs | 29 +++-
  8. compiler/main/GoalCollector.hs | 109 ++++++++++
  9. compiler/utils/SybUtils.hs | 431 ++++++++++++++++++++++++++++++++++++++++
  10. 4 files changed, 571 insertions(+), 2 deletions(-)
  11. create mode 100644 compiler/main/GoalCollector.hs
  12. create mode 100644 compiler/utils/SybUtils.hs
  13. diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
  14. index 483303d..a55e92f 100644
  15. --- a/compiler/ghc.cabal.in
  16. +++ b/compiler/ghc.cabal.in
  17. @@ -78,7 +78,7 @@ Library
  18. GHC-Options: -Wall -fno-warn-name-shadowing -fno-warn-orphans
  19. if flag(ghci)
  20. - Build-Depends: template-haskell
  21. + Build-Depends: template-haskell, syb
  22. CPP-Options: -DGHCI
  23. Include-Dirs: ../libffi/build/include
  24. @@ -425,6 +425,7 @@ Library
  25. GraphColor
  26. GraphOps
  27. GraphPpr
  28. + GoalCollector
  29. IOEnv
  30. Interval
  31. LazyUniqFM
  32. @@ -438,6 +439,7 @@ Library
  33. Serialized
  34. State
  35. StringBuffer
  36. + SybUtils
  37. UniqFM
  38. UniqSet
  39. Util
  40. diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs
  41. index 327cf14..22c1d1d 100644
  42. --- a/compiler/ghci/InteractiveUI.hs
  43. +++ b/compiler/ghci/InteractiveUI.hs
  44. @@ -25,6 +25,7 @@ import GHC ( LoadHowMuch(..), Target(..), TargetId(..),
  45. Module, ModuleName, TyThing(..), Phase,
  46. BreakIndex, SrcSpan, Resume, SingleStep,
  47. Ghc, handleSourceError )
  48. +import GoalCollector
  49. import PprTyThing
  50. import DynFlags
  51. @@ -120,6 +121,7 @@ builtin_commands = [
  52. ("cd", keepGoing changeDirectory, Just filenameWordBreakChars, completeFilename),
  53. ("check", keepGoing checkModule, Nothing, completeHomeModule),
  54. ("continue", keepGoing continueCmd, Nothing, completeNone),
  55. + ("goals", keepGoing goalsCmd, Nothing, completeIdentifier),
  56. ("cmd", keepGoing cmdCmd, Nothing, completeIdentifier),
  57. ("ctags", keepGoing createCTagsFileCmd, Just filenameWordBreakChars, completeFilename),
  58. ("def", keepGoing (defineMacro False), Nothing, completeIdentifier),
  59. @@ -985,7 +987,6 @@ editFile str =
  60. chooseEditFile :: GHCi String
  61. chooseEditFile =
  62. do let hasFailed x = fmap not $ GHC.isLoaded $ GHC.ms_mod_name x
  63. -
  64. graph <- GHC.getModuleGraph
  65. failed_graph <- filterM hasFailed graph
  66. let order g = flattenSCCs $ GHC.topSortModuleGraph True g Nothing
  67. @@ -1208,6 +1209,32 @@ modulesLoadedMsg ok mods = do
  68. Succeeded ->
  69. io (putStrLn (showSDoc (text "Ok, modules loaded: " <> mod_commas)))
  70. +goalsCmd :: String -> GHCi ()
  71. +goalsCmd s
  72. + = handleSourceError (\e -> GHC.printExceptionAndWarnings e) $ do
  73. + let strs = words s
  74. + dflags <- getDynFlags
  75. + let pefas = dopt Opt_PrintExplicitForalls dflags
  76. + case strs of
  77. + [] -> contextAll dflags ["undefined"]
  78. + _ -> contextAll dflags strs
  79. + where
  80. + contextAll dflags strs = do
  81. + mods <- getLoadedModules
  82. + case mods of
  83. + [] -> io (putStrLn (showSDoc (text "Failed, no loaded modules to query for goals.")))
  84. + mod:_ ->
  85. + do prev_context <- GHC.getContext
  86. + r <- GHC.typecheckModule =<< GHC.parseModule mod
  87. + let types = goalsFor r strs
  88. + pefas = dopt Opt_PrintExplicitForalls dflags
  89. + mapM_ (\(n, s, ts) -> printForUser $ sep [text n, nest 2 (dcolon <+> pprTypeSpecForUser pefas ts), text " -- Used in", ppr s]) types
  90. +
  91. +pprTypeSpecForUser pefas (ts, ty) =
  92. + (if null ts
  93. + then empty
  94. + else parens (pprWithCommas (pprTypeForUser pefas) ts) <+> text "=>")
  95. + <+> pprTypeForUser pefas ty
  96. typeOfExpr :: String -> GHCi ()
  97. typeOfExpr str
  98. diff --git a/compiler/main/GoalCollector.hs b/compiler/main/GoalCollector.hs
  99. new file mode 100644
  100. index 0000000..b2c1c4e
  101. --- /dev/null
  102. +++ b/compiler/main/GoalCollector.hs
  103. @@ -0,0 +1,109 @@
  104. +module GoalCollector (
  105. + TypeSpec
  106. + , GoalInfo
  107. + , goalsFor
  108. + ) where
  109. +
  110. +import SrcLoc
  111. +import Var
  112. +import HsSyn
  113. +import NameSet
  114. +import Name hiding (varName)
  115. +import HsTypes
  116. +import Data.Data
  117. +import VarEnv
  118. +import SybUtils
  119. +import Type
  120. +import TypeRep
  121. +import GHC (typecheckedSource, TypecheckedModule)
  122. +
  123. +type TypeSpec =
  124. + ( [Type] -- ^ Predicate information.
  125. + , Type -- ^ The actual goal type.
  126. + )
  127. +
  128. +type GoalInfo = (String, SrcSpan, TypeSpec)
  129. +
  130. +goalsFor :: TypecheckedModule -> [String] -> [GoalInfo]
  131. +goalsFor mod names =
  132. + map (\(n, s, ts) -> (n, s, cleanupTypeSpec ts))
  133. + $ collectGoalInfo names (error "no top-level SrcSpan found") [] (typecheckedSource mod)
  134. +
  135. +cleanupTypeSpec :: TypeSpec -> TypeSpec
  136. +cleanupTypeSpec (preds, ty) = (map tidy preds, tidy ty)
  137. + where tidy = tidyType emptyTidyEnv
  138. +
  139. +collectGoalInfo :: [String] -> SrcSpan -> [DictId] -> GenericQ [GoalInfo]
  140. +collectGoalInfo goalNames loc dicts x
  141. + | excluded x = []
  142. + | otherwise = (topQuery `catQ` recQuery)
  143. + `extQ` locChangeCase
  144. + `extQ` predChangeCase $ x
  145. + where catQ r s x = r x ++ s x
  146. + topQuery = mkQ [] (collectGoalInfoVar goalNames loc dicts)
  147. + recQuery :: GenericQ [GoalInfo]
  148. + recQuery = concat . gmapQ (collectGoalInfo goalNames loc dicts)
  149. + locChangeCase :: LHsExpr Id -> [GoalInfo]
  150. + locChangeCase (L newloc child) = collectGoalInfo goalNames newloc dicts child
  151. + excluded = False `mkQ` ((const True) :: NameSet -> Bool)
  152. + predChangeCase :: HsBind Id -> [GoalInfo]
  153. + predChangeCase (AbsBinds _ newdicts child1 child2) =
  154. + let f :: GenericQ [GoalInfo]
  155. + f = collectGoalInfo goalNames loc newdicts
  156. + in f child1 ++ f child2
  157. + predChangeCase x = recQuery x
  158. +
  159. +collectGoalInfoVar :: [String] -> SrcSpan -> [DictId] -> HsExpr Id -> [GoalInfo]
  160. +collectGoalInfoVar goalNames loc dicts ((HsWrap wrap (HsVar var)))
  161. + | varNameString var `elem` goalNames = [(varNameString var, loc, typeSpec)]
  162. + where typeSpec = (map varType dicts, reduceUnwrap wrap (varType var))
  163. +collectGoalInfoVar _ _ _ _ = []
  164. +
  165. +varNameString :: Var -> String
  166. +varNameString var = occNameString . nameOccName . varName $ var
  167. +
  168. +reduceUnwrap :: HsWrapper -> Type -> Type
  169. +reduceUnwrap wr ty = reduce_type $ unwrap wr ty
  170. +
  171. +unwrap :: HsWrapper -> Type -> Type
  172. +unwrap WpHole t = t
  173. +unwrap (WpCompose w1 w2) t = unwrap w1 (unwrap w2 t)
  174. +unwrap (WpCast _) t = t -- XXX: really?
  175. +unwrap (WpTyApp t') t = AppTy t t'
  176. +unwrap (WpTyLam tv) t = ForAllTy tv t
  177. +-- do something else with coercion/dict vars?
  178. +unwrap (WpApp v) t = AppTy t (TyVarTy v)
  179. +unwrap (WpLam v) t = ForAllTy v t
  180. +
  181. +-- | Reduce a top-level type application if possible. That is, we perform the
  182. +-- following simplification step:
  183. +-- @
  184. +-- (forall v . t) t' ==> t [t'/v]
  185. +-- @
  186. +-- where @[t'/v]@ is the substitution of @t'@ for @v@.
  187. +--
  188. +reduce_type :: Type -> Type
  189. +reduce_type (AppTy (ForAllTy tv b) t) = reduce_type (subst_type tv t b)
  190. +reduce_type (AppTy a t) = reduce_type (AppTy (reduce_type a) (reduce_type t))
  191. +reduce_type t = t
  192. +
  193. +subst_type :: TyVar -> Type -> Type -> Type
  194. +subst_type v t' t0 = go t0
  195. + where
  196. + go t = case t of
  197. + TyVarTy tv
  198. + | tv == v -> t'
  199. + | otherwise -> t
  200. + AppTy t1 t2 -> AppTy (go t1) (go t2)
  201. + TyConApp c ts -> TyConApp c (map go ts)
  202. + FunTy t1 t2 -> FunTy (go t1) (go t2)
  203. + ForAllTy v' bt
  204. + | v == v' -> t
  205. + | otherwise -> ForAllTy v' (go bt)
  206. + PredTy pt -> PredTy (go_pt pt)
  207. +
  208. + -- XXX: this is probably not right
  209. + go_pt (ClassP c ts) = ClassP c (map go ts)
  210. + go_pt (IParam i t) = IParam i (go t)
  211. + go_pt (EqPred t1 t2) = EqPred (go t1) (go t2)
  212. +
  213. diff --git a/compiler/utils/SybUtils.hs b/compiler/utils/SybUtils.hs
  214. new file mode 100644
  215. index 0000000..d589225
  216. --- /dev/null
  217. +++ b/compiler/utils/SybUtils.hs
  218. @@ -0,0 +1,431 @@
  219. +{-# LANGUAGE StandaloneDeriving
  220. + , DeriveDataTypeable
  221. + #-}
  222. +module SybUtils where
  223. +
  224. +import SrcLoc
  225. +import RdrName
  226. +import FastString
  227. +import Bag
  228. +import Module
  229. +import BasicTypes
  230. +import Var
  231. +import ForeignCall
  232. +
  233. +import Data.Data
  234. +import NameSet
  235. +import TypeRep
  236. +import qualified TyCon
  237. +
  238. +import HsSyn
  239. +import Name
  240. +import DataCon
  241. +import Class
  242. +
  243. +#include "Typeable.h"
  244. +
  245. +type GenericQ r = forall a. Data a => a -> r
  246. +
  247. +-- | A variation of 'everything', using a 'GenericQ Bool' to skip
  248. +-- parts of the input 'Data'.
  249. +everythingBut :: GenericQ Bool -> (r -> r -> r) -> r -> GenericQ r -> GenericQ r
  250. +everythingBut q k z f x
  251. + | q x = z
  252. + | otherwise = foldl k (f x) (gmapQ (everythingBut q k z f) x)
  253. +
  254. +-- | The type constructor used in definition of gmapQr
  255. +newtype Qr r a = Qr { unQr :: r -> r }
  256. +
  257. +-- | Make a generic query;
  258. +-- start from a type-specific case;
  259. +-- return a constant otherwise
  260. +--
  261. +mkQ :: ( Typeable a
  262. + , Typeable b
  263. + )
  264. + => r
  265. + -> (b -> r)
  266. + -> a
  267. + -> r
  268. +(r `mkQ` br) a = case cast a of
  269. + Just b -> br b
  270. + Nothing -> r
  271. +
  272. +-- | Extend a generic query by a type-specific case
  273. +extQ :: ( Typeable a
  274. + , Typeable b
  275. + )
  276. + => (a -> q)
  277. + -> (b -> q)
  278. + -> a
  279. + -> q
  280. +extQ f g a = maybe (f a) g (cast a)
  281. +
  282. +-- | A generic query with a right-associative binary operator
  283. +-- gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
  284. +-- gmapQr o r0 f x0 = unQr (gfoldl k (const (Qr id)) x0) r0
  285. +-- where
  286. +-- k (Qr c) x = Qr (\r -> c (f x `o` r))
  287. +
  288. +-- | A generic query that processes the immediate subterms and returns a list
  289. +-- of results. The list is given in the same order as originally specified
  290. +-- in the declaratoin of the data constructors.
  291. +-- gmapQ :: (forall d. Data d => d -> u) -> a -> [u]
  292. +-- gmapQ f = gmapQr (:) [] f
  293. +
  294. +
  295. +
  296. +
  297. +
  298. +-- TODO: good for generalized show, but is this sound in general?
  299. +abstractConstr :: String -> Constr
  300. +abstractConstr n = mkConstr (abstractDataType n) ("{abstract:"++n++"}") [] Prefix
  301. +
  302. +abstractDataType :: String -> DataType
  303. +abstractDataType n = mkDataType n [abstractConstr n]
  304. +
  305. +-- Typeable0
  306. +
  307. +INSTANCE_TYPEABLE0(SrcSpan,srcSpanTc,"SrcSpan")
  308. +instance Data SrcSpan where
  309. + -- don't traverse?
  310. + toConstr _ = abstractConstr "SrcSpan"
  311. + gunfold _ _ = error "gunfold"
  312. + dataTypeOf _ = mkNorepType "SrcSpan"
  313. +
  314. +INSTANCE_TYPEABLE0(Module,moduleTc,"Module")
  315. +instance Data Module where
  316. + -- don't traverse?
  317. + toConstr _ = abstractConstr "Module"
  318. + gunfold _ _ = error "gunfold"
  319. + dataTypeOf _ = mkNorepType "Module"
  320. +
  321. +INSTANCE_TYPEABLE0(ModuleName,moduleNameTc,"ModuleName")
  322. +instance Data ModuleName where
  323. + -- don't traverse?
  324. + toConstr _ = abstractConstr "ModuleName"
  325. + gunfold _ _ = error "gunfold"
  326. + dataTypeOf _ = mkNorepType "ModuleName"
  327. +
  328. +deriving instance Typeable RdrName
  329. +deriving instance Data RdrName
  330. +
  331. +INSTANCE_TYPEABLE0(OccName,occNameTc,"OccName")
  332. +instance Data OccName where
  333. + -- don't traverse?
  334. + toConstr _ = abstractConstr "OccName"
  335. + gunfold _ _ = error "gunfold"
  336. + dataTypeOf _ = mkNorepType "OccName"
  337. +
  338. +INSTANCE_TYPEABLE0(Name,nameTc,"Name")
  339. +instance Data Name where
  340. + -- don't traverse?
  341. + toConstr _ = abstractConstr "Name"
  342. + gunfold _ _ = error "gunfold"
  343. + dataTypeOf _ = mkNorepType "Name"
  344. +
  345. +deriving instance Typeable FastString
  346. +instance Data FastString where
  347. + -- don't traverse?
  348. + toConstr _ = abstractConstr "FastString"
  349. + gunfold _ _ = error "gunfold"
  350. + dataTypeOf _ = mkNorepType "FastString"
  351. +
  352. +deriving instance Typeable HsExplicitForAll
  353. +deriving instance Data HsExplicitForAll
  354. +
  355. +deriving instance Typeable HsBang
  356. +deriving instance Data HsBang
  357. +
  358. +deriving instance Typeable Boxity
  359. +deriving instance Data Boxity
  360. +
  361. +deriving instance Typeable OverLitVal
  362. +deriving instance Data OverLitVal
  363. +
  364. +deriving instance Typeable RecFlag
  365. +deriving instance Data RecFlag
  366. +
  367. +deriving instance Typeable BasicTypes.Fixity
  368. +deriving instance Data BasicTypes.Fixity
  369. +
  370. +deriving instance Typeable HsArrAppType
  371. +deriving instance Data HsArrAppType
  372. +
  373. +deriving instance Typeable FixityDirection
  374. +deriving instance Data FixityDirection
  375. +
  376. +INSTANCE_TYPEABLE0(DataCon,dataConTc,"DataCon")
  377. +instance Data DataCon where
  378. + -- don't traverse?
  379. + toConstr _ = abstractConstr "DataCon"
  380. + gunfold _ _ = error "gunfold"
  381. + dataTypeOf _ = mkNorepType "DataCon"
  382. +
  383. +INSTANCE_TYPEABLE0(Var,varTc,"Var")
  384. +instance Data Var where
  385. + -- don't traverse?
  386. + toConstr _ = abstractConstr "Var"
  387. + gunfold _ _ = error "gunfold"
  388. + dataTypeOf _ = mkNorepType "Var"
  389. +
  390. +deriving instance Typeable InlineSpec
  391. +deriving instance Data InlineSpec
  392. +
  393. +deriving instance Typeable InlinePragma
  394. +deriving instance Data InlinePragma
  395. +
  396. +deriving instance Typeable RuleMatchInfo
  397. +deriving instance Data RuleMatchInfo
  398. +
  399. +deriving instance Typeable ForeignImport
  400. +deriving instance Data ForeignImport
  401. +
  402. +deriving instance Typeable ForeignExport
  403. +deriving instance Data ForeignExport
  404. +
  405. +deriving instance Typeable CImportSpec
  406. +deriving instance Data CImportSpec
  407. +
  408. +deriving instance Typeable CExportSpec
  409. +deriving instance Data CExportSpec
  410. +
  411. +deriving instance Typeable DNCallSpec
  412. +deriving instance Data DNCallSpec
  413. +
  414. +deriving instance Typeable Safety
  415. +deriving instance Data Safety
  416. +
  417. +deriving instance Typeable CCallConv
  418. +deriving instance Data CCallConv
  419. +
  420. +deriving instance Typeable DNKind
  421. +deriving instance Data DNKind
  422. +
  423. +deriving instance Typeable DNType
  424. +deriving instance Data DNType
  425. +
  426. +deriving instance Typeable CCallTarget
  427. +deriving instance Data CCallTarget
  428. +
  429. +deriving instance Typeable Activation
  430. +deriving instance Data Activation
  431. +
  432. +INSTANCE_TYPEABLE0(NameSet,nameSetTc,"NameSet")
  433. +instance Data NameSet where
  434. + gfoldl k z s = z mkNameSet `k` nameSetToList s -- traverse abstractly
  435. + toConstr _ = abstractConstr "NameSet"
  436. + gunfold _ _ = error "gunfold"
  437. + dataTypeOf _ = mkNorepType "NameSet"
  438. +
  439. +deriving instance Typeable FoType
  440. +deriving instance Data FoType
  441. +
  442. +deriving instance Typeable FamilyFlavour
  443. +deriving instance Data FamilyFlavour
  444. +
  445. +deriving instance Typeable NewOrData
  446. +deriving instance Data NewOrData
  447. +
  448. +INSTANCE_TYPEABLE0(TyCon.TyCon,tyConTc,"TyCon")
  449. +instance Data TyCon.TyCon where
  450. + -- don't traverse?
  451. + toConstr _ = abstractConstr "TyCon.TyCon"
  452. + gunfold _ _ = error "gunfold"
  453. + dataTypeOf _ = mkNorepType "TyCon.TyCon"
  454. +
  455. +INSTANCE_TYPEABLE0(Class,classTc,"Class")
  456. +instance Data Class where
  457. + -- don't traverse?
  458. + toConstr _ = abstractConstr "Class"
  459. + gunfold _ _ = error "gunfold"
  460. + dataTypeOf _ = mkNorepType "Class"
  461. +
  462. +deriving instance Typeable Prag
  463. +deriving instance Data Prag
  464. +
  465. +deriving instance Typeable HsWrapper
  466. +deriving instance Data HsWrapper
  467. +
  468. +deriving instance Typeable PredType
  469. +deriving instance Data PredType
  470. +
  471. +deriving instance Typeable Type
  472. +deriving instance Data Type
  473. +
  474. +deriving instance Typeable HsLit
  475. +deriving instance Data HsLit
  476. +
  477. +-- Typeable1
  478. +
  479. +deriving instance Typeable1 Located
  480. +deriving instance Data e => Data (Located e)
  481. +
  482. +deriving instance Typeable1 HsModule
  483. +deriving instance Data a => Data (HsModule a)
  484. +
  485. +deriving instance Typeable1 HsDoc
  486. +deriving instance Data a => Data (HsDoc a)
  487. +
  488. +deriving instance Typeable1 HaddockModInfo
  489. +deriving instance Data a => Data (HaddockModInfo a)
  490. +
  491. +deriving instance Typeable1 HsDecl
  492. +deriving instance Data a => Data (HsDecl a)
  493. +
  494. +deriving instance Typeable1 ImportDecl
  495. +deriving instance Data a => Data (ImportDecl a)
  496. +
  497. +deriving instance Typeable1 IE
  498. +deriving instance Data a => Data (IE a)
  499. +
  500. +deriving instance Typeable1 TyClDecl
  501. +deriving instance Data a => Data (TyClDecl a)
  502. +
  503. +deriving instance Typeable1 DocDecl
  504. +deriving instance Data a => Data (DocDecl a)
  505. +
  506. +deriving instance Typeable1 SpliceDecl
  507. +deriving instance Data a => Data (SpliceDecl a)
  508. +
  509. +deriving instance Typeable1 RuleDecl
  510. +deriving instance Data a => Data (RuleDecl a)
  511. +
  512. +deriving instance Typeable WarningTxt
  513. +deriving instance Data WarningTxt
  514. +
  515. +deriving instance Typeable1 WarnDecl
  516. +deriving instance Data a => Data (WarnDecl a)
  517. +
  518. +deriving instance Typeable1 ForeignDecl
  519. +deriving instance Data a => Data (ForeignDecl a)
  520. +
  521. +deriving instance Typeable1 DefaultDecl
  522. +deriving instance Data a => Data (DefaultDecl a)
  523. +
  524. +deriving instance Typeable1 Sig
  525. +deriving instance Data a => Data (Sig a)
  526. +
  527. +deriving instance Typeable1 DerivDecl
  528. +deriving instance Data a => Data (DerivDecl a)
  529. +
  530. +deriving instance Typeable1 InstDecl
  531. +deriving instance Data a => Data (InstDecl a)
  532. +
  533. +deriving instance Typeable1 HsPred
  534. +deriving instance Data a => Data (HsPred a)
  535. +
  536. +deriving instance Typeable1 HsType
  537. +deriving instance Data a => Data (HsType a)
  538. +
  539. +deriving instance Typeable1 ConDecl
  540. +deriving instance Data a => Data (ConDecl a)
  541. +
  542. +INSTANCE_TYPEABLE1(Bag,bagTc,"Bag")
  543. +instance Data a => Data (Bag a) where
  544. + gfoldl k z b = z listToBag `k` bagToList b -- traverse abstract type abstractly
  545. + toConstr _ = abstractConstr $ "Bag("++show (typeOf (undefined::a))++")"
  546. + gunfold _ _ = error "gunfold"
  547. + dataTypeOf _ = mkNorepType "Bag"
  548. +
  549. +deriving instance Typeable1 HsTyVarBndr
  550. +deriving instance Data a => Data (HsTyVarBndr a)
  551. +
  552. +deriving instance Typeable1 ResType
  553. +deriving instance Data a => Data (ResType a)
  554. +
  555. +deriving instance Typeable1 HsSplice
  556. +deriving instance Data a => Data (HsSplice a)
  557. +
  558. +deriving instance Typeable1 ConDeclField
  559. +deriving instance Data a => Data (ConDeclField a)
  560. +
  561. +deriving instance Typeable1 IPName
  562. +deriving instance Data a => Data (IPName a)
  563. +
  564. +deriving instance Typeable1 MatchGroup
  565. +deriving instance Data a => Data (MatchGroup a)
  566. +
  567. +deriving instance Typeable1 Pat
  568. +deriving instance Data a => Data (Pat a)
  569. +
  570. +deriving instance Typeable1 GRHSs
  571. +deriving instance Data a => Data (GRHSs a)
  572. +
  573. +deriving instance Typeable1 HsExpr
  574. +deriving instance Data a => Data (HsExpr a)
  575. +
  576. +deriving instance Typeable1 HsQuasiQuote
  577. +deriving instance Data a => Data (HsQuasiQuote a)
  578. +
  579. +deriving instance Typeable1 HsOverLit
  580. +deriving instance Data a => Data (HsOverLit a)
  581. +
  582. +deriving instance Typeable1 ArithSeqInfo
  583. +deriving instance Data a => Data (ArithSeqInfo a)
  584. +
  585. +deriving instance Typeable1 HsBracket
  586. +deriving instance Data a => Data (HsBracket a)
  587. +
  588. +deriving instance Typeable1 HsCmdTop
  589. +deriving instance Data a => Data (HsCmdTop a)
  590. +
  591. +deriving instance Typeable1 HsGroup
  592. +deriving instance Data a => Data (HsGroup a)
  593. +
  594. +deriving instance Typeable1 FixitySig
  595. +deriving instance Data a => Data (FixitySig a)
  596. +
  597. +deriving instance Typeable1 HsIPBinds
  598. +deriving instance Data a => Data (HsIPBinds a)
  599. +
  600. +deriving instance Typeable1 IPBind
  601. +deriving instance Data a => Data (IPBind a)
  602. +
  603. +deriving instance Typeable1 GroupByClause
  604. +deriving instance Data a => Data (GroupByClause a)
  605. +
  606. +deriving instance Typeable1 HsStmtContext
  607. +deriving instance Data a => Data (HsStmtContext a)
  608. +
  609. +deriving instance Typeable1 HsMatchContext
  610. +deriving instance Data a => Data (HsMatchContext a)
  611. +
  612. +deriving instance Typeable1 GRHS
  613. +deriving instance Data a => Data (GRHS a)
  614. +
  615. +deriving instance Typeable1 Match
  616. +deriving instance Data a => Data (Match a)
  617. +
  618. +deriving instance Typeable1 RuleBndr
  619. +deriving instance Data a => Data (RuleBndr a)
  620. +
  621. +-- Typeable2
  622. +
  623. +deriving instance Typeable2 HsBindLR
  624. +deriving instance (Data a,Data b) => Data (HsBindLR a b)
  625. +
  626. +deriving instance Typeable2 StmtLR
  627. +deriving instance (Data a,Data b) => Data (StmtLR a b)
  628. +
  629. +deriving instance Typeable2 HsLocalBindsLR
  630. +deriving instance (Data a,Data b) => Data (HsLocalBindsLR a b)
  631. +
  632. +deriving instance Typeable2 HsValBindsLR
  633. +deriving instance (Data a,Data b) => Data (HsValBindsLR a b)
  634. +
  635. +deriving instance Typeable2 HsConDetails
  636. +deriving instance (Data a,Data b) => Data (HsConDetails a b)
  637. +
  638. +deriving instance Typeable2 HsRecFields
  639. +deriving instance (Data a,Data b) => Data (HsRecFields a b)
  640. +
  641. +deriving instance Typeable2 HsRecField
  642. +deriving instance (Data a,Data b) => Data (HsRecField a b)
  643. +
  644. +deriving instance Data a => Data (AnnDecl a)
  645. +deriving instance Typeable1 AnnDecl
  646. +
  647. +deriving instance Data a => Data (AnnProvenance a)
  648. +deriving instance Typeable1 AnnProvenance
  649. +
  650. --
  651. 1.5.4.5