summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_fail/NoMatchErr.hs
blob: 304e11613e7af3bc66e553291ec49e654f207bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TypeFamilies #-}

-- Type error message looks like
-- 	TF.hs:12:11:
--    Couldn't match expected type `Memo d'
--           against inferred type `Memo d1'
--      NB: `Memo' is a (non-injective) type function
--
-- Note the "NB", which helps point out the problem

module Foo where

class Fun d where
    type Memo d :: * -> *
    abst :: (d -> a) -> Memo d a
    appl :: Memo d a -> (d -> a)

f ::  (Fun d) => Memo d a -> Memo d a    -- (1)
f = abst . appl