summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_fail/T3330a.hs
blob: c13760c6ac7db2b339e2de447e47687820170492 (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
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}

-- A very bogus program (multiple errors) but
-- sent GHC 6.12 into a loop

module T3330a where

newtype Writer w a = Writer { runWriter :: (a, w) }
execWriter :: Writer w a -> w
execWriter m = snd (runWriter m)

data AnyF (s :: * -> *) = AnyF
class HFunctor (f :: (* -> *) -> * -> *)
type family PF (phi :: * -> *) :: (* -> *) -> * -> *

children :: s ix -> (PF s) r ix -> [AnyF s]
children p x = execWriter (hmapM p collect x)

collect :: HFunctor (PF s) => s ix -> r ix -> Writer [AnyF s] (r ix)
collect = undefined

hmapM :: (forall ix. phi ix -> r ix -> m (r' ix))
      -> phi ix -> f r ix -> m (f r' ix)
hmapM = undefined