fz      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyCCHolds information of a label (coloured area) relevant for the Piet B language, i. e. information about where the program flow will be ) directed regarding a Direction Pointer. @Holds a border position (e. g. an x-coordinate) and the minimum  or maximum associated "other"$ coordinates (e. g. y-coordinates). Where the border is located Minimum "other" coordinate of the border Maximum "other" coordinate of the border >Stores compiler-relevant information about a label. This type  implements an instance of z to merge labels. #Label with a size and four borders Number of pixels  Top border  left border Bottom border  Right border The empty label We' ll just use {s to identifiy labels. "An image. Its coordinates will be (0, 0) .. (width-1, height-1) | Width of an  in pixels.  Height of an  in pixels. }An ~ storing the pixels of an . (Hue lightness values supported by Piet. Piet colours in the hue cycle. .The colours that make up a Piet program text.   Runtime program representation. !"Original image #Labelled image $Information about the labels %'Piet types. Relevant to distinguish in-/output strategies. &'(The Codel Chooser (CC). )*+The Direction Pointer (DP). ,-./00Move coordinates by one in the direction of the +. Direction to move to  x-coordinate  y-coordinate New x-/y-coordinates 1 Rotate a +% clockwise (counter clockwise if the { is % negative) a given number of times. 2 Toggle a ( a given number of times. 3=Returns if a given codel in a program is blocked in the Piet 5 sense (which is the case when it is out of the image' s range or  ). 4 Converts red/green/blue/alpha values to a . The alpha channel B is ignored for now, but may be used in future implementations or 2 dialects, so please use this function instead of 5 whenever  an alpha channel is available. red green blue alpha 5 Converts red/green/blue values to a . If the supplied % arguments do not form a proper Piet ,  is returned. red green blue 6Hue difference between two s.  means no change,   one step and so forth. 74Lightness difference between Piet lightness values.   represents no change,  one step darker and   two steps darker. 8Build a new image. Width Height Coordinate-value list 92Find out, if the given coordinates are within the   borders (which are  (0, 0) .. (width-1, height-1)).  x-coordinate  y-coordinate An  If (x, y) is within the  :Access a pixel at given x/y-coordinates.  x-coordinate  y-coordinate ;Set a pixel at given x/y-coordinates. <>Number of pixels in a label. This function is defined for all  constructors of  so, in contrast to , it  won' t fail on   .  Merge two  s holding a maximum coordinate.  Merge two  s holding a minimum coordinate. General merge, see  and  =Add a pixel to a . >  !"#$%&'()*+,-./0123456789:;<=@+/.-,01(*)2%'& !"#$3456798:;   <=>    !"#$!"#$%'&&'(*))*+/.-,,-./0123456789:;<=GDetects equivalence classes. Invariant: Every element is mapped to the  minimum of it's equivalence class. #Status of the labelling algorithm. Current pixel to investigate  Next unused    Each pixel contains a label key  Mapping from  s to s +Holds information about label equivalences >Load an  holding Piet s from a given file. 6 If the codel length is known, it should be passed as  = argument, otherwise, it is guessed from the file. Note that  " codel length") means the edge length of the codels and  not their size. /This function is not thread safe due to imlib2! Codel length or  if unknown The image file location  Build an  " from the current imlib2 context. Codel length (not size) The image data BGuess the codel length from the image that is currently loaded in A the imlib2 buffer. The guess simply is the the gcd of the image B width, length and the length of all equally coloured subrows and  -cols. ? Compile an   to a Piet ! . @DLabel an image with 4-neighbourship and equivalence as neighbouring  condition, which is A (==). A&Labels an image with 4-neighbourship. 6Decides whether two neighbouring pixels are adjacent. The  to be labelled. A mask $ (containing a key for every pixel) " and a mapping from these keys to . ,Labelling algorithm expressed in terms of a , see  A. /Find the equivalence class of a given element. Insert a new equivalence. >?@A>?@A>?@A BThe B type. CO(1). Tests, if a B is empty. DO(1)". Looks at the top element of the B . Returns   if the stack is empty. EO(1). Construct an empty . FO(1). Construct a B containing a single element. GO(1). Push an element on the B. HO(1). Pop the top element from the B if it is not empty. I O(log(n)). A single roll to depth n is defined as burying the top  value on the stack n/ deep and bringing all values above it up by 1 F place. A negative number of rolls rolls in the opposite direction. A  negative depth results in an . Number of rolls Depth  Original B Rotated B JO(n). Convert a list into a  . The list's head will be  the first element of the  KO(n) . Convert a B to a list. The D of the B  will be the list's head. BCDEFGHIJK BCDEFGHIJK BCDEFGHIJK$L8A monad encapsulating the status of a Piet interpreter. M+Describes the importance of a log message. NA fatal error has occured. O!A recoverable error has occured. PUsual log level. QRather verbosed output. +A request a Piet interpreter may send to it's environment. The Program has terminated. A log message has been issued. 4The interpreter wants to print something to STDOUT. *The interpreter wants to read from STDIN. R"The status of a Piet interpreter. Direction Pointer Codel Chooser  Position Stack S'Returns the current Direction Pointer. TSets the Direction Pointer. U#Returns the current Codel Chooser. V Sets the current Codel Chooser. WReturns the current position. XSets the current position. YPushes a given { value on the stack. Z;Pops the top value from the stack. If the stack was empty,   is returned,  the top value otherise. [ Performs the I operation on the stack.  Roll number Depth Reads the given % from STDIN. \Reads a number from STDIN. ]=Reads a character from STDIN. Note that it is returned as an {. ^'Issue log message with given priority. #Prints a representation of a given % to STDOUT. _Prints a number to STDOUT. `@Converts a given number to a character and prints it to STDOUT. a@Quit a program. Any command following this one will be ignored. b$Executes a program represented by a L. I/ O operations = (reading and writing numbers or characters) is delegated to  callback functions. Callback to read from STDIN Print callback Logging callback The program to be executed Result of the L or an error message LMNOPQRSTUVWXYZ[\]^_`abLRMQPONSTUVWXYZ[_`\]^abLMQPONNOPQRSTUVWXYZ[\]^_`abcBPushes the value of the colour block just exited on to the stack. C Note that values of colour blocks are not automatically pushed on D to the stack - this push operation must be explicitly carried out. d2Pops the top value off the stack and discards it. eAPops the top two values off the stack, adds them, and pushes the  result back on the stack. fDPops the top two values off the stack, subtracts the top value from @ the second top value, and pushes the result back on the stack. gGPops the top two values off the stack, multiplies them, and pushes the  result back on the stack. hGPops the top two values off the stack, calculates the integer division I of the second top value by the top value, and pushes the result back on  the stack. iGPops the top two values off the stack, calculates the second top value @ modulo the top value, and pushes the result back on the stack. jGReplaces the top value of the stack with 0 if it is non-zero, and 1 if  it is zero. kGPops the top two values off the stack, and pushes 1 on to the stack if H the second top value is greater than the top value, and pushes 0 if it  is not greater. lHPops the top value off the stack and rotates the DP clockwise that many $ steps (anticlockwise if negative). mEPops the top value off the stack and toggles the CC that many times. n=Pushes a copy of the top value on the stack on to the stack. o*Pops the top two values off the stack and "rolls" the remaining stack E entries to a depth equal to the second value popped, by a number of ? rolls equal to the first value popped. A single roll to depth n is / defined as burying the top value on the stack n deep and bringing all H values above it up by 1 place. A negative number of rolls rolls in the E opposite direction. A negative depth is an error and the command is  ignored. In this implementation, "ignored" means that the top two values B remain pushed off the stack, while the rest of the stack remains  unmodified. p:Reads a number from STDIN and pushes it on to the stack. q7Reads a char from STDIN and pushes it on to the stack. r9Pops the top value off the stack and prints it to STDOUT  as a number. s9Pops the top value off the stack and prints it to STDOUT  as a char. <Pops the top element of the stack, applies a function to it . and pushes the result back on the stack. The  describes 0 the calling Piet function for possible errors. >Pops the top two elements of the stack, applies a function to @ them (the first argument will be the first element popped from @ the stack, the 2nd will be the 2nd) and pushes the result back  on the stack. The % describes the calling Piet function - and might be needed to give error messages. (Pops the top element from the stack and  s if none is  available (with the given  as location). <Tries to pop the top element from the stack and returns it. = If the stack is empty, the alternative action is performed. (Will be executed if the stack is empty. 'Returns the top stack entry otherwise. Helper that issues a Q log message and prefixes  it with the current position. cdefghijklmnopqrscdefghijklmnopqrscdefghijklmnopqrstInterpret a Piet ! . Interpret a Piet !  Previous'- block colour and size if it was a hue-block Program uFind a way out of the current  block. a if there  is no way out. See u. The {" determines the maximum remaining  moves by one codel and DP/ CC changes. v!Find coordinates and resulting DP/&CC of the successing non-black block,  if it exists,  otherwise. Program Current block DP CC +Next coordinates, DP and CC (if available) wGiven a label, a + and a (, this B function finds the coordinates of the next block to enter. These B coordinates are not guaranteed to be valid, they might be out of  range or point to a  or  block. Current label DP CC Where to enter the next block xPiet'.s commands are issued by a colour change, see   -http://www.dangermouse.net/esoteric/piet.html. This function ? takes two neighbouring colours and returns the resulting Piet 9 command, which is a function consuming (or more likely,  ignoring) an {- (the size of the colour block that is being  left) and returning a L ().  of the "from"-block  of the "from"-block  of the "to"-block  of the "to"-block The size of the "from"-block Resulting Piet operation y+Converts a colour difference calculated by  Language.Piet.Types.colourChange and  7 to a L () , compare x. tuvwxytuvwxytuvwxyp  !"#$%&'()*+,-./0123456789:;<=>?@ALMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy       !"#$%&&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~QWpiet-0.1Language.Piet.TypesLanguage.Piet.CompilerData.RollStackLanguage.Piet.PietMonadLanguage.Piet.CommandsLanguage.Piet.Interpreter Language.Piet LabelBorder borderCoord borderMin borderMax LabelInfo _labelSizelabelTop labelLeft labelBottom labelRight EmptyInfoLabelKeyImageimgWidth imgHeight LightnessDarkNormalLight HueColourMagentaBlueCyanGreenYellowRedColourHueWhiteBlackProgramimagemaskinfoPietTypePietChar PietNumber CodelChooserCCRightCCLeftDirectionPointerDPUpDPLeftDPDownDPRightaddCoordinatesrotatetoggle isBlocked rgba2Colour rgb2Colour hueChangelightnessChangeimgNew imgInRangeimgPixel imgSetPixel labelSizeaddPixel imgFromFilecompilelabel4 label4With RollStackisEmptytopempty singletonpushpoprollfromListtoList PietMonadLogLevelFatalErrorInfoVerbosedInterpreterStatusgetDPsetDPgetCCsetCC getPosition setPosition stackPushstackPop stackRoll readNumberreadChar logMessage printNumber printChar terminate runPietMonad piet_pushpiet_poppiet_add piet_subtract piet_multiply piet_dividepiet_modpiet_not piet_greater piet_pointer piet_switchpiet_duplicate piet_rollpiet_in_number piet_in_charpiet_out_number piet_out_char interpretinterpretWhite nonBlackSuccsuccCoordinatescolours2CommandcolourDiff2Commandbase Data.MonoidMonoidghc-prim GHC.TypesInt imgPixelsGHC.ArrArraymergeMinmergeMaxmergeEquivalenceMapLabellingStatus_currentCoords_nextKey_mask_infoMap _equivalences Data.MaybeJustNothingimageFromContextimageGuessCodelLength label4With' equivClass equivInsertStackGHC.Errerror PietRequest TerminateLogPrintReaddpccpositionstackreadType printTypeonStack1GHC.BaseStringonStack2 forcePopFailfailforcePoplogWithPosition interpret'interpretWhite'