forked from ekmett/lens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
T917.hs
41 lines (33 loc) · 1.16 KB
/
T917.hs
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
39
40
41
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
#if __GLASGOW_HASKELL__ < 806
{-# LANGUAGE TypeInType #-}
#endif
module T917 where
import Control.Lens
import Data.Kind
import Data.Proxy
-- Like Data.Functor.Const, but redefined to ensure that it is poly-kinded
-- across all versions of GHC, not just 8.0+
newtype Constant a (b :: k) = Constant a
data T917OneA (a :: k -> Type) (b :: k -> Type) = MkT917OneA
data T917OneB a b = MkT917OneB (T917OneA a (Const b))
$(makePrisms ''T917OneB)
data T917TwoA (a :: k -> Type) (b :: k -> Type) = MkT917TwoA
data T917TwoB a b = MkT917TwoB (T917TwoA a (Const b))
$(makeClassyPrisms ''T917TwoB)
data family T917DataFam (a :: k)
data instance T917DataFam (a :: Type) = MkT917DataFam { _unT917DataFam :: Proxy a }
$(makeLenses 'MkT917DataFam)
data T917GadtOne (a :: k) where
MkT917GadtOne :: T917GadtOne (a :: Type)
$(makePrisms ''T917GadtOne)
data T917GadtTwo (a :: k) where
MkT917GadtTwo :: T917GadtTwo (a :: Type)
$(makePrisms ''T917GadtTwo)