FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University
This Week Finish reactive programming examples Catch up on homework Get started on projects Quiz on Wednesday! There will be a project milestone due next week – I’ll be meeting with everyone to talk about this Note: Alex is out this week – see me if you need help.
Homework 6 Questions? How does expression parsing work? How does pretty printing work? How do you add pretty printing as default printers? As a separate class?
FRP, Behaviors, and Events Event a Denotes an event stream. Each occurrence delivers value of type a keyboard :: Event Char Behavior a Denotes a continuously available value of type a mouse :: Behavior Point2
Classic FRP Operations lift0 :: a -> Behavior a lift1 :: (a -> b) -> Behavior a -> Behavior b hold :: a -> Event a -> Behavior a when :: Behavior Bool -> Event () snap :: Event a -> Behavior b -> Event b (-=>) :: Event b -> a -> Event a tags :: Event b -> [a] -> Event a (.|.) :: Event a -> Event a -> Event a switch :: Behavior a -> Event (Behavior a) -> Behavior a integral :: Behavior Double -> Behavior Double clock :: Double -> Event Double once :: Event a -> Event a
Examples content/uploads/2011/02/icra99.pdf content/uploads/2011/02/icra99.pdf
Examples in Python Taken from the Western Computer Camp
Project Meetings