codeworld-tasks-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

CodeWorld

Description

Module exporting the same interface as provided in the CodeWorld editor.

Synopsis

CodeWorld API

The CodeWorld Picture type and corresponding API for composing images.

data Picture Source #

Student facing, basic picture type. A value of this type can be build using the CodeWorld API.

CodeWorld.Test also exports pattern synonyms for all contained constructors. This allows for easier pattern matching in generic traversals.

Instances

Instances details
Data Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Picture -> c Picture #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Picture #

toConstr :: Picture -> Constr #

dataTypeOf :: Picture -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Picture) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Picture) #

gmapT :: (forall b. Data b => b -> b) -> Picture -> Picture #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Picture -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Picture -> r #

gmapQ :: (forall d. Data d => d -> u) -> Picture -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Picture -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Picture -> m Picture #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Picture -> m Picture #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Picture -> m Picture #

Generic Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

Associated Types

type Rep Picture 
Instance details

Defined in CodeWorld.Tasks.Picture

Methods

from :: Picture -> Rep Picture x #

to :: Rep Picture x -> Picture #

Show Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

MuRef Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

Associated Types

type DeRef Picture 
Instance details

Defined in CodeWorld.Tasks.Picture

type DeRef Picture

Methods

mapDeRef :: Applicative f => (forall b. (MuRef b, DeRef Picture ~ DeRef b) => b -> f u) -> Picture -> f (DeRef Picture u)

NFData Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

Methods

rnf :: Picture -> () #

Eq Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

Methods

(==) :: Picture -> Picture -> Bool #

(/=) :: Picture -> Picture -> Bool #

Ord Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

type Rep Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

type DeRef Picture Source # 
Instance details

Defined in CodeWorld.Tasks.Picture

type DeRef Picture

(&) :: Picture -> Picture -> Picture Source #

Compose two Pictures. The left argument will drawn on top of the right argument if they overlap.

rectangle :: Double -> Double -> Picture Source #

Draw a hollow, thin rectangle with this length and height.

solidRectangle :: Double -> Double -> Picture Source #

Draw a filled in rectangle with this length and height.

thickRectangle :: Double -> Double -> Double -> Picture Source #

Draw a hollow rectangle with this line width, length and height. Specifying a negative line width causes a runtime error (mirrors behaviour in CodeWorld editor).

circle :: Double -> Picture Source #

Draw a hollow, thin circle with this radius.

solidCircle :: Double -> Picture Source #

Draw a filled in circle with this radius.

arc :: Double -> Double -> Double -> Picture Source #

Draw a thin, hollow circle segment with these start and end angles and radius.

sector :: Double -> Double -> Double -> Picture Source #

Draw a filled in circle segment with these start and end angles and radius. This would be solidArc following the usual naming scheme.

thickArc :: Double -> Double -> Double -> Double -> Picture Source #

Draw a hollow circle segment with this line width, these start and end angles and radius. Specifying a negative line width causes a runtime error (mirrors behaviour in CodeWorld editor).

curve :: [Point] -> Picture Source #

Draw a thin curve passing through the provided points via a number of Bézier splices.

thickCurve :: Double -> [Point] -> Picture Source #

Draw a curve with this line width passing through the provided points via a number of Bézier splices. Specifying a negative line width causes a runtime error (mirrors behaviour in CodeWorld editor).

closedCurve :: [Point] -> Picture Source #

Same as curve but adds another splice between the start and end points to close the shape.

thickClosedCurve :: Double -> [Point] -> Picture Source #

Same as thickCurve but adds another splice between the start and end points to close the shape.

solidClosedCurve :: [Point] -> Picture Source #

Draw a curve passing through the provided points via a number of Bézier splices. Adds another splice between the start and end points to close the shape and completely fills the enclosed area.

polyline :: [Point] -> Picture Source #

Draw a sequence of thin line segments passing through the provided points.

thickPolyline :: Double -> [Point] -> Picture Source #

Draw a sequence of line segments with this line width passing through the provided points. Specifying a negative line width causes a runtime error (mirrors behaviour in CodeWorld editor).

polygon :: [Point] -> Picture Source #

Same as polyline but adds another segment between the start and end points to close the shape.

solidPolygon :: [Point] -> Picture Source #

Draw a sequence of line segments with this line width passing through the provided points and completely fill the enclosed area.

thickPolygon :: Double -> [Point] -> Picture Source #

Same as thickPolyline but adds another segment between the start and end points to close the shape.

lettering :: Text -> Picture Source #

Render this text into an image.

styledLettering :: TextStyle -> Font -> Text -> Picture Source #

Render this text into an image using the provided TextStyle and Font.

thickCircle :: Double -> Double -> Picture Source #

Draw a hollow circle with this line width and radius. Specifying a negative line width or a line width greater than the circles diameter causes a runtime error (mirrors behaviour in CodeWorld editor).

translated :: Double -> Double -> Picture -> Picture Source #

Move the image in x and y-direction.

colored :: Color -> Picture -> Picture Source #

Apply this Color to the image.

dilated :: Double -> Picture -> Picture Source #

Scale the image in both directions using the same modifier.

scaled :: Double -> Double -> Picture -> Picture Source #

Scale the image in x and y-directions using these modifiers.

rotated :: Double -> Picture -> Picture Source #

Rotate the image around the origin using this angle in radians.

reflected :: Double -> Picture -> Picture Source #

Reflect the image across a line through the origin with this angle to the x-axis.

clipped :: Double -> Double -> Picture -> Picture Source #

Clip the image in a rectangle with this length and height.

pictures :: [Picture] -> Picture Source #

Compose a list of Pictures. Equivalent to foldr (&) blank.

coordinatePlane :: Picture Source #

A static image of a coordinate plane extending 5 units in all directions.

:: Picture Source #

A static image of the CodeWorld logo.

blank :: Picture Source #

An empty Picture. This is the identity element of &.

Colours

data Color Source #

Color type mirroring CodeWorld's equivalent type. The exposed constructors allow for setting colors directly via numerical values.

Constructors

RGB Double Double Double

Values for red, green, blue given as a percentage from 0 to 1

HSL Double Double Double

Values for hue, saturation and luminosity

RGBA Double Double Double Double

RGB with an additional transparency percentage

Instances

Instances details
Data Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Color -> c Color #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Color #

toConstr :: Color -> Constr #

dataTypeOf :: Color -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Color) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Color) #

gmapT :: (forall b. Data b => b -> b) -> Color -> Color #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Color -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Color -> r #

gmapQ :: (forall d. Data d => d -> u) -> Color -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Color -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Color -> m Color #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Color -> m Color #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Color -> m Color #

Generic Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

Associated Types

type Rep Color 
Instance details

Defined in CodeWorld.Tasks.Color

type Rep Color = D1 ('MetaData "Color" "CodeWorld.Tasks.Color" "codeworld-tasks-0.1.0.0-ALYWrqBU5SkHyps14Jeeld" 'False) ((((C1 ('MetaCons "Yellow" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Green" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Red" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Blue" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Orange" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Brown" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Pink" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Purple" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Grey" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "White" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Black" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Bright" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)))))) :+: (((C1 ('MetaCons "Brighter" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Dull" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "Duller" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)))) :+: (C1 ('MetaCons "Light" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Lighter" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "Dark" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color))))) :+: ((C1 ('MetaCons "Darker" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Translucent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "Mixed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Color])))) :+: ((C1 ('MetaCons "RGB" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) :+: C1 ('MetaCons "HSL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))) :+: (C1 ('MetaCons "RGBA" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) :+: C1 ('MetaCons "AnyColor" 'PrefixI 'False) (U1 :: Type -> Type))))))

Methods

from :: Color -> Rep Color x #

to :: Rep Color x -> Color #

Show Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

Methods

showsPrec :: Int -> Color -> ShowS #

show :: Color -> String #

showList :: [Color] -> ShowS #

NFData Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

Methods

rnf :: Color -> () #

Eq Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

Methods

(==) :: Color -> Color -> Bool #

(/=) :: Color -> Color -> Bool #

Ord Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

Methods

compare :: Color -> Color -> Ordering #

(<) :: Color -> Color -> Bool #

(<=) :: Color -> Color -> Bool #

(>) :: Color -> Color -> Bool #

(>=) :: Color -> Color -> Bool #

max :: Color -> Color -> Color #

min :: Color -> Color -> Color #

type Rep Color Source # 
Instance details

Defined in CodeWorld.Tasks.Color

type Rep Color = D1 ('MetaData "Color" "CodeWorld.Tasks.Color" "codeworld-tasks-0.1.0.0-ALYWrqBU5SkHyps14Jeeld" 'False) ((((C1 ('MetaCons "Yellow" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Green" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Red" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Blue" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Orange" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Brown" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Pink" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Purple" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Grey" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "White" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Black" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Bright" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)))))) :+: (((C1 ('MetaCons "Brighter" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Dull" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "Duller" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)))) :+: (C1 ('MetaCons "Light" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Lighter" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "Dark" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color))))) :+: ((C1 ('MetaCons "Darker" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Translucent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "Mixed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Color])))) :+: ((C1 ('MetaCons "RGB" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) :+: C1 ('MetaCons "HSL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))) :+: (C1 ('MetaCons "RGBA" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) :+: C1 ('MetaCons "AnyColor" 'PrefixI 'False) (U1 :: Type -> Type))))))

type Colour = Color Source #

Alias for Color.

red :: Color Source #

Constant basic colour.

green :: Color Source #

Constant basic colour.

yellow :: Color Source #

Constant basic colour.

black :: Color Source #

Constant basic colour.

white :: Color Source #

Constant basic colour.

blue :: Color Source #

Constant basic colour.

orange :: Color Source #

Constant basic colour.

brown :: Color Source #

Constant basic colour.

pink :: Color Source #

Constant basic colour.

purple :: Color Source #

Constant basic colour.

grey :: Color Source #

Constant basic colour.

gray :: Color Source #

Alias for grey.

mixed :: [Color] -> Color Source #

Blend a new color from the arguments.

lighter :: Double -> Color -> Color Source #

Increase argument's luminosity by a user defined amount.

light :: Color -> Color Source #

Slightly increase argument's luminosity.

darker :: Double -> Color -> Color Source #

Decrease argument's luminosity by a user defined amount.

dark :: Color -> Color Source #

Slightly decrease argument's luminosity.

brighter :: Double -> Color -> Color Source #

Increase argument's saturation by a user defined amount.

bright :: Color -> Color Source #

Slightly increase argument's saturation.

duller :: Double -> Color -> Color Source #

Decrease argument's saturation by a user defined amount.

dull :: Color -> Color Source #

Slightly decrease argument's saturation.

translucent :: Color -> Color Source #

Slightly increase argument's transparency.

assortedColors :: [Color] Source #

An infinite list of different colours.

hue :: Color -> Double Source #

Returns the hue of the argument according to the HSL model.

saturation :: Color -> Double Source #

Returns the saturation of the argument according to the HSL model.

luminosity :: Color -> Double Source #

Returns the luminosity of the argument according to the HSL model.

alpha :: Color -> Double Source #

Returns the transparency of the argument.

Math Utility

type Point = (Double, Double) Source #

A point in 2D space. Synonym for a pair of Double values.

type Vector = (Double, Double) Source #

A vector in 2D space. Synonym for a pair of Double values.

translatedPoint :: Double -> Double -> Point -> Point Source #

Moves a point in X and Y-directions.

rotatedPoint :: Double -> Point -> Point Source #

Rotates a point around the origin by the given angle in radians.

reflectedPoint :: Double -> Point -> Point Source #

Reflects a point across a line through the origin at this angle from the X-axis.

scaledPoint :: Double -> Double -> Point -> Point Source #

Scales a point by given X and Y scaling factor. Scaling by a negative factor also reflects across that axis.

dilatedPoint :: Double -> Point -> Point Source #

Dilates a point by given uniform scaling factor. Dilating by a negative factor also reflects across the origin.

vectorLength :: Vector -> Double Source #

The length of a vector.

vectorDirection :: Vector -> Double Source #

The counter-clockwise angle of a vector from the X-axis.

vectorSum :: Vector -> Vector -> Vector Source #

The sum of two vectors.

vectorDifference :: Vector -> Vector -> Vector Source #

The difference of two vectors.

scaledVector :: Double -> Double -> Vector -> Vector Source #

Scales a vector by the given scalar multiplier.

rotatedVector :: Double -> Vector -> Vector Source #

Rotates a vector by the given angle in radians.

Text Rendering Modifiers

data Font Source #

Text font type used for stylized message rendering.

Instances

Instances details
Data Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Font -> c Font #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Font #

toConstr :: Font -> Constr #

dataTypeOf :: Font -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Font) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Font) #

gmapT :: (forall b. Data b => b -> b) -> Font -> Font #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Font -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Font -> r #

gmapQ :: (forall d. Data d => d -> u) -> Font -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Font -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Font -> m Font #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Font -> m Font #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Font -> m Font #

Generic Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Associated Types

type Rep Font 
Instance details

Defined in CodeWorld.Tasks.Types

type Rep Font = D1 ('MetaData "Font" "CodeWorld.Tasks.Types" "codeworld-tasks-0.1.0.0-ALYWrqBU5SkHyps14Jeeld" 'False) ((C1 ('MetaCons "SansSerif" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Serif" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Monospace" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Handwriting" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Fancy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NamedFont" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))))

Methods

from :: Font -> Rep Font x #

to :: Rep Font x -> Font #

Show Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

showsPrec :: Int -> Font -> ShowS #

show :: Font -> String #

showList :: [Font] -> ShowS #

NFData Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

rnf :: Font -> () #

Eq Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

(==) :: Font -> Font -> Bool #

(/=) :: Font -> Font -> Bool #

Ord Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

compare :: Font -> Font -> Ordering #

(<) :: Font -> Font -> Bool #

(<=) :: Font -> Font -> Bool #

(>) :: Font -> Font -> Bool #

(>=) :: Font -> Font -> Bool #

max :: Font -> Font -> Font #

min :: Font -> Font -> Font #

type Rep Font Source # 
Instance details

Defined in CodeWorld.Tasks.Types

type Rep Font = D1 ('MetaData "Font" "CodeWorld.Tasks.Types" "codeworld-tasks-0.1.0.0-ALYWrqBU5SkHyps14Jeeld" 'False) ((C1 ('MetaCons "SansSerif" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Serif" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Monospace" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Handwriting" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Fancy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NamedFont" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))))

data TextStyle Source #

Font modifier type used for stylized message rendering.

Constructors

Plain 
Bold 
Italic 

Instances

Instances details
Data TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TextStyle -> c TextStyle #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TextStyle #

toConstr :: TextStyle -> Constr #

dataTypeOf :: TextStyle -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TextStyle) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TextStyle) #

gmapT :: (forall b. Data b => b -> b) -> TextStyle -> TextStyle #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TextStyle -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TextStyle -> r #

gmapQ :: (forall d. Data d => d -> u) -> TextStyle -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TextStyle -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TextStyle -> m TextStyle #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TextStyle -> m TextStyle #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TextStyle -> m TextStyle #

Generic TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Associated Types

type Rep TextStyle 
Instance details

Defined in CodeWorld.Tasks.Types

type Rep TextStyle = D1 ('MetaData "TextStyle" "CodeWorld.Tasks.Types" "codeworld-tasks-0.1.0.0-ALYWrqBU5SkHyps14Jeeld" 'False) (C1 ('MetaCons "Plain" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Bold" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Italic" 'PrefixI 'False) (U1 :: Type -> Type)))
Show TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

NFData TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Methods

rnf :: TextStyle -> () #

Eq TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

Ord TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

type Rep TextStyle Source # 
Instance details

Defined in CodeWorld.Tasks.Types

type Rep TextStyle = D1 ('MetaData "TextStyle" "CodeWorld.Tasks.Types" "codeworld-tasks-0.1.0.0-ALYWrqBU5SkHyps14Jeeld" 'False) (C1 ('MetaCons "Plain" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Bold" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Italic" 'PrefixI 'False) (U1 :: Type -> Type)))

CodeWorld IO Interface

Entry points for rendering. Defining the main function in terms of one of these would draw the provided image to screen.

All of these are dummy functions (no-op IO actions) as this library does not implement the actual rendering process.

drawingOf :: Picture -> IO () Source #

Render a Picture onto the canvas.

animationOf :: (Double -> Picture) -> IO () Source #

Render an animation onto the canvas.

trace :: Text -> a -> a Source #

Prints a debug message in the console when second argument is evaluated.