Created
September 11, 2016 14:06
-
-
Save kkismd/69618374aa1daebb0a28385c31b5d63f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(* point と colord_point の共通項を型として定義する *) | |
type pointable = <get_pos : int> | |
(* 明示的にキャストすれば同じリストにいれられる *) | |
let lst = [(p :> ptwointable); (cp :> pointable)] | |
# List.map (fun x -> x#get_pos) lst;; | |
- : int list = [365; 123] | |
(* リストに型制約をつけて宣言する *) | |
# let l : pointable list = [p; cp];; | |
Error: This expression has type point but an expression was expected of type | |
pointable | |
The second object type has no method is_equal_to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment