summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_fail/T8518.hs
blob: 666ddd09adf9c4a3000112117030d7d52dacb944 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE TypeFamilies #-}
module T8518 where

import Data.Maybe
import Control.Applicative

class Continuation c where
    type Z c
    type B c
    type F c
    continue ::  c -> (Z c) -> (B c) -> Maybe ((F c), c)

callCont :: Continuation c => c -> (Z c) -> (B c) -> Maybe (F c)
callCont c z b = rpt (4 :: Int) c z b
    where
        rpt 0 c' z' b' = fromJust (fst <$> (continue c' z' b'))
        rpt i c' z' b' = let c'' = fromJust (snd <$> (continue c' z' b')) in rpt (i-1) c''