Skip to content

Instantly share code, notes, and snippets.

@takoeight0821
Created May 10, 2015 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takoeight0821/c4562d190e72e97ca4af to your computer and use it in GitHub Desktop.
Save takoeight0821/c4562d190e72e97ca4af to your computer and use it in GitHub Desktop.
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