When building user interfaces it is common to have two screens side by side evolving their states independently. In order to implement this behavior we can use Day.

Day is a comonadic data structure which holds two Comonads and a rendering function for both states.

import arrow.core.*

val renderHtml = { left: String, right: Int -> """     
    | <p>$left</p>                                     
    | <p>$right</p>                                    
val day = Day(Id.just("Hello"), Id.just(0), renderHtml)
day.extract(Id.comonad(), Id.comonad())
// <div>                                             

Available Instances