diff options
author | David Terei <davidterei@gmail.com> | 2011-07-20 11:09:03 -0700 |
---|---|---|
committer | David Terei <davidterei@gmail.com> | 2011-07-20 11:26:35 -0700 |
commit | 16514f272fb42af6e9c7674a9bd6c9dce369231f (patch) | |
tree | e4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/typecheck/testeq1/FakePrelude.hs | |
parent | ebd422aed41048476aa61dd4c520d43becd78682 (diff) | |
download | haskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz |
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/typecheck/testeq1/FakePrelude.hs')
-rw-r--r-- | testsuite/tests/typecheck/testeq1/FakePrelude.hs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/testeq1/FakePrelude.hs b/testsuite/tests/typecheck/testeq1/FakePrelude.hs new file mode 100644 index 0000000000..80161655d0 --- /dev/null +++ b/testsuite/tests/typecheck/testeq1/FakePrelude.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, + OverlappingInstances, UndecidableInstances #-} + +-- +-- Test case adopted from the HList library +-- http://www.cwi.nl/~ralf/HList/ +-- + +module FakePrelude where + + +-- +-- Type-level Booleans; nothing weird +-- +data HTrue; hTrue :: HTrue; hTrue = undefined +data HFalse; hFalse :: HFalse; hFalse = undefined +class HBool x; instance HBool HTrue; instance HBool HFalse +instance Show HTrue where show _ = "HTrue" +instance Show HFalse where show _ = "HFalse" + + +-- +-- Type-level type equality +-- +class HBool b => TypeEq x y b | x y -> b + + +-- +-- Value-level incarnation; nothing too weird. +-- Rely on lazy show for type-level Booleans +-- +typeEq :: TypeEq t t' b => t -> t' -> b +typeEq = undefined + + +-- +-- Type-level cast +-- +class TypeCast x y | x -> y, y -> x + where + typeCast :: x -> y |