Safe Haskell | None |
---|---|
Language | Haskell2010 |
CodeWorld.Test
Description
Module exporting all functionality needed for running tests on student submissions.
Synopsis
- data NormalizedPicture
- class Drawable a where
- rectangle :: Double -> Double -> a
- thickRectangle :: Double -> Double -> Double -> a
- solidRectangle :: Double -> Double -> a
- circle :: Double -> a
- thickCircle :: Double -> Double -> a
- solidCircle :: Double -> a
- arc :: Double -> Double -> Double -> a
- sector :: Double -> Double -> Double -> a
- thickArc :: Double -> Double -> Double -> Double -> a
- curve :: [Point] -> a
- thickCurve :: Double -> [Point] -> a
- closedCurve :: [Point] -> a
- thickClosedCurve :: Double -> [Point] -> a
- solidClosedCurve :: [Point] -> a
- polyline :: [Point] -> a
- thickPolyline :: Double -> [Point] -> a
- polygon :: [Point] -> a
- thickPolygon :: Double -> [Point] -> a
- solidPolygon :: [Point] -> a
- lettering :: Text -> a
- styledLettering :: TextStyle -> Font -> Text -> a
- translated :: Double -> Double -> a -> a
- colored :: Color -> a -> a
- dilated :: Double -> a -> a
- scaled :: Double -> Double -> a -> a
- rotated :: Double -> a -> a
- reflected :: Double -> a -> a
- clipped :: Double -> Double -> a -> a
- pictures :: [a] -> a
- (&) :: a -> a -> a
- coordinatePlane :: a
- codeWorldLogo :: a
- blank :: a
- someCircle :: NormalizedPicture
- someSolidCircle :: NormalizedPicture
- someSquare :: NormalizedPicture
- someRectangle :: NormalizedPicture
- someTallRectangle :: NormalizedPicture
- someWideRectangle :: NormalizedPicture
- someSolidSquare :: NormalizedPicture
- someSolidRectangle :: NormalizedPicture
- someTallSolidRectangle :: NormalizedPicture
- someWideSolidRectangle :: NormalizedPicture
- someCurve :: Int -> NormalizedPicture
- someSolidCurve :: Int -> NormalizedPicture
- someColor :: NormalizedPicture -> NormalizedPicture
- rotatedHalf :: NormalizedPicture -> NormalizedPicture
- rotatedQuarter :: NormalizedPicture -> NormalizedPicture
- rotatedThreeQuarters :: NormalizedPicture -> NormalizedPicture
- rotatedUpToFull :: NormalizedPicture -> NormalizedPicture
- larger :: NormalizedPicture -> NormalizedPicture
- largerX :: NormalizedPicture -> NormalizedPicture
- largerY :: NormalizedPicture -> NormalizedPicture
- smaller :: NormalizedPicture -> NormalizedPicture
- smallerX :: NormalizedPicture -> NormalizedPicture
- smallerY :: NormalizedPicture -> NormalizedPicture
- contains :: NormalizedPicture -> NormalizedPicture -> Bool
- count :: NormalizedPicture -> NormalizedPicture -> Int
- getColor :: NormalizedPicture -> Maybe AbsColor
- getRotation :: NormalizedPicture -> Maybe Angle
- getExactRotation :: NormalizedPicture -> Double
- getScalingFactors :: NormalizedPicture -> (Factor, Factor)
- getExactScalingFactors :: NormalizedPicture -> (Double, Double)
- getTranslation :: NormalizedPicture -> (Position, Position)
- getExactTranslation :: NormalizedPicture -> (Double, Double)
- getReflectionAngle :: NormalizedPicture -> Maybe Angle
- getExactReflectionAngle :: NormalizedPicture -> Double
- getCircleRadius :: NormalizedPicture -> Maybe Size
- getExactCircleRadius :: NormalizedPicture -> Maybe Double
- getRectangleLengths :: NormalizedPicture -> Maybe (Size, Size)
- getExactRectangleLengths :: NormalizedPicture -> Maybe (Double, Double)
- getExactPointList :: NormalizedPicture -> [Point]
- data Size
- data ShapeKind
- data Angle
- data Factor
- data Position
- data AbsPoint
- data AbsColor
- isSameColor :: AbsColor -> AbsColor -> Bool
- equalColorCustom :: Double -> Double -> Double -> Double -> AbsColor -> AbsColor -> Bool
- data RelativePicSpec
- type SpatialQuery = [RelativePicSpec] -> Bool
- isSouthOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isNorthOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isWestOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isEastOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isSouthEastOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isSouthWestOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isNorthEastOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isNorthWestOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isBelow :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isAbove :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isLeftOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- isRightOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- atSamePosition :: NormalizedPicture -> NormalizedPicture -> SpatialQuery
- data Components
- type PicPredicate = Components -> Bool
- containsElem :: NormalizedPicture -> PicPredicate
- containsElems :: [NormalizedPicture] -> PicPredicate
- containsExactElems :: [NormalizedPicture] -> PicPredicate
- thisOften :: NormalizedPicture -> Int -> PicPredicate
- atLeast :: NormalizedPicture -> Int -> PicPredicate
- atMost :: NormalizedPicture -> Int -> PicPredicate
- inRangeOf :: NormalizedPicture -> (Int, Int) -> PicPredicate
- hasRelation :: SpatialQuery -> PicPredicate
- (<||>) :: PicPredicate -> PicPredicate -> PicPredicate
- option :: PicPredicate -> PicPredicate -> PicPredicate
- options :: [PicPredicate] -> PicPredicate
- ifThen :: PicPredicate -> PicPredicate -> PicPredicate
- oneOf :: (a -> PicPredicate) -> [a] -> PicPredicate
- evaluatePred :: PicPredicate -> Picture -> Bool
- evaluatePreds :: [PicPredicate] -> Picture -> Bool
- getComponents :: Picture -> Components
- findMaybe :: (NormalizedPicture -> Bool) -> Components -> Maybe NormalizedPicture
- findMaybeAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Components -> Maybe a
- findMaybeActual :: (NormalizedPicture -> Bool) -> Picture -> Maybe NormalizedPicture
- findMaybeActualAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Picture -> Maybe a
- findAll :: (NormalizedPicture -> Bool) -> Components -> [NormalizedPicture]
- findAllAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Components -> [a]
- findAllActual :: (NormalizedPicture -> Bool) -> Picture -> [NormalizedPicture]
- findAllActualAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Picture -> [a]
- data Picture where
- pattern Rectangle :: Double -> Double -> Picture
- pattern ThickRectangle :: Double -> Double -> Double -> Picture
- pattern SolidRectangle :: Double -> Double -> Picture
- pattern Circle :: Double -> Picture
- pattern ThickCircle :: Double -> Double -> Picture
- pattern SolidCircle :: Double -> Picture
- pattern Polygon :: [Point] -> Picture
- pattern SolidPolygon :: [Point] -> Picture
- pattern ThickPolygon :: Double -> [Point] -> Picture
- pattern Polyline :: [Point] -> Picture
- pattern ThickPolyline :: Double -> [Point] -> Picture
- pattern Sector :: Double -> Double -> Double -> Picture
- pattern Arc :: Double -> Double -> Double -> Picture
- pattern ThickArc :: Double -> Double -> Double -> Double -> Picture
- pattern Curve :: [Point] -> Picture
- pattern ThickCurve :: Double -> [Point] -> Picture
- pattern ClosedCurve :: [Point] -> Picture
- pattern SolidClosedCurve :: [Point] -> Picture
- pattern ThickClosedCurve :: Double -> [Point] -> Picture
- pattern Lettering :: Text -> Picture
- pattern StyledLettering :: TextStyle -> Font -> Text -> Picture
- pattern Color :: Color -> Picture -> Picture
- pattern Translate :: Double -> Double -> Picture -> Picture
- pattern Scale :: Double -> Double -> Picture -> Picture
- pattern Dilate :: Double -> Picture -> Picture
- pattern Rotate :: Double -> Picture -> Picture
- pattern Reflect :: Double -> Picture -> Picture
- pattern Clip :: Double -> Double -> Picture -> Picture
- pattern Pictures :: [Picture] -> Picture
- pattern And :: Picture -> Picture -> Picture
- pattern CoordinatePlane :: Picture
- pattern Logo :: Picture
- pattern Blank :: Picture
- hasInnerPicture :: Picture -> Bool
- innerPicture :: Picture -> Picture
- isIn :: Picture -> (Point, Point) -> Bool
- normalize :: Picture -> NormalizedPicture
- toConcretePicture :: NormalizedPicture -> Picture
- reduce :: Picture -> Picture
- reduceNoOrder :: Picture -> Picture
- wasTranslatedBy :: [Point] -> [Point] -> Maybe Point
- wasScaledBy :: [Point] -> [Point] -> Maybe (Maybe Double, Maybe Double)
- wasRotatedBy :: [Point] -> [Point] -> Maybe Double
- irregularSamples :: [Double]
- samplesUntil :: Double -> Double -> [Double]
- testCSE :: Picture -> IO (Maybe String)
- type Point = (Double, Double)
- type Vector = (Double, Double)
- translatedPoint :: Double -> Double -> Point -> Point
- rotatedPoint :: Double -> Point -> Point
- reflectedPoint :: Double -> Point -> Point
- scaledPoint :: Double -> Double -> Point -> Point
- dilatedPoint :: Double -> Point -> Point
- vectorLength :: Vector -> Double
- vectorDirection :: Vector -> Double
- vectorSum :: Vector -> Vector -> Vector
- vectorDifference :: Vector -> Vector -> Vector
- scaledVector :: Double -> Double -> Vector -> Vector
- rotatedVector :: Double -> Vector -> Vector
- data Font
- data TextStyle
- data Color
- type Colour = Color
- red :: Color
- green :: Color
- yellow :: Color
- black :: Color
- white :: Color
- blue :: Color
- orange :: Color
- brown :: Color
- pink :: Color
- purple :: Color
- grey :: Color
- gray :: Color
- mixed :: [Color] -> Color
- lighter :: Double -> Color -> Color
- light :: Color -> Color
- darker :: Double -> Color -> Color
- dark :: Color -> Color
- brighter :: Double -> Color -> Color
- bright :: Color -> Color
- duller :: Double -> Color -> Color
- dull :: Color -> Color
- translucent :: Color -> Color
- assortedColors :: [Color]
- hue :: Color -> Double
- saturation :: Color -> Double
- luminosity :: Color -> Double
- alpha :: Color -> Double
Normalized Pictures
Data Type
data NormalizedPicture Source #
A more abstract syntax tree representing images. Comparisons between values of this type are intentionally fuzzy: Concrete number or point values are abstracted into coarser categories. Notably, those values are not lost and can be retrieved if desired.
The constructors of this type are not exposed. Values are built using the CodeWorld API.
Instances
class Drawable a where Source #
The CodeWorld API as a type class.
These are the same functions as seen in CodeWorld.
This is used to build syntax trees of the type NormalizedPicture
and another internal type used for CSE detection.
The student facing Picture
type is not a member of this class to improve readability of type errors.
Methods
rectangle :: Double -> Double -> a Source #
Draw a hollow, thin rectangle with this length and height.
thickRectangle :: Double -> Double -> Double -> a 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).
solidRectangle :: Double -> Double -> a Source #
Draw a filled in rectangle with this length and height.
circle :: Double -> a Source #
Draw a hollow, thin circle with this radius.
thickCircle :: Double -> Double -> a 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).
solidCircle :: Double -> a Source #
Draw a filled in circle with this radius.
arc :: Double -> Double -> Double -> a Source #
Draw a thin, hollow circle segment with these start and end angles and radius.
sector :: Double -> Double -> Double -> a 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 -> a 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] -> a Source #
Draw a thin curve passing through the provided points via a number of Bézier splices.
thickCurve :: Double -> [Point] -> a 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] -> a Source #
Same as curve
but adds another splice between the start and end points to close the shape.
thickClosedCurve :: Double -> [Point] -> a Source #
Same as thickCurve
but adds another splice between the start and end points to close the shape.
solidClosedCurve :: [Point] -> a 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] -> a Source #
Draw a sequence of thin line segments passing through the provided points.
thickPolyline :: Double -> [Point] -> a Source #
Draw a sequence of line segments with this line width passing through the provided points.
polygon :: [Point] -> a Source #
Same as polyline
but adds another segment between the start and end points to close the shape.
thickPolygon :: Double -> [Point] -> a Source #
Same as thickPolyline
but adds another segment between the start and end points to close the shape.
solidPolygon :: [Point] -> a Source #
Draw a sequence of line segments with this line width passing through the provided points and completely fill the enclosed area.
lettering :: Text -> a Source #
Render this text into an image.
styledLettering :: TextStyle -> Font -> Text -> a Source #
translated :: Double -> Double -> a -> a Source #
Move the image in x and y-direction.
colored :: Color -> a -> a Source #
Apply this Color
to the image.
dilated :: Double -> a -> a Source #
Scale the image in both directions using the same modifier.
scaled :: Double -> Double -> a -> a Source #
Scale the image in x and y-directions using these modifiers.
rotated :: Double -> a -> a Source #
Rotate the image around the origin using this angle in radians.
reflected :: Double -> a -> a Source #
Reflect the image across a line through the origin with this angle to the x-axis.
clipped :: Double -> Double -> a -> a Source #
Clip the image in a rectangle with this length and height.
Compose a list of pictures.
Equivalent to foldr (&) blank
.
Compose two pictures. The left argument will be drawn on top of the right argument if they overlap.
coordinatePlane :: a Source #
A static image of a coordinate plane extending 5 units in all directions.
codeWorldLogo :: a Source #
A static image of the CodeWorld logo.
An empty picture.
This is the identity element of &
.
Instances
Helpers for defining NormalizedPictures
Using the Drawable
API directly does not make much sense with NormalizedPicture
s,
since concrete parameters are abstracted.
The following functions can be used instead to build an image more generally.
someCircle :: NormalizedPicture Source #
Draw an abstract, hollow circle.
someSolidCircle :: NormalizedPicture Source #
Draw an abstract, filled in circle.
someSquare :: NormalizedPicture Source #
Draw an abstract, hollow square.
someRectangle :: NormalizedPicture Source #
Draw an abstract, hollow rectangle.
This is an alias for someSquare
.
someTallRectangle :: NormalizedPicture Source #
Draw an abstract, hollow rectangle that is taller than wide.
someWideRectangle :: NormalizedPicture Source #
Draw an abstract, hollow rectangle that is wider than tall.
someSolidSquare :: NormalizedPicture Source #
Draw an abstract, filled in square.
someSolidRectangle :: NormalizedPicture Source #
Draw an abstract, filled in rectangle.
This is an alias for someSolidSquare
.
someTallSolidRectangle :: NormalizedPicture Source #
Draw an abstract, filled in rectangle that is taller than wide.
someWideSolidRectangle :: NormalizedPicture Source #
Draw an abstract, filled in rectangle that is wider than tall.
someCurve :: Int -> NormalizedPicture Source #
Draw an abstract, open curve with this many segments.
someSolidCurve :: Int -> NormalizedPicture Source #
Draw an abstract, filled in and closed curve with this many segments.
someColor :: NormalizedPicture -> NormalizedPicture Source #
Provide an abstract shape with a color. The color will be treated as equal with any other color.
rotatedHalf :: NormalizedPicture -> NormalizedPicture Source #
Rotate an abstract shape by between a quarter and half turn.
rotatedQuarter :: NormalizedPicture -> NormalizedPicture Source #
Rotate an abstract shape by up to a quarter turn.
rotatedThreeQuarters :: NormalizedPicture -> NormalizedPicture Source #
Rotate an abstract shape by between a half and three quarters turn.
rotatedUpToFull :: NormalizedPicture -> NormalizedPicture Source #
Rotate an abstract shape by between a three quarters and up to a full turn. The full turn itself is excluded.
larger :: NormalizedPicture -> NormalizedPicture Source #
Enlarge an abstract shape. Both directions are scaled an equal amount.
largerX :: NormalizedPicture -> NormalizedPicture Source #
Enlarge an abstract shape in X-direction. The Y-direction is unchanged.
largerY :: NormalizedPicture -> NormalizedPicture Source #
Enlarge an abstract shape in Y-direction. The X-direction is unchanged.
smaller :: NormalizedPicture -> NormalizedPicture Source #
Shrink an abstract shape. Both directions are scaled an equal amount.
smallerX :: NormalizedPicture -> NormalizedPicture Source #
Shrink an abstract shape in X-direction. The Y-direction is unchanged.
smallerY :: NormalizedPicture -> NormalizedPicture Source #
Shrink an abstract shape in Y-direction. The X-direction is unchanged.
Queries on NormalizedPictures
Functions for retrieving parameters of a NormalizedPicture
.
For each parameter there is an abstract and a concrete version.
The concrete version simply removes the abstract type wrapper and returns the contained value.
These are meant to be used on non-composite values only (no &
or pictures
),
meaning only one value is returned.
Use the functions in Queries on Components if retrieval of all parameters of a specific kind is desired.
contains :: NormalizedPicture -> NormalizedPicture -> Bool Source #
True if the first image contains the second image. This uses fuzzy comparison.
count :: NormalizedPicture -> NormalizedPicture -> Int Source #
Returns how often a subpicture appears in the image.
getColor :: NormalizedPicture -> Maybe AbsColor Source #
Returns the AbsColor
of the image.
Nothing if it is one of logo or coordinate plane.
Black if none.
getRotation :: NormalizedPicture -> Maybe Angle Source #
Returns abstract rotation of the image if it has any.
getExactRotation :: NormalizedPicture -> Double Source #
Returns actual rotation of the image if it has any.
getScalingFactors :: NormalizedPicture -> (Factor, Factor) Source #
Returns the abstract scaling factors of the image. Neutral factors if none.
getExactScalingFactors :: NormalizedPicture -> (Double, Double) Source #
Returns actual scaling factors of the image. (1,1) if none.
getTranslation :: NormalizedPicture -> (Position, Position) Source #
Returns the abstract translation of the image. Neutral translation if none.
getExactTranslation :: NormalizedPicture -> (Double, Double) Source #
Returns the actual translation of the image. (0,0) if none.
getReflectionAngle :: NormalizedPicture -> Maybe Angle Source #
Returns abstract reflection of the image if it has any.
getExactReflectionAngle :: NormalizedPicture -> Double Source #
Returns actual reflection of the image if it has any.
getCircleRadius :: NormalizedPicture -> Maybe Size Source #
Returns abstract radius of the image if it actually a circle or circle segment.
getExactCircleRadius :: NormalizedPicture -> Maybe Double Source #
Returns actual radius of the image if it actually a circle or circle segment.
getRectangleLengths :: NormalizedPicture -> Maybe (Size, Size) Source #
Returns abstract side lengths of the image if it actually a rectangle.
getExactRectangleLengths :: NormalizedPicture -> Maybe (Double, Double) Source #
Returns actual side lengths of the image if it actually a rectangle.
getExactPointList :: NormalizedPicture -> [Point] Source #
Returns actual list of points in the image if it is a "free shape", [] otherwise.
Abstract Representations of CodeWorld Types
Abstract versions of data types used as parameters in CodeWorld's Picture
type.
Retain the concrete value, unless stated otherwise, so it can be extracted if necessary.
Abstract representation of radii and side lengths. All values are considered equal.
Instances
Data Size Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Size -> c Size # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Size # dataTypeOf :: Size -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Size) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Size) # gmapT :: (forall b. Data b => b -> b) -> Size -> Size # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Size -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Size -> r # gmapQ :: (forall d. Data d => d -> u) -> Size -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Size -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Size -> m Size # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Size -> m Size # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Size -> m Size # | |
Show Size Source # | |
Eq Size Source # | |
Ord Size Source # | |
Abstract representation of line drawing and filling mode. Differentiates between the three common shapes: standard, thick, filled.
This does not retain the concrete value.
Instances
Data ShapeKind Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ShapeKind -> c ShapeKind # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ShapeKind # toConstr :: ShapeKind -> Constr # dataTypeOf :: ShapeKind -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ShapeKind) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ShapeKind) # gmapT :: (forall b. Data b => b -> b) -> ShapeKind -> ShapeKind # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ShapeKind -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ShapeKind -> r # gmapQ :: (forall d. Data d => d -> u) -> ShapeKind -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ShapeKind -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ShapeKind -> m ShapeKind # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ShapeKind -> m ShapeKind # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ShapeKind -> m ShapeKind # | |
Show ShapeKind Source # | |
Eq ShapeKind Source # | |
Ord ShapeKind Source # | |
Abstract representation of angles. Rotation is divided into four equal sections on the unit circle.
Instances
Data Angle Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Angle -> c Angle # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Angle # dataTypeOf :: Angle -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Angle) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Angle) # gmapT :: (forall b. Data b => b -> b) -> Angle -> Angle # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Angle -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Angle -> r # gmapQ :: (forall d. Data d => d -> u) -> Angle -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Angle -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Angle -> m Angle # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Angle -> m Angle # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Angle -> m Angle # | |
Show Angle Source # | |
Eq Angle Source # | |
Ord Angle Source # | |
Abstract representation of scaling factors. Considers values equal if both are scaled larger, smaller or not at all.
Instances
Data Factor Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Factor -> c Factor # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Factor # toConstr :: Factor -> Constr # dataTypeOf :: Factor -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Factor) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Factor) # gmapT :: (forall b. Data b => b -> b) -> Factor -> Factor # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Factor -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Factor -> r # gmapQ :: (forall d. Data d => d -> u) -> Factor -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Factor -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Factor -> m Factor # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Factor -> m Factor # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Factor -> m Factor # | |
Show Factor Source # | |
Eq Factor Source # | |
Ord Factor Source # | |
Abstract representation of translations. Considers values equal if both are translated by a positive or negative number or not at all.
Instances
Data Position Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Position -> c Position # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Position # toConstr :: Position -> Constr # dataTypeOf :: Position -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Position) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Position) # gmapT :: (forall b. Data b => b -> b) -> Position -> Position # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Position -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Position -> r # gmapQ :: (forall d. Data d => d -> u) -> Position -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Position -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Position -> m Position # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Position -> m Position # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Position -> m Position # | |
Num Position Source # | |
Show Position Source # | |
Eq Position Source # | |
Ord Position Source # | |
Defined in CodeWorld.Test.AbsTypes |
Abstract representation of points in 2D space. All values are considered equal.
Instances
Data AbsPoint Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AbsPoint -> c AbsPoint # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AbsPoint # toConstr :: AbsPoint -> Constr # dataTypeOf :: AbsPoint -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AbsPoint) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AbsPoint) # gmapT :: (forall b. Data b => b -> b) -> AbsPoint -> AbsPoint # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AbsPoint -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AbsPoint -> r # gmapQ :: (forall d. Data d => d -> u) -> AbsPoint -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AbsPoint -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AbsPoint -> m AbsPoint # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AbsPoint -> m AbsPoint # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AbsPoint -> m AbsPoint # | |
Show AbsPoint Source # | |
Eq AbsPoint Source # | |
Ord AbsPoint Source # | |
Defined in CodeWorld.Test.AbsTypes |
Abstract representation of Color
.
Equal if each HSLA parameter has an acceptable distance from those of the other color.
Instances
Data AbsColor Source # | |
Defined in CodeWorld.Test.AbsTypes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AbsColor -> c AbsColor # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AbsColor # toConstr :: AbsColor -> Constr # dataTypeOf :: AbsColor -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AbsColor) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AbsColor) # gmapT :: (forall b. Data b => b -> b) -> AbsColor -> AbsColor # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AbsColor -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AbsColor -> r # gmapQ :: (forall d. Data d => d -> u) -> AbsColor -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AbsColor -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AbsColor -> m AbsColor # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AbsColor -> m AbsColor # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AbsColor -> m AbsColor # | |
Show AbsColor Source # | |
Eq AbsColor Source # | |
Ord AbsColor Source # | |
Defined in CodeWorld.Test.AbsTypes |
equalColorCustom :: Double -> Double -> Double -> Double -> AbsColor -> AbsColor -> Bool Source #
Allows for custom thresholds on color similarity detection. This is exported to be able to correct unexpected complications in live tests.
Spatial View
Aside from normalizing the picture and retrieving (individual) parameters, we also want to inspect how components are laid out on the canvas and query their parameters as a whole. The following data types and functions implement this more zoomed out approach.
data RelativePicSpec Source #
Abstract representation of spatial positioning between two picture components.
Instances
Show RelativePicSpec Source # | |
Defined in CodeWorld.Test.Relative Methods showsPrec :: Int -> RelativePicSpec -> ShowS # show :: RelativePicSpec -> String # showList :: [RelativePicSpec] -> ShowS # | |
Eq RelativePicSpec Source # | |
Defined in CodeWorld.Test.Relative Methods (==) :: RelativePicSpec -> RelativePicSpec -> Bool # (/=) :: RelativePicSpec -> RelativePicSpec -> Bool # | |
Ord RelativePicSpec Source # | |
Defined in CodeWorld.Test.Relative Methods compare :: RelativePicSpec -> RelativePicSpec -> Ordering # (<) :: RelativePicSpec -> RelativePicSpec -> Bool # (<=) :: RelativePicSpec -> RelativePicSpec -> Bool # (>) :: RelativePicSpec -> RelativePicSpec -> Bool # (>=) :: RelativePicSpec -> RelativePicSpec -> Bool # max :: RelativePicSpec -> RelativePicSpec -> RelativePicSpec # min :: RelativePicSpec -> RelativePicSpec -> RelativePicSpec # |
type SpatialQuery = [RelativePicSpec] -> Bool Source #
Alias for queries on spatial relationships.
isSouthOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is below the second and aligned on the X-axis.
isNorthOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is above the second and aligned on the X-axis.
isWestOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is left of the second and aligned on the Y-axis.
isEastOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is right of the second and aligned on the Y-axis.
isSouthEastOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is below and to the right of the second.
isSouthWestOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is below and to the left of the second.
isNorthEastOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is above and to the right of the second.
isNorthWestOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is above and to the left of the second.
isBelow :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is below the second, ignoring horizontal positioning.
isAbove :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is above the second, ignoring horizontal positioning.
isLeftOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is left of the second, ignoring vertical positioning.
isRightOf :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is right of the second, ignoring vertical positioning.
atSamePosition :: NormalizedPicture -> NormalizedPicture -> SpatialQuery Source #
True if the first argument is at the same position as the second.
Predicates on Components
data Components Source #
Abstract representation of a picture in terms of its components and the pairwise spatial positioning between them.
Instances
Show Components Source # | |
Defined in CodeWorld.Test.Relative Methods showsPrec :: Int -> Components -> ShowS # show :: Components -> String # showList :: [Components] -> ShowS # | |
Eq Components Source # | |
Defined in CodeWorld.Test.Relative | |
Ord Components Source # | |
Defined in CodeWorld.Test.Relative Methods compare :: Components -> Components -> Ordering # (<) :: Components -> Components -> Bool # (<=) :: Components -> Components -> Bool # (>) :: Components -> Components -> Bool # (>=) :: Components -> Components -> Bool # max :: Components -> Components -> Components # min :: Components -> Components -> Components # |
type PicPredicate = Components -> Bool Source #
Alias for predicates on Components
.
containsElem :: NormalizedPicture -> PicPredicate Source #
True if image contains at least this subpicture and optionally something else.
containsElems :: [NormalizedPicture] -> PicPredicate Source #
True if image contains at least these subpictures and optionally something else.
containsExactElems :: [NormalizedPicture] -> PicPredicate Source #
True if image contains exactly these subpictures and nothing else.
thisOften :: NormalizedPicture -> Int -> PicPredicate Source #
True if image contains this subpicture exactly this many times.
atLeast :: NormalizedPicture -> Int -> PicPredicate Source #
True if image contains this subpicture at least this many times.
atMost :: NormalizedPicture -> Int -> PicPredicate Source #
True if image contains this subpicture at most many times.
inRangeOf :: NormalizedPicture -> (Int, Int) -> PicPredicate Source #
True if amount of times this subpicture is contained in the image lies in the specified range.
(<||>) :: PicPredicate -> PicPredicate -> PicPredicate Source #
At least one of two predicates evaluates to True.
option :: PicPredicate -> PicPredicate -> PicPredicate Source #
Alias for (<||>
)
options :: [PicPredicate] -> PicPredicate Source #
At least one of many predicates evaluates to True.
ifThen :: PicPredicate -> PicPredicate -> PicPredicate Source #
oneOf :: (a -> PicPredicate) -> [a] -> PicPredicate Source #
The predicate is satisfied by at least one of the given options. Use when there's multiple shape primitives a student could use to solve the task.
evaluatePred :: PicPredicate -> Picture -> Bool Source #
Evaluates the given predicate on a student submission.
evaluatePreds :: [PicPredicate] -> Picture -> Bool Source #
Evaluates given predicates on a student submission.
Queries on Components
getComponents :: Picture -> Components Source #
Transforms student submission into spatial Components
form.
findMaybe :: (NormalizedPicture -> Bool) -> Components -> Maybe NormalizedPicture Source #
Returns the first picture element satisfying the predicate if it exists. (translation is removed)
findMaybeAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Components -> Maybe a Source #
Finds the first element satisfying a predicate, then applies a function if it exists. (translation is removed)
findMaybeActual :: (NormalizedPicture -> Bool) -> Picture -> Maybe NormalizedPicture Source #
Returns the first subpicture satisfying the predicate if it exists. (includes translation)
findMaybeActualAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Picture -> Maybe a Source #
Finds the first subpicture satisfying a predicate, then applies a function if it exists. (includes translation)
findAll :: (NormalizedPicture -> Bool) -> Components -> [NormalizedPicture] Source #
Returns all picture elements satisfying the predicate. (translation is removed)
findAllAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Components -> [a] Source #
Finds all picture elements satisfying a predicate, then applies a function. (translation is removed)
findAllActual :: (NormalizedPicture -> Bool) -> Picture -> [NormalizedPicture] Source #
Returns all subpictures satisfying the predicate. (includes translation)
findAllActualAnd :: (NormalizedPicture -> Bool) -> (NormalizedPicture -> a) -> Picture -> [a] Source #
Finds all subpictures satisfying a predicate, then applies a function. (includes translation)
Strict Pictures
Exposed internals of the student facing Picture
type.
This is useful if specific attributes can be determined directly from the un-normalized syntax tree.
Primitives from Uniplate can then be employed
to generically traverse the structure.
Type Internals
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.
Bundled Patterns
Instances
Data Picture Source # | |||||
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 # | |||||
Show Picture Source # | |||||
MuRef Picture Source # | |||||
Defined in CodeWorld.Tasks.Picture Associated Types
| |||||
NFData Picture Source # | |||||
Defined in CodeWorld.Tasks.Picture | |||||
Eq Picture Source # | |||||
Ord Picture Source # | |||||
Defined in CodeWorld.Tasks.Picture | |||||
type Rep Picture Source # | |||||
Defined in CodeWorld.Tasks.Picture | |||||
type DeRef Picture Source # | |||||
Defined in CodeWorld.Tasks.Picture type DeRef Picture |
Misc. Functions for Pictures
hasInnerPicture :: Picture -> Bool Source #
innerPicture :: Picture -> Picture Source #
isIn :: Picture -> (Point, Point) -> Bool Source #
Checks if the argument is contained completely inside a box. The coordinates of the box are given as two points with the following format:
- (minimum x-value, maximum x-value)
- (minimum y-value, maximum y-value)
Test Utility
Miscellaneous functions to use in tests.
Type Conversions
normalize :: Picture -> NormalizedPicture Source #
Convert a Picture
into a NormalizedPicture
.
This applies a number of simplifications, abstractions and rearrangements on the syntax tree of the image.
The result is a new tree in canonical form.
toConcretePicture :: NormalizedPicture -> Picture Source #
Transform a NormalizedPicture
into a Picture
.
Used to compare normalized sample solution to student submission in plain form.
This only makes sense if there's exactly one way to solve the given task.
reduceNoOrder :: Picture -> Picture Source #
Same as reduce
,
but also erases information on which subpictures are drawn in front or behind others.
Functions for Point-based Shapes
Point list based shapes like curve
, polyline
or polygon
differ from other basic shapes
in that they can be drawn anywhere instead of only in a fixed position in the origin.
Conventional detection of translation, rotation or scaling is thus not possible.
These functions help remedy this problem by comparing two point lists
to see if a transformation was applied to one to get the other.
wasTranslatedBy :: [Point] -> [Point] -> Maybe Point Source #
Returns which translation needs to be applied to argument 1 to get argument 2. Nothing if the polygons are different.
This can be used to detect translation in point list based shapes.
wasScaledBy :: [Point] -> [Point] -> Maybe (Maybe Double, Maybe Double) Source #
Returns which scaling factors need to be applied to argument 1 to get argument 2.
- Nothing if the polygons are not similar.
- Factors themselves can also be Nothing if the factor is undeterminable.
E.g. a possible result could be Just (Just 3, Nothing)
.
This means the second shape is a scaled version of the first and the factor in X-direction is 3,
but the factor in Y-direction cannot be determined.
This can be used to detect size scaling in point list based shapes.
wasRotatedBy :: [Point] -> [Point] -> Maybe Double Source #
Returns which rotation needs to be applied to argument 1 to get argument 2. Nothing if it does not exist.
This can be used to detect rotation in point list based shapes.
Animation Test Frame Generators
irregularSamples :: [Double] Source #
An infinite list of animation sampling points. The basis is made of irrational square roots, exp(1) and π. The provided samples should not overlap with any particular phase a student submitted animation may have.
samplesUntil :: Double -> Double -> [Double] Source #
Generates irregular sample frames starting from 0 with given step size and cutoff point. The step size is only an approximation, since the generated values are based on irrational numbers.
CSE detection
testCSE :: Picture -> IO (Maybe String) Source #
Produce student feedback on common subexpression elimination for a Picture
value.
This compares the results of the Hashcons and Reify methods to determine unused sharing potential.
Returns Nothing
if all possible terms are shared.
This runs in an IO
context, since Reify uses StableName
to track sharing.
Re-exports of CodeWorld Interface
Math
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.
scaledVector :: Double -> Double -> Vector -> Vector Source #
Scales a vector by the given scalar multiplier.
Text Rendering Modifiers
Text font type used for stylized message rendering.
Instances
Data Font Source # | |||||
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 # 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 # | |||||
Defined in CodeWorld.Tasks.Types Associated Types
| |||||
Show Font Source # | |||||
NFData Font Source # | |||||
Defined in CodeWorld.Tasks.Types | |||||
Eq Font Source # | |||||
Ord Font Source # | |||||
type Rep Font Source # | |||||
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))))) |
Font modifier type used for stylized message rendering.
Instances
Data TextStyle Source # | |||||
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 # | |||||
Defined in CodeWorld.Tasks.Types Associated Types
| |||||
Show TextStyle Source # | |||||
NFData TextStyle Source # | |||||
Defined in CodeWorld.Tasks.Types | |||||
Eq TextStyle Source # | |||||
Ord TextStyle Source # | |||||
type Rep TextStyle Source # | |||||
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))) |
Colour
Color type mirroring CodeWorld's equivalent type. The exposed constructors allow for setting colors directly via numerical values.
Instances
lighter :: Double -> Color -> Color Source #
Increase argument's luminosity by a user defined amount.
brighter :: Double -> Color -> Color Source #
Increase argument's saturation by a user defined amount.
translucent :: Color -> Color Source #
Slightly increase argument's transparency.
assortedColors :: [Color] Source #
An infinite list of different colours.
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.