Created
September 28, 2014 14:38
-
-
Save pasberth/c9f95d8a179070060aab to your computer and use it in GitHub Desktop.
SML# のオーバーロード
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
_require "basis.smi" | |
structure B = | |
struct | |
val g : int -> int | |
val h : string -> string | |
end | |
val f = case 'a in 'a -> 'a of | |
int => B.g | |
| string => B.h |
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
structure B = | |
struct | |
val g = fn x => x + 1 | |
val h = fn x => x | |
end |
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
_require "basis.smi" | |
_require "./b.smi" |
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
val () = print (f "a") (* a *) | |
val () = print (Int.toString (f 1)) (* 2 *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment