summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T5643.hs
blob: eeab6865e40f042e676d14f3f682c79b2c541b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE MultiParamTypeClasses
            ,FunctionalDependencies
            ,FlexibleContexts #-}

module T5643 where

import Prelude ()

class FoldableLL a b | a -> b

class FoldableLL full item => ListLike full item | full -> item where
    
    cons :: item -> full -> full
    head :: full -> item
    tail :: full -> full 

    init :: full -> full
    init l = cons (head l) (init xs)
        where xs = tail l
              
-- Deriveds from the functional dependencies were escaping in the Wanted
-- constraints and emitWantedCts was giving a panic error.