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/ghc-regress/typecheck/should_run/tcrun004.hs | |
parent | ebd422aed41048476aa61dd4c520d43becd78682 (diff) | |
download | haskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz |
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/ghc-regress/typecheck/should_run/tcrun004.hs')
-rw-r--r-- | testsuite/tests/ghc-regress/typecheck/should_run/tcrun004.hs | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/testsuite/tests/ghc-regress/typecheck/should_run/tcrun004.hs b/testsuite/tests/ghc-regress/typecheck/should_run/tcrun004.hs deleted file mode 100644 index 2319fc3bec..0000000000 --- a/testsuite/tests/ghc-regress/typecheck/should_run/tcrun004.hs +++ /dev/null @@ -1,72 +0,0 @@ -{-# LANGUAGE ExistentialQuantification #-} --- !!! Tests existential data types --- Originally from Kevin Glynn -module Main(main) where - -data Coordinate3D = Coord3D {cx, cy, cz::Double} - deriving (Eq, Show) - --- We Represent a line by two coordinates which it passes through. -data Line = MkLine Coordinate3D Coordinate3D - - -class PictureObject pot where - - -- Returns ordered (rel to 0 0 0) of points where the object - -- intersects the given line. - intersectLineObject :: pot -> Line -> [Coordinate3D] - - getPictureName :: pot -> String - -data Sphere = - Sphere Coordinate3D -- Centre - Double -- Radius - Double -- ambient coeff - Double -- diffuse coeff - Double -- specular coeff - Double -- phong specular exponent - -intersectLineSphere :: Sphere -> Line -> [Coordinate3D] -intersectLineSphere sp line = [] - -instance PictureObject Sphere where - intersectLineObject = intersectLineSphere - getPictureName _ = "Sphere" - -data Cube = - Cube Coordinate3D -- Origin corner - Coordinate3D -- Opposite corner - Double -- ambient coeff - Double -- diffuse coeff - Double -- specular coeff - Double -- phong specular exponent - deriving (Eq, Show) - -intersectLineCube :: Cube -> Line -> [Coordinate3D] -intersectLineCube cube line = [] - -instance PictureObject Cube where - intersectLineObject = intersectLineCube - getPictureName _ = "Cube" - - -data GenPic = forall pot. (PictureObject pot) => MkGenPic pot - -sphere :: Sphere -sphere = Sphere (Coord3D 1 1 1) 1 1 1 1 1 - -cube :: Cube -cube = Cube (Coord3D 1 1 1) (Coord3D 2 2 2) 1 1 1 1 - -obj_list:: [GenPic] -obj_list = [MkGenPic sphere, MkGenPic cube] - -putName :: PictureObject pot => pot -> IO () -putName x = putStr $ getPictureName x - - -main :: IO () -main = do { sequence_ $ map put_it obj_list } - where - put_it (MkGenPic s) = putStrLn (getPictureName s) - |