diff options
Diffstat (limited to 'html-test/src')
-rw-r--r-- | html-test/src/TypeFamilies.hs | 76 | ||||
-rw-r--r-- | html-test/src/TypeFamilies2.hs | 12 |
2 files changed, 70 insertions, 18 deletions
diff --git a/html-test/src/TypeFamilies.hs b/html-test/src/TypeFamilies.hs index 561f95fd..725e76a7 100644 --- a/html-test/src/TypeFamilies.hs +++ b/html-test/src/TypeFamilies.hs @@ -1,28 +1,68 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeFamilies, UndecidableInstances #-} +-- | Doc for: module TypeFamilies module TypeFamilies where --- | Type family G -type family G a :: * +-- | Doc for: data X +data X + = X -- ^ Doc for: X + | XX -- ^ Doc for: XX + | XXX -- ^ Doc for: XXX --- | A class with an associated type -class A a where - -- | An associated type - data B a :: * -> * - -- | A method - f :: B a Int +-- | Doc for: data Y +data Y --- | Doc for family -type family F a +-- | Doc for: class Test a +class Test a +-- | Doc for: instance Test X +instance Test X +-- | Doc for: instance Test Y +instance Test Y --- | Doc for G Int -type instance G Int = Bool -type instance G Float = Int +-- | Doc for: type family Foo a +type family Foo a +-- | Doc for: type instance Foo X = Y +type instance Foo X = Y +-- | Doc for: type instance Foo Y = X +type instance Foo Y = X -instance A Int where - data B Int x = Con x - f = Con 3 +-- | Doc for: data family Bat a +data family Bat a :: * -g = Con 5 +-- | Doc for: data instance Bat X +data instance Bat X + = BatX X -- ^ Doc for: BatX X + | BatXX { aaa :: X , bbb :: Y } -- ^ Doc for: BatXX { ... } + +-- | Doc for: data instance Bat Y +data instance Bat Y + = BatY Y -- ^ Doc for: BatY Y + | X :+ X -- X :+ X + +-- | Doc for: class Assoc a +class Assoc a where + -- | Doc for: data AssocD a + data AssocD a :: * + -- | Doc for: type AssocT a + type AssocT a :: * + +-- | Doc for: instance Assoc X +instance Assoc X where + -- | Doc for: data AssocD X = AssocX + data AssocD X = AssocX -- ^ Doc for: AssocX + -- | Doc for: type AssocT X = Foo X + type AssocT X = Foo X + +-- | Doc for: instance Assoc Y +instance Assoc Y where + -- | Doc for: data AssocD Y = AssocY + data AssocD Y = AssocY -- ^ Doc for: AssocY + -- | Doc for: type AssocT Y = Bat Y + type AssocT Y = Bat Y + +-- | Doc for: type family Bar b +type family Bar b where + Bar X = X + Bar y = Y diff --git a/html-test/src/TypeFamilies2.hs b/html-test/src/TypeFamilies2.hs new file mode 100644 index 00000000..718e11dc --- /dev/null +++ b/html-test/src/TypeFamilies2.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TypeFamilies #-} +-- This tests what happens if we have unexported types +-- in type instances. The expected behaviour is +-- that we get the instance, Y is not linked and +-- Haddock shows a linking warning. +module TypeFamilies2 (X, Foo) where + +data X +data Y + +type family Foo a +type instance Foo X = Y |