[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.16, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11258, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Create simple utility module for type specialization. (e4740dd)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 20:49:52 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-8.0-facebook,ghc-head,ghc-head1,haddock-quick,headdock-library-1.4.5,ie_avails,issue-303,issue-475,master,pr-filter-maps,pr/cabal-desc,travis,v2.16,v2.17,v2.17.3,v2.18,wip-located-module-as,wip/D2418,wip/T11080-open-data-kinds,wip/T11258,wip/T11430,wip/T12105,wip/T12105-2,wip/T12942,wip/T13163,wip/T3384,wip/embelleshed-rdr,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13
Link       : http://git.haskell.org/haddock.git/commitdiff/e4740dd872d1110247557eb7b20124c22e427789

>---------------------------------------------------------------

commit e4740dd872d1110247557eb7b20124c22e427789
Author: Ɓukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Fri Jul 10 16:23:15 2015 +0200

    Create simple utility module for type specialization.


>---------------------------------------------------------------

e4740dd872d1110247557eb7b20124c22e427789
 haddock-api/haddock-api.cabal                       |  1 +
 .../src/Haddock/Backends/Xhtml/Specialize.hs        | 21 +++++++++++++++++++++
 haddock.cabal                                       |  1 +
 3 files changed, 23 insertions(+)

diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal
index bfdb217..abe5adb 100644
--- a/haddock-api/haddock-api.cabal
+++ b/haddock-api/haddock-api.cabal
@@ -75,6 +75,7 @@ library
     Haddock.Backends.Xhtml.DocMarkup
     Haddock.Backends.Xhtml.Layout
     Haddock.Backends.Xhtml.Names
+    Haddock.Backends.Xhtml.Specialize
     Haddock.Backends.Xhtml.Themes
     Haddock.Backends.Xhtml.Types
     Haddock.Backends.Xhtml.Utils
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
new file mode 100644
index 0000000..a0d64c0
--- /dev/null
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
@@ -0,0 +1,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
+ 
\ No newline at end of file
diff --git a/haddock.cabal b/haddock.cabal
index b0c6c34..4ea2a82 100644
--- a/haddock.cabal
+++ b/haddock.cabal
@@ -97,6 +97,7 @@ executable haddock
       Haddock.Backends.Xhtml.DocMarkup
       Haddock.Backends.Xhtml.Layout
       Haddock.Backends.Xhtml.Names
+      Haddock.Backends.Xhtml.Specialize
       Haddock.Backends.Xhtml.Themes
       Haddock.Backends.Xhtml.Types
       Haddock.Backends.Xhtml.Utils



More information about the ghc-commits mailing list