aboutsummaryrefslogtreecommitdiff
path: root/html-test/src/Bug294.hs
blob: 922b8ee7dfc0b25968108e6a67e18b68c6197614 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances, GADTs #-}
-- This tests that we are able to extract record selectors for
-- associated types when the type itself is not exported. Making this
-- bug exhibit is very simple: simply mention a record field defined
-- inside of the associated type anywhere in the export list.
--
-- Note: ProblemCtor only shows up when T or A are exported but PolyCtor
-- only shows up when the class is exported as well, since it's polymorphic.
module Bug294 ( A, problemField, problemField', gadtField
              , TP(ProblemCtor), DP(ProblemCtor'), TO'(PolyCtor)) where

data A

class T t where
  data TO t :: *
  data TP t :: *

  t :: t

instance T A where
  data TO A = TA { problemField :: A }
  data TP A = ProblemCtor A

data family DO t :: *
data family DP t :: *

data instance DO A = DA { problemField' :: A }
data instance DP A = ProblemCtor' A

data GADT :: * -> * where
  Ctor :: { gadtField :: A } -> GADT A

class T' t where
  data TO' t :: *

instance T' a where
  data TO' a = PolyCtor