Reorganized code to add Debris class
This commit is contained in:
parent
e85dc20a48
commit
90b8d87e02
11 changed files with 57 additions and 25 deletions
21
src/Debris.hs
Normal file
21
src/Debris.hs
Normal file
|
@ -0,0 +1,21 @@
|
|||
{-# LANGUAGE ExistentialQuantification #-}
|
||||
|
||||
module Debris ( Debris(..)
|
||||
, SomeDebris(..)
|
||||
) where
|
||||
|
||||
import Tank
|
||||
|
||||
class Show a => Debris a where
|
||||
collideTank :: a -> Tank -> Tank
|
||||
|
||||
|
||||
data SomeDebris = forall a. Debris a => SomeDebris a
|
||||
|
||||
instance Show SomeDebris
|
||||
where
|
||||
show (SomeDebris a) = show a
|
||||
|
||||
instance Debris SomeDebris
|
||||
where
|
||||
collideTank (SomeDebris a) = collideTank a
|
Reference in a new issue