- = case maybeWiredInTyConName name of
- Just tc -> returnTc (kindToTcKind (tyConKind tc), synTyConArity tc, tc)
- Nothing -> tcGetEnv `thenNF_Tc` \ (TcEnv tve tce ce gve lve gtvs) ->
- case lookupUFM tce name of
- Just stuff -> returnTc stuff
- Nothing -> -- Could be that he's using a class name as a type constructor
- case lookupUFM ce name of
- Just _ -> failTc (classAsTyConErr name)
- Nothing -> pprPanic "tcLookupTyCon:" (ppr PprDebug name)
+ = -- Try for a wired-in tycon
+ case maybeWiredInTyConName name of {
+ Just tc | isSynTyCon tc -> returnTc (kind, Just (tyConArity tc), tc)
+ | otherwise -> returnTc (kind, Nothing, tc)
+ where {
+ kind = kindToTcKind (tyConKind tc)
+ };
+
+ Nothing ->
+
+ -- Try in the environment
+ tcGetEnv `thenNF_Tc` \ (TcEnv tve tce ce gve lve gtvs) ->
+ case lookupUFM tce name of {
+ Just stuff -> returnTc stuff;
+
+ Nothing ->
+
+ -- Could be that he's using a class name as a type constructor
+ case lookupUFM ce name of
+ Just _ -> failTc (classAsTyConErr name)
+ Nothing -> pprPanic "tcLookupTyCon:" (ppr PprDebug name)
+ } }