-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Graphics library for CodeWorld -- -- This module provides the drawing code for CodeWorld. It is heavily -- inspired by Gloss, but modified for consistency and pedagogical -- reasons. -- -- It comes with two backends. When compiled with GHCJS, it uses the -- JavaScript FFI to run on http://code.world/. When compiled with -- GHC, it uses the blank-canvas package to provide a webpage consisting -- of just a panel locally. This way, the same program that runs on the -- CodeWorld server can also be run locally. @package codeworld-api @version 0.3 module CodeWorld -- | Draws a Picture. This is the simplest CodeWorld entry point. drawingOf :: Picture -> IO () -- | Shows an animation, with a picture for each time given by the -- parameter. animationOf :: (Double -> Picture) -> IO () -- | Runs an interactive CodeWorld program that responds to events. -- Activities can interact with the user, change over time, and remember -- information about the past. activityOf :: world -> (Event -> world -> world) -> (world -> Picture) -> IO () -- | Runs an interactive CodeWorld program in debugging mode. In this mode, -- the program gets controls to pause and manipulate time, and even go -- back in time to look at past states. debugActivityOf :: world -> (Event -> world -> world) -> (world -> Picture) -> IO () -- | Runs an interactive multi-user CodeWorld program that is joined by -- several participants over the internet. groupActivityOf :: Int -> StaticPtr (StdGen -> world) -> StaticPtr (Int -> Event -> world -> world) -> StaticPtr (Int -> world -> Picture) -> IO () -- | A version of groupActivityOf that avoids static pointers, and -- does not check for consistency. unsafeGroupActivityOf :: Int -> (StdGen -> world) -> (Int -> Event -> world -> world) -> (Int -> world -> Picture) -> IO () -- | Shows a simulation, which is essentially a continuous-time dynamical -- system described by an initial value and step function. simulationOf :: world -> (Double -> world -> world) -> (world -> Picture) -> IO () debugSimulationOf :: world -> (Double -> world -> world) -> (world -> Picture) -> IO () -- | Runs an interactive event-driven CodeWorld program. This is a -- generalization of simulations that can respond to events like key -- presses and mouse movement. interactionOf :: world -> (Double -> world -> world) -> (Event -> world -> world) -> (world -> Picture) -> IO () debugInteractionOf :: world -> (Double -> world -> world) -> (Event -> world -> world) -> (world -> Picture) -> IO () -- | Runs an interactive multi-user CodeWorld program, involving multiple -- participants over the internet. collaborationOf :: Int -> StaticPtr (StdGen -> world) -> StaticPtr (Double -> world -> world) -> StaticPtr (Int -> Event -> world -> world) -> StaticPtr (Int -> world -> Picture) -> IO () -- | A version of collaborationOf that avoids static pointers, and -- does not check for consistent parameters. unsafeCollaborationOf :: Int -> (StdGen -> world) -> (Double -> world -> world) -> (Int -> Event -> world -> world) -> (Int -> world -> Picture) -> IO () data Picture data TextStyle Plain :: TextStyle Bold :: TextStyle Italic :: TextStyle data Font SansSerif :: Font Serif :: Font Monospace :: Font Handwriting :: Font Fancy :: Font NamedFont :: !Text -> Font -- | A blank picture blank :: HasCallStack => Picture -- | A thin sequence of line segments, with these points as endpoints polyline :: HasCallStack => [Point] -> Picture -- | A thin sequence of line segments, with these points as endpoints -- | Warning: Please use polyline instead of path.path may be removed -- July 2019. path :: HasCallStack => [Point] -> Picture -- | A thick sequence of line segments, with given line width and endpoints thickPolyline :: HasCallStack => Double -> [Point] -> Picture -- | A thick sequence of line segments, with given line width and endpoints -- | Warning: Please used thickPolyline instead of thickPath.thickPath -- may be removed July 2019. thickPath :: HasCallStack => Double -> [Point] -> Picture -- | A thin polygon with these points as vertices polygon :: HasCallStack => [Point] -> Picture -- | A thick polygon with this line width and these points as vertices thickPolygon :: HasCallStack => Double -> [Point] -> Picture -- | A solid polygon with these points as vertices solidPolygon :: HasCallStack => [Point] -> Picture -- | A smooth curve passing through these points. curve :: HasCallStack => [Point] -> Picture -- | A thick smooth curve with this line width, passing through these -- points. thickCurve :: HasCallStack => Double -> [Point] -> Picture -- | A smooth closed curve passing through these points. closedCurve :: HasCallStack => [Point] -> Picture -- | A thick smooth closed curve with this line width, passing through -- these points. thickClosedCurve :: HasCallStack => Double -> [Point] -> Picture -- | A solid smooth closed curve passing through these points. solidClosedCurve :: HasCallStack => [Point] -> Picture -- | A thin rectangle, with this width and height rectangle :: HasCallStack => Double -> Double -> Picture -- | A solid rectangle, with this width and height solidRectangle :: HasCallStack => Double -> Double -> Picture -- | A thick rectangle, with this line width, and width and height thickRectangle :: HasCallStack => Double -> Double -> Double -> Picture -- | A thin circle, with this radius circle :: HasCallStack => Double -> Picture -- | A solid circle, with this radius solidCircle :: HasCallStack => Double -> Picture -- | A thick circle, with this line width and radius thickCircle :: HasCallStack => Double -> Double -> Picture -- | A thin arc, starting and ending at these angles, with this radius -- -- Angles are in radians. arc :: HasCallStack => Double -> Double -> Double -> Picture -- | A solid sector of a circle (i.e., a pie slice) starting and ending at -- these angles, with this radius -- -- Angles are in radians. sector :: HasCallStack => Double -> Double -> Double -> Picture -- | A thick arc with this line width, starting and ending at these angles, -- with this radius. -- -- Angles are in radians. thickArc :: HasCallStack => Double -> Double -> Double -> Double -> Picture -- | A rendering of text characters. -- | Warning: Please used lettering instead of text.text may be removed -- July 2019. text :: HasCallStack => Text -> Picture -- | A rendering of text characters. lettering :: HasCallStack => Text -> Picture -- | A rendering of text characters, with a specific choice of font and -- style. -- | Warning: Please used styledLettering instead of -- styledText.styledText may be removed July 2019. styledText :: HasCallStack => TextStyle -> Font -> Text -> Picture -- | A rendering of text characters onto a Picture, with a specific choice -- of font and style. styledLettering :: HasCallStack => TextStyle -> Font -> Text -> Picture -- | A picture drawn entirely in this color. colored :: HasCallStack => Color -> Picture -> Picture -- | A picture drawn entirely in this colour. coloured :: HasCallStack => Color -> Picture -> Picture -- | A picture drawn translated in these directions. translated :: HasCallStack => Double -> Double -> Picture -> Picture -- | A picture scaled by these factors. scaled :: HasCallStack => Double -> Double -> Picture -> Picture -- | A picture scaled by these factors. dilated :: HasCallStack => Double -> Picture -> Picture -- | A picture rotated by this angle. -- -- Angles are in radians. rotated :: HasCallStack => Double -> Picture -> Picture pictures :: HasCallStack => [Picture] -> Picture -- | An associative operation. (<>) :: Semigroup a => a -> a -> a infixr 6 <> -- | Binary composition of pictures. (&) :: HasCallStack => Picture -> Picture -> Picture infixr 0 & -- | A coordinate plane. Adding this to your pictures can help you measure -- distances more accurately. -- -- Example: -- -- main = drawingOf (myPicture <> coordinatePlane) myPicture = ... coordinatePlane :: HasCallStack => Picture -- | The CodeWorld logo. codeWorldLogo :: HasCallStack => Picture type Point = (Double, Double) translatedPoint :: Double -> Double -> Point -> Point rotatedPoint :: Double -> Point -> Point scaledPoint :: Double -> Double -> Point -> Point dilatedPoint :: Double -> Point -> Point type Vector = (Double, Double) vectorLength :: Vector -> Double vectorDirection :: Vector -> Double vectorSum :: Vector -> Vector -> Vector vectorDifference :: Vector -> Vector -> Vector scaledVector :: Double -> Vector -> Vector -- | Angle is in radians rotatedVector :: Double -> Vector -> Vector dotProduct :: Vector -> Vector -> Double data Color RGBA :: !Double -> !Double -> !Double -> !Double -> Color type Colour = Color pattern RGB :: Double -> Double -> Double -> Color pattern HSL :: Double -> Double -> Double -> Color black :: Color white :: Color red :: Color green :: Color blue :: Color -- | Warning: Please use the RGB function instead of cyan.The variable -- cyan may be removed July 2020. cyan :: Color -- | Warning: Please use the RGB function instead of magenta.The -- variable magenta may be removed July 2020. magenta :: Color yellow :: Color -- | Warning: Please use the RGB function instead of aquamarine.The -- variable aquamarine may be removed July 2020. aquamarine :: Color orange :: Color -- | Warning: Please use the RGB function instead of azure.The variable -- azure may be removed July 2020. azure :: Color -- | Warning: Please use Purple instead of violet.The variable violet -- may be removed July 2020. violet :: Color -- | Warning: Please use the RGB function instead of chartreuse.The -- variable chartreuse may be removed July 2020. chartreuse :: Color -- | Warning: Please use the RGB function instead of rose.The variable -- rose may be removed July 2020. rose :: Color brown :: Color pink :: Color purple :: Color gray :: Color grey :: 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 -- | An infinite list of colors. assortedColors :: [Color] hue :: Color -> Double saturation :: Color -> Double luminosity :: Color -> Double alpha :: Color -> Double -- | Warning: Please use white (lower case) instead of White.The value -- White may be removed July 2019. pattern White :: Color -- | Warning: Please use black (lower case) instead of Black.The value -- Black may be removed July 2019. pattern Black :: Color -- | Warning: Please use gray (lower case) instead of Gray.The value -- Gray may be removed July 2019. pattern Gray :: Color -- | Warning: Please use grey (lower case) instead of Grey.The value -- Grey may be removed July 2019. pattern Grey :: Color -- | Warning: Please use red (lower case) instead of Red.The value Red -- may be removed July 2019. pattern Red :: Color -- | Warning: Please use orange (lower case) instead of Orange.The value -- Orange may be removed July 2019. pattern Orange :: Color -- | Warning: Please use yellow (lower case) instead of Yellow.The value -- Yellow may be removed July 2019. pattern Yellow :: Color -- | Warning: Please use green (lower case) instead of Green.The value -- Green may be removed July 2019. pattern Green :: Color -- | Warning: Please use blue (lower case) instead of Blue.The value -- Blue may be removed July 2019. pattern Blue :: Color -- | Warning: Please use purple (lower case) instead of Purple.The value -- Purple may be removed July 2019. pattern Purple :: Color -- | Warning: Please use pink (lower case) instead of Pink.The value -- Pink may be removed July 2019. pattern Pink :: Color -- | Warning: Please use brown (lower case) instead of Brown.The value -- Brown may be removed July 2019. pattern Brown :: Color -- | An event initiated by the user. -- -- Values of this type represent events that the user triggers when using -- an interactive program. -- -- Key events describe the key as Text. Most keys are represented -- by a single character text string, with the capital letter or other -- symbol from the key. Keys that don't correspond to a single character -- use longer names from the following list. Keep in mind that not all of -- these keys appear on all keyboards. -- --