shapes-0.1.0.0: physics engine and other tools for 2D shapes

Safe HaskellNone
LanguageHaskell2010

Physics.World

Description

Simple data structure that can act as a physical world to simulate. I will likely implement more interesting world data structures in the future.

Synopsis

Documentation

data World a Source #

A simple PhysicsWorld implementation using IntMap

Constructors

World 

Fields

Instances

Contactable a => PhysicsWorld Int (World a) a Source # 
Show a => Show (World a) Source # 

Methods

showsPrec :: Int -> World a -> ShowS #

show :: World a -> String #

showList :: [World a] -> ShowS #

Generic (World a) Source # 

Associated Types

type Rep (World a) :: * -> * #

Methods

from :: World a -> Rep (World a) x #

to :: Rep (World a) x -> World a #

NFData a => NFData (World a) Source # 

Methods

rnf :: World a -> () #

type Rep (World a) Source # 
type Rep (World a) = D1 * (MetaData "World" "Physics.World" "shapes-0.1.0.0-E6UUiYRpOc15rGTlEn6KOE" False) (C1 * (MetaCons "World" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "_worldObjs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (IntMap a))) (S1 * (MetaSel (Just Symbol "_worldNextKey") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Int))))

worldObjs :: forall a a. Lens (World a) (World a) (IntMap a) (IntMap a) Source #

worldNextKey :: forall a. Lens' (World a) Int Source #

emptyWorld :: World a Source #

A World without any inhabitants.

addObj :: World a -> a -> World a Source #

Add a new inhabitant to the World

addObj' :: World a -> a -> (Int, World a) Source #

Add a new inhabitant to the World. Also, get inhabitant's Int key.

fromList Source #

Arguments

:: [a]

Population for the new World

-> World a 

Create a World from a list of inhabitants