Created
May 10, 2015 08:35
-
-
Save takoeight0821/c4562d190e72e97ca4af to your computer and use it in GitHub Desktop.
Haskell on S expr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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