aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
blob: e8e80da1403d1bf46d90476ebbaef20664e13dbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE FlexibleContexts #-}


module Haddock.Backends.Xhtml.Specialize (specialize) where


import Haddock.Syb

import GHC

import Data.Data


specialize :: (Eq name, Typeable name)
           => Data a
           => name -> HsType name -> a -> a
specialize name details = everywhere (mkT $ specialize' name details)

specialize' :: Eq name => name -> HsType name -> HsType name -> HsType name
specialize' name details (HsTyVar name') | name == name' = details
specialize' _ _ typ = typ