definition module mTaskLCD import mTask :: LCD = { cursorRow :: Int , cursorCol :: Int , sizeH :: Int , sizeW :: Int , lcdtxt :: [String] } :: Button = RightButton | UpButton | DownButton | LeftButton | SelectButton | NoButton class lcd v where begin :: (v LCD Expr) (v Int p) (v Int q) -> v () Expr print :: (v LCD Expr) (v t p) -> v Int Expr | stringQuotes t // returns bytes written setCursor :: (v LCD Expr) (v Int p) (v Int q) -> v () Expr liquidCrystal0 :: [DigitalPin] ((v LCD Expr)->Main (v b q)) -> Main (v b q) LCD :: Int Int [DigitalPin] ((v LCD Expr)->Main (v b q)) -> Main (v b q) scrollLeft :: (v LCD Expr) -> v () Expr scrollRight :: (v LCD Expr) -> v () Expr pressed :: (v Button Expr) -> v Bool Expr instance lcd Code instance lcd Eval printAt :: (v LCD Expr) (v Int b) (v Int c) (v t e) -> v Int Stmt | lcd, seq v & stringQuotes t keySwitch :: (a Int b) (a c d,a c e,a c f,a c g,a c h,a c a0) -> a c Stmt | arith, boolExpr, seq a & If a h a0 b0 & If a g b0 c0 & If a f c0 d0 & If a e d0 e0 & If a d e0 f0 & type c derive toGenDynamic LCD derive fromGenDynamic LCD instance toCode Button RightBound :== 50 UpBound :== 190 DownBound :== 380 LeftBound :== 555 SelectBound :== 790 rightButton :== lit RightButton upButton :== lit UpButton downButton :== lit DownButton leftButton :== LeftButton selectButton :== lit SelectButton noButton :== lit NoButton