summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T19315.hs
blob: d93f42c4d4d77410704c9f0edebc0939271bf29b (plain)
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
42
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where

import Control.Monad.Reader
import Data.Kind

type Lens f s a = (f, s, a)

view :: MonadReader s m => Lens a s a -> m a
view = undefined

data TickLabels b n = TickLabels

type family N a :: Type
type instance N (TickLabels b n) = n

tickLabelTextFunction ::  Lens f a (QDiagram b (N a))
tickLabelTextFunction = undefined

class HasTickLabels f a b | a -> b where
  tickLabelFunction ::  Lens f a (N a -> String)

instance HasTickLabels f (TickLabels b n) b where
  tickLabelFunction = undefined

data QDiagram b n = QD

renderColourBar :: forall n b. TickLabels b n -> n -> ()
renderColourBar cbTickLabels bnds = ()
  where
  f :: a -> a
  f x = x

  tickLabelXs :: String
  tickLabelXs = view tickLabelFunction cbTickLabels bnds

  drawTickLabel :: n -> QDiagram b n
  drawTickLabel x = view tickLabelTextFunction cbTickLabels
     where v = f x