aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
blob: a0d64c0f9836e9dd9141592c3a2a70d90f4d0c33 (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, Data (HsType name))
           => name -> HsType name -> HsType name -> HsType name
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