diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-29 18:21:04 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:33 +0100 |
commit | 00571a39acaa5aaa292b5a4bd5c17f122951f7ae (patch) | |
tree | 081be9c4b73f55a8584f9c310ba55c8c9b043c7a /haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | |
parent | 709ce61f4cf18b2d6a24411670713d7480b8218c (diff) |
Apply type specializer to associated type family declarations.
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs index a8a4e8ec..109788fd 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs @@ -7,6 +7,7 @@ module Haddock.Backends.Xhtml.Specialize ( specialize, specialize' , specializeTyVarBndrs + , specializePseudoFamilyDecl , sugar, rename , freeVariables ) where @@ -58,8 +59,9 @@ specialize' = flip $ foldr (uncurry specialize) -- Again, it is just a convenience function around 'specialize'. Note that -- length of type list should be the same as the number of binders. specializeTyVarBndrs :: (Eq name, Typeable name, DataId name) + => Data a => LHsTyVarBndrs name -> [HsType name] - -> HsType name -> HsType name + -> a -> a specializeTyVarBndrs bndrs typs = specialize' $ zip bndrs' typs where @@ -68,6 +70,16 @@ specializeTyVarBndrs bndrs typs = bname (KindedTyVar (L _ name) _) = name +specializePseudoFamilyDecl :: (Eq name, Typeable name, DataId name) + => LHsTyVarBndrs name -> [HsType name] + -> PseudoFamilyDecl name + -> PseudoFamilyDecl name +specializePseudoFamilyDecl bndrs typs decl = + decl { pfdTyVars = map specializeTyVars (pfdTyVars decl) } + where + specializeTyVars = specializeTyVarBndrs bndrs typs + + -- | Make given type use tuple and list literals where appropriate. -- -- After applying 'specialize' function some terms may not use idiomatic list |