a lightweight approach
play

A Lightweight Approach Wolfgang Jeltsch to Start Time Consistency - PowerPoint PPT Presentation

A Lightweight Approach to Start Time Consistency in Haskell A Lightweight Approach Wolfgang Jeltsch to Start Time Consistency in Haskell Introduction Categorical models FRP in Wolfgang Jeltsch Haskell, inconsistently Applicative


  1. A Lightweight Approach to Start Time Consistency in Haskell A Lightweight Approach Wolfgang Jeltsch to Start Time Consistency in Haskell Introduction Categorical models FRP in Wolfgang Jeltsch Haskell, inconsistently Applicative TT¨ U K¨ uberneetika Instituut functors Start time Teooriaseminar consistency via timed values February 9, 2012 A lightweight solution Conclusions and outlook

  2. A Lightweight Approach 1 Introduction to Start Time Consistency in Haskell Wolfgang 2 Categorical models Jeltsch Introduction 3 FRP in Haskell, inconsistently Categorical models FRP in 4 Applicative functors Haskell, inconsistently Applicative functors 5 Start time consistency via timed values Start time consistency via timed values 6 A lightweight solution A lightweight solution Conclusions 7 Conclusions and outlook and outlook

  3. Functional reactive programming A Lightweight Approach to Start Time Consistency declarative approach to programming reactive systems in Haskell Wolfgang functional programming extended with support Jeltsch for temporal processes Introduction examples of processes: Categorical models behaviors time-varying values: FRP in Haskell, inconsistently � Behavior α � ≈ Time → � α � Applicative functors events values at points in time: Start time consistency via timed values � Event α � ≈ Time × � α � A lightweight solution Conclusions and outlook

  4. Start times A Lightweight Approach processes have associated start times: to Start Time Consistency behaviors provides values only at their start times and later in Haskell events can only fire at their start times or later Wolfgang Jeltsch processes appearing within other processes at some time t must start at t Introduction Categorical introduce a start time parameter to the meanings of types: models behaviors: FRP in Haskell, inconsistently � Behavior α � ( t ) = Π t ′ : Time . ( t � t ′ ) → � α � ( t ′ ) Applicative functors events: Start time consistency via � Event α � ( t ) = Σ t ′ : Time . ( t � t ′ ) × � α � ( t ′ ) timed values A lightweight solution start time parameter passed downwards for ordinary Conclusions type constructors and outlook

  5. A Lightweight Approach 1 Introduction to Start Time Consistency in Haskell Wolfgang 2 Categorical models Jeltsch Introduction 3 FRP in Haskell, inconsistently Categorical models FRP in 4 Applicative functors Haskell, inconsistently Applicative functors 5 Start time consistency via timed values Start time consistency via timed values 6 A lightweight solution A lightweight solution Conclusions 7 Conclusions and outlook and outlook

  6. Temporal categories A Lightweight basic constructions in Haskells type system: Approach to Start Time finite products Consistency in Haskell finite sums Wolfgang function spaces Jeltsch modelled by bicartesian closed categories (BCCCs): Introduction objects correspond to types Categorical models morphisms correspond to functions FRP in support for FRP by extending BCCCs to temporal Haskell, inconsistently categories (TCs): Applicative objects correspond to types functors morphisms correspond to families of functions Start time consistency via with one function per time: timed values A lightweight Π t : Time . � α � ( t ) → � β � ( t ) solution Conclusions Behavior and Event correspond to functors ✷ and ✸ and outlook

  7. FRP operations in temporal categories A Lightweight Approach natural transformations for operations where all involved to Start Time Consistency processes have the same start time: in Haskell Wolfgang m A , B : ✷ A × ✷ B → ✷ ( A × B ) Jeltsch µ A : ✸✸ A → ✸ A Introduction Categorical s A , B : ✷ A × ✸ B → ✸ ( A × B ) models FRP in Haskell, etc. inconsistently transforming values inside behaviors and events: Applicative functors for every f : A → B , we have: Start time consistency via ✷ f : ✷ A → ✷ B timed values A lightweight ✸ f : ✸ A → ✸ B solution Conclusions safe, because f : A → B includes a function for every time and outlook

  8. Tensorial strength A Lightweight Approach to Start Time Consistency in Haskell Wolfgang Jeltsch two natural transformations: Introduction t ✷ A , B : A × ✷ B → ✷ ( A × B ) Categorical models t ✸ A , B : A × ✸ B → ✸ ( A × B ) FRP in Haskell, inconsistently disallowed, because they would have to shift values Applicative functors to different times Start time consistency via timed values A lightweight solution Conclusions and outlook

  9. A Lightweight Approach 1 Introduction to Start Time Consistency in Haskell Wolfgang 2 Categorical models Jeltsch Introduction 3 FRP in Haskell, inconsistently Categorical models FRP in 4 Applicative functors Haskell, inconsistently Applicative functors 5 Start time consistency via timed values Start time consistency via timed values 6 A lightweight solution A lightweight solution Conclusions 7 Conclusions and outlook and outlook

  10. A straightforward implementation approach A Lightweight Approach to Start Time Consistency in Haskell polymorphic functions for natural transformations: Wolfgang fuse :: ( Behavior α, Behavior β ) → Behavior ( α, β ) Jeltsch join :: Event ( Event α ) → Event α Introduction Categorical sample :: ( Behavior α, Event β ) → Event ( α, β ) models Haskell’s Functor class for functors: FRP in Haskell, inconsistently class Functor f where Applicative fmap :: ( α → β ) → ( f α → f β ) functors Start time instance Functor Behavior where . . . consistency via timed values instance Functor Event where . . . A lightweight solution Conclusions and outlook

  11. Tensorial strength through the backdoor A Lightweight fmap is a Haskell function Approach to Start Time so it corresponds to a morphism itself Consistency in Haskell for each functor F , we have the following: Wolfgang Jeltsch A , B : B A → FB FA ϕ F Introduction allows us to construct tensorial strength: Categorical models Λid A × B : A → ( A × B ) B FRP in Haskell, inconsistently ϕ F B , A × B (Λid A × B ) : A → F ( A × B ) FB Applicative B , A × B (Λid A × B ) × id FB ) : A × FB → F ( A × B ) FB × FB ( ϕ F functors Start time e ( ϕ F B , A × B (Λid A × B ) × id FB ) : A × FB → F ( A × B ) consistency via timed values A lightweight the same in Haskell: solution strength :: ( Functor f ) ⇒ ( α, f β ) → f ( α, β ) Conclusions and outlook strength ( x , f ) = fmap (( , ) x ) f

  12. A Lightweight Approach 1 Introduction to Start Time Consistency in Haskell Wolfgang 2 Categorical models Jeltsch Introduction 3 FRP in Haskell, inconsistently Categorical models FRP in 4 Applicative functors Haskell, inconsistently Applicative functors 5 Start time consistency via timed values Start time consistency via timed values 6 A lightweight solution A lightweight solution Conclusions 7 Conclusions and outlook and outlook

  13. Applicative functors A Lightweight Approach functors support lifting of unary functions: to Start Time Consistency fmap :: ( Functor f ) ⇒ ( α → β ) → ( f α → f β ) in Haskell Wolfgang applicative functors support lifting of functions Jeltsch of arbitrary arity: Introduction liftA n :: ( Applicative f ) ⇒ Categorical ( α 1 → · · · → α n → β ) models → FRP in ( f α 1 → · · · → f α n → f β ) Haskell, inconsistently Applicative class contains two methods: Applicative functors pure = liftA 0 ( ⊛ ) = liftA 2 ($) Start time consistency via timed values for arbitrary n ∈ N , liftA n can be derived: A lightweight solution liftA n f f 1 . . . f n = pure f ⊛ f 1 ⊛ · · · ⊛ f n Conclusions and outlook

  14. A Lightweight Approach 1 Introduction to Start Time Consistency in Haskell Wolfgang 2 Categorical models Jeltsch Introduction 3 FRP in Haskell, inconsistently Categorical models FRP in 4 Applicative functors Haskell, inconsistently Applicative functors 5 Start time consistency via timed values Start time consistency via timed values 6 A lightweight solution A lightweight solution Conclusions 7 Conclusions and outlook and outlook

  15. Timed values A Lightweight Approach to Start Time no functions that directly work with behaviors and events Consistency in Haskell user can construct only values that are valid Wolfgang independently of time Jeltsch type constructor At for encapsulating values that are fixed Introduction to some time: Categorical models At has a phantom parameter t that represents a time FRP in At t α contains all values of type α that are valid at t Haskell, inconsistently in particular: Applicative At t ( Behavior α ) contains all behaviors that start at t functors At t ( Event α ) contains all events that start at t Start time consistency via for every t , At t is an applicative functor: timed values liftA n :: ( α 1 → β ) → · · · → α n → A lightweight solution ( At t α 1 → · · · → At t α n → At t β ) Conclusions and outlook

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend