# Exercise: Variant Basics
#
# Unions define types with multiple alternatives (also called ADTs).
#
# Define a union:
#   union Color { Red Green Blue }
#
# The compiler auto-generates constructor words:
#   Make-Red     # ( -- Color ) Creates a Red Color
#   Make-Green   # ( -- Color ) Creates a Green Color
#
# Use `match` to check which variant you have:
#   my-color match
#     Red -> "It's red"
#     Green -> "It's green"
#     Blue -> "It's blue"
#   end
#
# NOTE: Seq 4.0 auto-generates predicates like `is-Stop?` for each variant.
# We'll implement our own `is-stop?` here to learn how `match` works -
# the auto-generated ones work the same way under the hood!
#
# Your task: Create variants and identify them with match
# When done, delete the marker line below.

union TrafficLight { Stop Go Caution }

# I AM NOT DONE

: is-stop? ( TrafficLight -- Bool )
    # Return true if this is Stop, false otherwise
    # Your code here - use match
    drop false
;

: is-go? ( TrafficLight -- Bool )
    # Return true if this is Go, false otherwise
    # Your code here - use match
    drop false
;

: test-create-stop ( -- )
    Make-Stop is-stop?
    # Do not edit below this line
    test.assert
;

: test-create-go ( -- )
    Make-Go is-go?
    # Do not edit below this line
    test.assert
;

: test-stop-not-go ( -- )
    Make-Stop is-go?
    # Do not edit below this line
    not test.assert
;
