aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs30
1 files changed, 12 insertions, 18 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
index a2cb8799..50cce3d5 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
@@ -47,32 +47,26 @@ specializeTyVarBndrs bndrs typs =
bname (KindedTyVar (L _ name) _) = name
-sugar :: (NamedThing name, DataId name) => HsType name -> HsType name
-sugar = sugarTuples . sugarLists
-
-
-sugarLists :: forall name. (NamedThing name, DataId name)
- => HsType name -> HsType name
-sugarLists = everywhere $ mkT (sugarListsStep :: HsType name -> HsType name)
+sugar :: forall name. (NamedThing name, DataId name)
+ => HsType name -> HsType name
+sugar =
+ everywhere $ mkT step
+ where
+ step :: HsType name -> HsType name
+ step = sugarTuples . sugarLists
-sugarListsStep :: NamedThing name => HsType name -> HsType name
-sugarListsStep (HsAppTy (L _ (HsTyVar name)) ltyp)
+sugarLists :: NamedThing name => HsType name -> HsType name
+sugarLists (HsAppTy (L _ (HsTyVar name)) ltyp)
| isBuiltInSyntax name' && strName == "[]" = HsListTy ltyp
where
name' = getName name
strName = occNameString . nameOccName $ name'
-sugarListsStep typ = typ
-
-
-sugarTuples :: forall name. (NamedThing name, DataId name)
- => HsType name -> HsType name
-sugarTuples = everywhere $
- mkT (sugarTuplesStep :: HsType name -> HsType name)
+sugarLists typ = typ
-sugarTuplesStep :: NamedThing name => HsType name -> HsType name
-sugarTuplesStep typ =
+sugarTuples :: NamedThing name => HsType name -> HsType name
+sugarTuples typ =
aux [] typ
where
aux apps (HsAppTy (L _ ftyp) atyp) = aux (atyp:apps) ftyp