Commit a589f829 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

TFs: Test for repeated tvs in left-hand sides of instances

parent 5bbdbfa2
{-# LANGUAGE TypeFamilies, EmptyDataDecls, FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances #-}
module NonLinearLHS where
type family E a b
type instance E a a = [a]
foo :: E [Int] (E Int Int) -> Int
foo = sum . concat
data family F a b
data instance F a a = MkF [a]
goo :: F Int Int -> F Bool Bool
goo (MkF xs) = MkF $ map odd xs
-- HList-like type equality
data True; data False;
type family EqTy a b
type instance EqTy a a = True
class EqTyP a b result
instance (EqTy a b ~ isEq, Proxy isEq result) => EqTyP a b result
class Proxy inp out
instance (result ~ True) => Proxy True result
instance (result ~ False) => Proxy notTrue result
testTrue :: EqTyP Int Int r => r
testTrue = undefined
testFalse :: EqTyP Int Bool r => r
testFalse = undefined
\ No newline at end of file
......@@ -26,6 +26,8 @@ test('Simple22', normal, compile, [''])
test('Simple23', normal, compile, [''])
test('Simple24', normal, compile, [''])
test('NonLinearLHS', normal, compile, [''])
test('ind1', normal, compile, [''])
test('ind2',
extra_clean(['Ind2_help.hi', 'Ind2_help.o']),
......
{-# LANGUAGE TypeFamilies #-}
module NonLinearSigErr where
type family E a b
type instance E a (a :: *) = [a]
NonLinearSigErr.hs:6:0:
Repeat variable occurrence may not have a kind signature: `a'
......@@ -26,11 +26,7 @@ test('Simple16', normal, compile_fail, [''])
test('TyFamArity1', normal, compile_fail, [''])
test('TyFamArity2', normal, compile_fail, [''])
test('TyFamUndec', normal, compile_fail, [''])
test('T2334', normal, compile_fail, [''])
test('T1900', normal, compile_fail, [''])
test('T2157', normal, compile_fail, [''])
test('T2203a', normal, compile_fail, [''])
test('T2627b', normal, compile_fail, [''])
test('NonLinearSigErr', normal, compile_fail, [''])
test('GADTwrong1', normal, compile_fail, [''])
......@@ -42,3 +38,9 @@ test('Over',
['OverD', '-no-hs-main -c -v0'])
test('SkolemOccursLoop', expect_fail, compile_fail, [''])
test('T2334', normal, compile_fail, [''])
test('T1900', normal, compile_fail, [''])
test('T2157', normal, compile_fail, [''])
test('T2203a', normal, compile_fail, [''])
test('T2627b', normal, compile_fail, [''])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment