diff options
author | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2009-08-18 01:47:47 +0000 |
---|---|---|
committer | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2009-08-18 01:47:47 +0000 |
commit | eb1892c10a113d4d98e45ddb5da33b7f2c36e2d9 (patch) | |
tree | b5b52dcd367c13094705d8a24fda36f58108be9d /src/Haddock/Convert.hs | |
parent | 76c1ea564e7cf37f73be8a6a740a89bcdcf99be6 (diff) |
Haddock.Convert: export more functions
This lets us remove some code in Haddock.Interface.AttachInstances
Diffstat (limited to 'src/Haddock/Convert.hs')
-rw-r--r-- | src/Haddock/Convert.hs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Haddock/Convert.hs b/src/Haddock/Convert.hs index 36c9f51f..958667a0 100644 --- a/src/Haddock/Convert.hs +++ b/src/Haddock/Convert.hs @@ -2,7 +2,11 @@ -- This functionality may be moved into GHC at some point, and then -- we can use the GHC version (#if GHC version is new enough). -module Haddock.Convert ( tyThingToHsSynSig {- :: TyThing -> LHsDecl Name -} ) + +-- Some other functions turned out to be useful for converting +-- instance heads, which aren't TyThings, so just export everything. +module Haddock.Convert +-- ( tyThingToHsSynSig {- :: TyThing -> LHsDecl Name -} ) where import HsSyn @@ -191,19 +195,19 @@ synifyIdSig s i = TypeSig (synifyName i) (synifyType s (varType i)) synifyCtx :: [PredType] -> LHsContext Name -synifyCtx ps = (\ps' -> noLoc ps') $ - map synifyPred ps - where - synifyPred (ClassP cls tys) = +synifyCtx ps = noLoc (map synifyPred ps) + +synifyPred :: PredType -> LHsPred Name +synifyPred (ClassP cls tys) = let sTys = map (synifyType WithinType) tys in noLoc $ HsClassP (getName cls) sTys - synifyPred (IParam ip ty) = +synifyPred (IParam ip ty) = let sTy = synifyType WithinType ty -- IPName should be in class NamedThing... in noLoc $ HsIParam ip sTy - synifyPred (EqPred ty1 ty2) = +synifyPred (EqPred ty1 ty2) = let s1 = synifyType WithinType ty1 s2 = synifyType WithinType ty2 |