Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Haskell on S expr
(defclass (Eq a)
(as = (Func a a Bool))
(as /= (Func a a Bool))
(defmethod (= x y) (not (/= x y))
(defmethod (/= x y) (not (= x y)))))
(defdata TrafficLight ((Red) (Yellow) (Green)))
(definstance (Eq TrafficLight)
(defmethod (= Red Red) True)
(defmethod (= Yellow Yellow) True)
(defmethod (= Green Green) True))
(definstance (Show TrafficLight)
(defmethod (show Red) "Red Light")
(defmethod (show Yellow) "Yellow Light")
(defmethod (show Green) "Green Light"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.