data Color = Red | Yellow | Green -- | Light state -- Format: CurrentNext data LState = RY | YG | G | YR controller :: LState -> () -> (LState, Color) controller RY _ = (YG, Yellow) controller YG _ = (G, Green) controller G _ = (YR, Yellow) controller YR _ = (RY, Red)