summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/indexed-types/should_compile/T2767.hs
blob: 7104db2fa3e0dfe6986a023d7a1646f344beae3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE TypeFamilies, NoMonomorphismRestriction #-}

module T2767a where

main = return ()

-- eval' :: Solver solver => Tree solver a -> [(Label solver,Tree solver a)] -> solver [a]
eval' (NewVar f) wl = do v <- newvarSM
                         eval' (f v) wl
eval' Fail       wl = continue wl

-- continue :: Solver solver => [(Label solver,Tree solver a)] -> solver [a] 
continue ((past,t):wl) = do gotoSM past
                            eval' t wl
data Tree s a
                = Fail
                | NewVar (Term s -> Tree s a)

class Monad solver => Solver solver where
        type Term solver        :: *
        type Label solver       :: *
        newvarSM        :: solver (Term solver)
        gotoSM          :: Label solver -> solver ()