Skip to content

Instantly share code, notes, and snippets.

@choonkeat
Last active March 31, 2023 18:08
Show Gist options
  • Save choonkeat/273ed43151ac520c1660e47fba1fd191 to your computer and use it in GitHub Desktop.
Save choonkeat/273ed43151ac520c1660e47fba1fd191 to your computer and use it in GitHub Desktop.
type TrafficLight
= Red
| Yellow
| Green
allTrafficLight : List TrafficLight
allTrafficLight =
let
helper list =
case List.head list of
Nothing ->
Red :: list |> helper
Just Red ->
Yellow :: list |> helper
Just Yellow ->
Green :: list |> helper
Just Green ->
list
in
helper []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment