git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #421, match type instance heads eagerly
commitf5d7b7ff524c10457bee2e0d3d188feb4f824996 authorPhil Freeman <paf31@cantab.net> dateThu 20 Aug 2015, 12:01 (11 years ago) parentd724165
9 files changed+91−140
src/Language/PureScript/AST/Declarations.hs+1−1 src/Language/PureScript/AST/Traversals.hs+1−1 src/Language/PureScript/Docs/ParseAndDesugar.hs+1−1 src/Language/PureScript/Pretty/Values.hs+1−1 src/Language/PureScript/TypeChecker.hs+5−13 src/Language/PureScript/TypeChecker/Entailment.hs+48−88 src/Language/PureScript/TypeChecker/Subsumption.hs+1−1 src/Language/PureScript/TypeChecker/Types.hs+26−15 src/Language/PureScript/TypeClassDictionaries.hs+7−19
src/Language/PureScript/AST/Declarations.hs+1−1
@@ -386,7 +386,7 @@ data Expr
386386 -- at superclass implementations when searching for a dictionary, the type class name and
387387 -- instance type, and the type class dictionaries in scope.
388388 --
389− | TypeClassDictionary Bool Constraint (M.Map (Maybe ModuleName) (M.Map (Qualified ProperName) (M.Map (Qualified Ident) TypeClassDictionaryInScope)))
389+ | TypeClassDictionary Constraint (M.Map (Maybe ModuleName) (M.Map (Qualified ProperName) (M.Map (Qualified Ident) TypeClassDictionaryInScope)))
390390 -- |
391391 -- A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring.
392392 --
src/Language/PureScript/AST/Traversals.hs+1−1
@@ -396,7 +396,7 @@ accumTypes f = everythingOnValues mappend forDecls forValues (const mempty) (con
396396 forDecls (TypeDeclaration _ ty) = f ty
397397 forDecls _ = mempty
398398
399− forValues (TypeClassDictionary _ (_, cs) _) = mconcat (map f cs)
399+ forValues (TypeClassDictionary (_, cs) _) = mconcat (map f cs)
400400 forValues (SuperClassDictionary _ tys) = mconcat (map f tys)
401401 forValues (TypedValue _ _ ty) = f ty
402402 forValues _ = mempty
src/Language/PureScript/Docs/ParseAndDesugar.hs+1−1
@@ -11,7 +11,7 @@ import Control.Monad
1111import Control.Applicative
1212
1313import Control.Monad.Trans.Except
14−import Control.Monad.Writer (WriterT(), runWriterT)
14+import Control.Monad.Writer (runWriterT)
1515import Control.Monad.Error.Class (MonadError(..))
1616import Control.Monad.IO.Class (MonadIO(..))
1717
src/Language/PureScript/Pretty/Values.hs+1−1
@@ -74,7 +74,7 @@ literals = mkPattern' match
7474 ]
7575 match (OperatorSection op (Right val)) = return $ "(" ++ prettyPrintValue op ++ " " ++ prettyPrintValue val ++ ")"
7676 match (OperatorSection op (Left val)) = return $ "(" ++ prettyPrintValue val ++ " " ++ prettyPrintValue op ++ ")"
77− match (TypeClassDictionary _ (name, tys) _) = return $ "<<dict " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom tys) ++ ">>"
77+ match (TypeClassDictionary (name, tys) _) = return $ "<<dict " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom tys) ++ ">>"
7878 match (SuperClassDictionary name _) = return $ "<<superclass dict " ++ show name ++ ">>"
7979 match (TypedValue _ val _) = prettyPrintValue' val
8080 match (PositionedValue _ _ val) = prettyPrintValue' val
src/Language/PureScript/TypeChecker.hs+5−13
@@ -130,7 +130,7 @@ checkTypeSynonyms = void . replaceAllTypeSynonyms
130130-- * Process module imports
131131--
132132typeCheckAll :: Maybe ModuleName -> ModuleName -> [DeclarationRef] -> [Declaration] -> Check [Declaration]
133−typeCheckAll mainModuleName moduleName exps ds = mapM go ds <* mapM_ checkOrphanFixities ds
133+typeCheckAll mainModuleName moduleName _ ds = mapM go ds <* mapM_ checkOrphanFixities ds
134134 where
135135 go :: Declaration -> Check Declaration
136136 go (DataDeclaration dtype name args dctors) = do
@@ -236,16 +236,16 @@ typeCheckAll mainModuleName moduleName exps ds = mapM go ds <* mapM_ checkOrphan
236236 mapM_ (checkTypeClassInstance moduleName) tys
237237 forM_ deps $ mapM_ (checkTypeClassInstance moduleName) . snd
238238 checkOrphanInstance moduleName className tys
239− let dict = TypeClassDictionaryInScope (Qualified (Just moduleName) dictName) className tys (Just deps) TCDRegular isInstanceExported
239+ let dict = TypeClassDictionaryInScope (Qualified (Just moduleName) dictName) [] className tys (Just deps) TCDRegular
240240 addTypeClassDictionaries (Just moduleName) . M.singleton className $ M.singleton (canonicalizeDictionary dict) dict
241241 return d
242242
243243 where
244244
245245 checkOrphanInstance :: ModuleName -> Qualified ProperName -> [Type] -> Check ()
246− checkOrphanInstance mn (Qualified (Just mn') _) tys
247− | mn == mn' || any checkType tys = return ()
248− | otherwise = throwError . errorMessage $ OrphanInstance dictName className tys
246+ checkOrphanInstance mn (Qualified (Just mn') _) tys'
247+ | mn == mn' || any checkType tys' = return ()
248+ | otherwise = throwError . errorMessage $ OrphanInstance dictName className tys'
249249 where
250250 checkType :: Type -> Bool
251251 checkType (TypeVar _) = False
@@ -255,14 +255,6 @@ typeCheckAll mainModuleName moduleName exps ds = mapM go ds <* mapM_ checkOrphan
255255 checkType _ = error "Invalid type in instance in checkOrphanInstance"
256256 checkOrphanInstance _ _ _ = error "Unqualified class name in checkOrphanInstance"
257257
258− isInstanceExported :: Bool
259− isInstanceExported = any exportsInstance exps
260−
261− exportsInstance :: DeclarationRef -> Bool
262− exportsInstance (TypeInstanceRef name) | name == dictName = True
263− exportsInstance (PositionedDeclarationRef _ _ r) = exportsInstance r
264− exportsInstance _ = False
265−
266258 -- |
267259 -- This function adds the argument kinds for a type constructor so that they may appear in the externs file,
268260 -- extracted from the kind of the type constructor itself.
src/Language/PureScript/TypeChecker/Entailment.hs+48−88
@@ -41,13 +41,11 @@ import Language.PureScript.TypeClassDictionaries
4141import Language.PureScript.Types
4242import qualified Language.PureScript.Constants as C
4343
44−newtype Work = Work Integer deriving (Show, Eq, Ord, Num)
45−
4644-- |
4745-- Check that the current set of type class dictionaries entail the specified type class goal, and, if so,
4846-- return a type class dictionary reference.
4947--
50−entails :: Environment -> ModuleName -> M.Map (Maybe ModuleName) (M.Map (Qualified ProperName) (M.Map (Qualified Ident) TypeClassDictionaryInScope)) -> Constraint -> Bool -> Check Expr
48+entails :: Environment -> ModuleName -> M.Map (Maybe ModuleName) (M.Map (Qualified ProperName) (M.Map (Qualified Ident) TypeClassDictionaryInScope)) -> Constraint -> Check Expr
5149entails env moduleName context = solve
5250 where
5351 forClassName :: Qualified ProperName -> [TypeClassDictionaryInScope]
@@ -56,56 +54,57 @@ entails env moduleName context = solve
5654 findDicts :: Qualified ProperName -> Maybe ModuleName -> [TypeClassDictionaryInScope]
5755 findDicts cn = maybe [] M.elems . (>>= M.lookup cn) . flip M.lookup context
5856
59− solve :: Constraint -> Bool -> Check Expr
60− solve (className, tys) trySuperclasses = do
61− let dicts = flip evalStateT (Work 0) $ go trySuperclasses className tys
62− checkOverlaps dicts
57+ solve :: Constraint -> Check Expr
58+ solve (className, tys) = do
59+ dict <- go 0 className tys
60+ return $ dictionaryValueToValue dict
6361 where
64− go :: Bool -> Qualified ProperName -> [Type] -> StateT Work [] DictionaryValue
65− go trySuperclasses' className' tys' = do
66− workDone <- get
67− guard $ workDone < 1000
68− modify (1 +)
69− directInstances <|> superclassInstances
62+ go :: Int -> Qualified ProperName -> [Type] -> Check DictionaryValue
63+ go work _ _ | work > 1000 = error "Overworked!"
64+ go work className' tys' = do
65+ let instances = do
66+ tcd <- forClassName className'
67+ -- Make sure the type unifies with the type in the type instance definition
68+ subst <- maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys' (tcdInstanceTypes tcd)
69+ return (subst, tcd)
70+ (subst, tcd) <- unique instances
71+ -- Solve any necessary subgoals
72+ args <- solveSubgoals subst (tcdDependencies tcd)
73+ return $ foldr (\(superclassName, index) dict -> SubclassDictionaryValue dict superclassName index)
74+ (mkDictionary (canonicalizeDictionary tcd) args)
75+ (tcdPath tcd)
7076 where
71− directInstances :: StateT Work [] DictionaryValue
72− directInstances = do
73− tcd <- lift $ forClassName className'
74− -- Make sure the type unifies with the type in the type instance definition
75− subst <- lift . maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys' (tcdInstanceTypes tcd)
76− -- Solve any necessary subgoals
77− args <- solveSubgoals subst (tcdDependencies tcd)
78− return $ mkDictionary (canonicalizeDictionary tcd) args
77+
78+ unique :: [(a, TypeClassDictionaryInScope)] -> Check (a, TypeClassDictionaryInScope)
79+ unique [] = throwError . errorMessage $ NoInstanceFound className' tys'
80+ unique [a] = return a
81+ unique xs@(x : _) | pairwise overlapping (map snd xs) = throwError . errorMessage $ OverlappingInstances className' tys' [] -- include overlaps in error, use simplest instance
82+ | otherwise = return x
7983
80− superclassInstances :: StateT Work [] DictionaryValue
81− superclassInstances = do
82− guard trySuperclasses'
83− (subclassName, (args, _, implies)) <- lift $ M.toList (typeClasses env)
84− -- Try each superclass
85− (index, (superclass, suTyArgs)) <- lift $ zip [0..] implies
86− -- Make sure the type class name matches the superclass name
87− guard $ className' == superclass
88− -- Make sure the types unify with the types in the superclass implication
89− subst <- lift . maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys' suTyArgs
90− -- Finally, satisfy the subclass constraint
91− args' <- lift . maybeToList $ mapM ((`lookup` subst) . fst) args
92− suDict <- go True subclassName args'
93− return $ SubclassDictionaryValue suDict superclass index
84+ -- |
85+ -- Check if two dictionaries are overlapping
86+ --
87+ -- Dictionaries which are subclass dictionaries cannot overlap, since otherwise the overlap would have
88+ -- been caught when constructing superclass dictionaries.
89+ overlapping :: TypeClassDictionaryInScope -> TypeClassDictionaryInScope -> Bool
90+ overlapping TypeClassDictionaryInScope{ tcdPath = _ : _ } _ = False
91+ overlapping _ TypeClassDictionaryInScope{ tcdPath = _ : _ } = False
92+ overlapping tcd1 tcd2 = tcdName tcd1 /= tcdName tcd2
9493
95− -- Create dictionaries for subgoals which still need to be solved by calling go recursively
96− -- E.g. the goal (Show a, Show b) => Show (Either a b) can be satisfied if the current type
97− -- unifies with Either a b, and we can satisfy the subgoals Show a and Show b recursively.
98− solveSubgoals :: [(String, Type)] -> Maybe [Constraint] -> StateT Work [] (Maybe [DictionaryValue])
99− solveSubgoals _ Nothing = return Nothing
100− solveSubgoals subst (Just subgoals) = do
101− dict <- mapM (uncurry (go True) . second (map (replaceAllTypeVars subst))) subgoals
102− return $ Just dict
94+ -- Create dictionaries for subgoals which still need to be solved by calling go recursively
95+ -- E.g. the goal (Show a, Show b) => Show (Either a b) can be satisfied if the current type
96+ -- unifies with Either a b, and we can satisfy the subgoals Show a and Show b recursively.
97+ solveSubgoals :: [(String, Type)] -> Maybe [Constraint] -> Check (Maybe [DictionaryValue])
98+ solveSubgoals _ Nothing = return Nothing
99+ solveSubgoals subst (Just subgoals) = do
100+ dict <- mapM (uncurry (go (work + 1)) . second (map (replaceAllTypeVars subst))) subgoals
101+ return $ Just dict
103102
104− -- Make a dictionary from subgoal dictionaries by applying the correct function
105− mkDictionary :: Qualified Ident -> Maybe [DictionaryValue] -> DictionaryValue
106− mkDictionary fnName Nothing = LocalDictionaryValue fnName
107− mkDictionary fnName (Just []) = GlobalDictionaryValue fnName
108− mkDictionary fnName (Just dicts) = DependentDictionaryValue fnName dicts
103+ -- Make a dictionary from subgoal dictionaries by applying the correct function
104+ mkDictionary :: Qualified Ident -> Maybe [DictionaryValue] -> DictionaryValue
105+ mkDictionary fnName Nothing = LocalDictionaryValue fnName
106+ mkDictionary fnName (Just []) = GlobalDictionaryValue fnName
107+ mkDictionary fnName (Just dicts) = DependentDictionaryValue fnName dicts
109108
110109 -- Turn a DictionaryValue into a Expr
111110 dictionaryValueToValue :: DictionaryValue -> Expr
@@ -122,46 +121,7 @@ entails env moduleName context = solve
122121 let grps = groupBy ((==) `on` fst) subst
123122 guard (all (pairwise (unifiesWith env) . map snd) grps)
124123 return $ map head grps
125− -- |
126− -- Check for overlapping instances
127− --
128− checkOverlaps :: [DictionaryValue] -> Check Expr
129− checkOverlaps dicts =
130− case [ (d1, d2) | d1 <- dicts, d2 <- dicts, d1 `overlapping` d2 ] of
131− ds@(_ : _) -> throwError . errorMessage $ OverlappingInstances className tys $ nub (map fst ds)
132− _ -> case chooseSimplestDictionaries dicts of
133− [] -> throwError . errorMessage $ NoInstanceFound className tys
134− d : _ -> return $ dictionaryValueToValue d
135− -- Choose the simplest DictionaryValues from a list of candidates
136− -- The reason for this function is as follows:
137− -- When considering overlapping instances, we don't want to consider the same dictionary
138− -- to be an overlap of itself when obtained as a superclass of another class.
139− -- Observing that we probably don't want to select a superclass instance when an instance
140− -- is available directly, and that there is no way for a superclass instance to actually
141− -- introduce an overlap that wouldn't have been there already, we simply remove dictionaries
142− -- obtained as superclass instances if there are simpler instances available.
143− chooseSimplestDictionaries :: [DictionaryValue] -> [DictionaryValue]
144− chooseSimplestDictionaries ds = case filter isSimpleDictionaryValue ds of
145− [] -> ds
146− simple -> simple
147− isSimpleDictionaryValue SubclassDictionaryValue{} = False
148− isSimpleDictionaryValue (DependentDictionaryValue _ ds) = all isSimpleDictionaryValue ds
149− isSimpleDictionaryValue _ = True
150− -- |
151− -- Check if two dictionaries are overlapping
152− --
153− -- Dictionaries which are subclass dictionaries cannot overlap, since otherwise the overlap would have
154− -- been caught when constructing superclass dictionaries.
155− --
156− overlapping :: DictionaryValue -> DictionaryValue -> Bool
157− overlapping (LocalDictionaryValue nm1) (LocalDictionaryValue nm2) | nm1 == nm2 = False
158− overlapping (GlobalDictionaryValue nm1) (GlobalDictionaryValue nm2) | nm1 == nm2 = False
159− overlapping (DependentDictionaryValue nm1 ds1) (DependentDictionaryValue nm2 ds2)
160− | nm1 == nm2 = or $ zipWith overlapping ds1 ds2
161− overlapping SubclassDictionaryValue{} _ = False
162− overlapping _ SubclassDictionaryValue{} = False
163− overlapping _ _ = True
164−
124+
165125 valUndefined :: Expr
166126 valUndefined = Var (Qualified (Just (ModuleName [ProperName C.prim])) (Ident C.undefined))
167127
src/Language/PureScript/TypeChecker/Subsumption.hs+1−1
@@ -69,7 +69,7 @@ subsumes' val ty1 (KindedType ty2 _) =
6969 subsumes val ty1 ty2
7070subsumes' (Just val) (ConstrainedType constraints ty1) ty2 = do
7171 dicts <- getTypeClassDictionaries
72− subsumes' (Just $ foldl App val (map (flip (TypeClassDictionary True) dicts) constraints)) ty1 ty2
72+ subsumes' (Just $ foldl App val (map (flip TypeClassDictionary dicts) constraints)) ty1 ty2
7373subsumes' val (TypeApp f1 r1) (TypeApp f2 r2) | f1 == tyObject && f2 == tyObject = do
7474 let
7575 (ts1, r1') = rowToList r1
src/Language/PureScript/TypeChecker/Types.hs+26−15
@@ -166,7 +166,7 @@ overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
166166 where
167167 g :: Expr -> Expr
168168 g (TypedValue checkTy val t) = TypedValue checkTy val (f t)
169− g (TypeClassDictionary b (nm, tys) sco) = TypeClassDictionary b (nm, map f tys) sco
169+ g (TypeClassDictionary (nm, tys) sco) = TypeClassDictionary (nm, map f tys) sco
170170 g other = other
171171
172172-- |
@@ -177,9 +177,9 @@ replaceTypeClassDictionaries mn =
177177 let (_, f, _) = everywhereOnValuesTopDownM return go return
178178 in f
179179 where
180− go (TypeClassDictionary trySuperclasses constraint dicts) = do
180+ go (TypeClassDictionary constraint dicts) = do
181181 env <- getEnv
182− entails env mn dicts constraint trySuperclasses
182+ entails env mn dicts constraint
183183 go other = return other
184184
185185-- |
@@ -202,7 +202,7 @@ instantiatePolyTypeWithUnknowns val (ForAll ident ty _) = do
202202instantiatePolyTypeWithUnknowns val (ConstrainedType constraints ty) = do
203203 dicts <- getTypeClassDictionaries
204204 (_, ty') <- instantiatePolyTypeWithUnknowns (error "Types under a constraint cannot themselves be constrained") ty
205− return (foldl App val (map (flip (TypeClassDictionary True) dicts) constraints), ty')
205+ return (foldl App val (map (flip TypeClassDictionary dicts) constraints), ty')
206206instantiatePolyTypeWithUnknowns val ty = return (val, ty)
207207
208208-- |
@@ -268,7 +268,7 @@ infer' (Var var) = do
268268 case ty of
269269 ConstrainedType constraints ty' -> do
270270 dicts <- getTypeClassDictionaries
271− return $ TypedValue True (foldl App (Var var) (map (flip (TypeClassDictionary True) dicts) constraints)) ty'
271+ return $ TypedValue True (foldl App (Var var) (map (flip TypeClassDictionary dicts) constraints)) ty'
272272 _ -> return $ TypedValue True (Var var) ty
273273infer' v@(Constructor c) = do
274274 env <- getEnv
@@ -292,7 +292,7 @@ infer' (Let ds val) = do
292292 return $ TypedValue True (Let ds' val') valTy
293293infer' (SuperClassDictionary className tys) = do
294294 dicts <- getTypeClassDictionaries
295− return $ TypeClassDictionary False (className, tys) dicts
295+ return $ TypeClassDictionary (className, tys) dicts
296296infer' (TypedValue checkType val ty) = do
297297 Just moduleName <- checkCurrentModule <$> get
298298 (kind, args) <- liftCheck $ kindOfWithScopedVars ty
@@ -449,10 +449,25 @@ check' val t@(ConstrainedType constraints ty) = do
449449 dictNames <- forM constraints $ \(Qualified _ (ProperName className), _) -> do
450450 n <- liftCheck freshDictionaryName
451451 return $ Ident $ "__dict_" ++ className ++ "_" ++ show n
452− val' <- withBindingGroupVisible $ withTypeClassDictionaries (zipWith (\name (className, instanceTy) ->
453− TypeClassDictionaryInScope name className instanceTy Nothing TCDRegular False) (map (Qualified Nothing) dictNames)
454− constraints) $ check val ty
452+ dicts <- join <$> liftCheck (zipWithM (newDictionaries []) (map (Qualified Nothing) dictNames) constraints)
453+ val' <- withBindingGroupVisible $ withTypeClassDictionaries dicts $ check val ty
455454 return $ TypedValue True (foldr (Abs . Left) val' dictNames) t
455+ where
456+ -- | Add a dictionary for the constraint to the scope, and dictionaries
457+ -- for all implies superclass instances.
458+ newDictionaries :: [(Qualified ProperName, Integer)] -> Qualified Ident -> (Qualified ProperName, [Type]) -> Check [TypeClassDictionaryInScope]
459+ newDictionaries path name (className, instanceTy) = do
460+ tcs <- gets (typeClasses . checkEnv)
461+ let (args, _, superclasses) = fromMaybe (error "newDictionaries: type class lookup failed") $ M.lookup className tcs
462+ supDicts <- join <$> zipWithM (\(supName, supArgs) index ->
463+ newDictionaries ((supName, index) : path)
464+ name
465+ (supName, instantiateSuperclass (map fst args) supArgs instanceTy)
466+ ) superclasses [0..]
467+ return (TypeClassDictionaryInScope name path className instanceTy Nothing TCDRegular : supDicts)
468+
469+ instantiateSuperclass :: [String] -> [Type] -> [Type] -> [Type]
470+ instantiateSuperclass args supArgs tys = traceShow (args, supArgs, tys) $ map (replaceAllTypeVars (zip args tys)) supArgs
456471check' val (SaturatedTypeSynonym name args) = do
457472 ty <- introduceSkolemScope <=< expandTypeSynonym name $ args
458473 check val ty
@@ -501,13 +516,9 @@ check' (SuperClassDictionary className tys) _ = do
501516 -- TypeClassDictionary placeholder. The reason we do this is that it is necessary to have the
502517 -- correct super instance dictionaries in scope, and these are not available when the type class
503518 -- declaration gets desugared.
504− --
505− -- Note also that the first argument to TypeClassDictionary is False, meaning we _do not_ want
506− -- to consider superclass instances when searching for this dictionary - doing so might lead
507− -- to traversing a cycle in the instance graph.
508519 -}
509520 dicts <- getTypeClassDictionaries
510− return $ TypeClassDictionary False (className, tys) dicts
521+ return $ TypeClassDictionary (className, tys) dicts
511522check' (TypedValue checkType val ty1) ty2 = do
512523 Just moduleName <- checkCurrentModule <$> get
513524 (kind, args) <- liftCheck $ kindOfWithScopedVars ty1
@@ -648,7 +659,7 @@ checkFunctionApplication' fn (KindedType ty _) arg ret =
648659 checkFunctionApplication fn ty arg ret
649660checkFunctionApplication' fn (ConstrainedType constraints fnTy) arg ret = do
650661 dicts <- getTypeClassDictionaries
651− checkFunctionApplication' (foldl App fn (map (flip (TypeClassDictionary True) dicts) constraints)) fnTy arg ret
662+ checkFunctionApplication' (foldl App fn (map (flip TypeClassDictionary dicts) constraints)) fnTy arg ret
652663checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} _ =
653664 return (fnTy, App fn dict)
654665checkFunctionApplication' _ fnTy arg _ = throwError . errorMessage $ CannotApplyFunction fnTy arg
src/Language/PureScript/TypeClassDictionaries.hs+7−19
@@ -26,30 +26,18 @@ import Language.PureScript.Types
2626--
2727data TypeClassDictionaryInScope
2828 = TypeClassDictionaryInScope {
29− -- |
30− -- The identifier with which the dictionary can be accessed at runtime
31− --
29+ -- | The identifier with which the dictionary can be accessed at runtime
3230 tcdName :: Qualified Ident
33− -- |
34− -- The name of the type class to which this type class instance applies
35− --
31+ -- | How to obtain this instance via superclass relationships
32+ , tcdPath :: [(Qualified ProperName, Integer)]
33+ -- | The name of the type class to which this type class instance applies
3634 , tcdClassName :: Qualified ProperName
37− -- |
38− -- The types to which this type class instance applies
39− --
35+ -- | The types to which this type class instance applies
4036 , tcdInstanceTypes :: [Type]
41− -- |
42− -- Type class dependencies which must be satisfied to construct this dictionary
43− --
37+ -- | Type class dependencies which must be satisfied to construct this dictionary
4438 , tcdDependencies :: Maybe [Constraint]
45− -- |
46− -- The type of this dictionary
47− --
39+ -- | The type of this dictionary
4840 , tcdType :: TypeClassDictionaryType
49− -- |
50− -- Is this instance exported by its module?
51− --
52− , tcdExported :: Bool
5341 } deriving (Show, Data, Typeable)
5442
5543-- |