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
(* これは通らない *) | |
let f x = | |
let (g:'a) = fun y -> y | |
g 1; g "str" | |
(* これは通る *) | |
let f x = | |
let g = fun y -> y | |
g 1; g "str" |
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
fun f x = let ... x :: nil ... | |
... Array.update(a, i, x) ... | |
in (x, x) end | |
fun g y = f (y, 3.14) | |
(* f : 'a -> 'a * 'a *) | |
(* g : 'b -> (b * real) * ('b * real) *) |
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
# type t = :: of int * float;; | |
type t = :: of int * float | |
# 1 :: 1.1;; | |
- : t = :: (1, 1.1) | |
# 1 :: [];; | |
Characters 5-7: | |
1 :: [];; | |
^^ | |
Error: This expression has type 'a list |
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
# type t = () of unit;; | |
type t = () of unit | |
# () ();; | |
- : t = () () |
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
# type 'a t = () of 'a;; | |
type 'a t = () of 'a | |
# () 12;; | |
- : int t = () 12 | |
# () ();; | |
Characters 3-5: | |
() ();; | |
^^ | |
Error: The constructor () expects 1 argument(s), | |
but is applied here to 0 argument(s) |
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
# module M = struct type t = () end;;;;; | |
module M : sig type t = () end | |
# M.();; | |
Characters 3-4: | |
M.();; | |
^ | |
Error: Syntax error: operator expected. | |
# M.(());; | |
- : M.t = M.() |
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
# type t = :: of int * float;; | |
type t = :: of int * float | |
# 1 :: 1.1;; | |
- : t = :: (1, 1.1) | |
# 1 :: [];; | |
Characters 5-7: | |
1 :: [];; | |
^^ | |
Error: This expression has type 'a list |
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
# type 'a t = :: of 'a t * 'a t | Leaf of 'a;; | |
type 'a t = :: of 'a t * 'a t | Leaf of 'a | |
# Leaf 1 :: Leaf 2 :: Leaf 3;; | |
- : int t = :: (Leaf 1, :: (Leaf 2, Leaf 3)) |
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
# List.(map succ [1;2;3]);; | |
- : int list = [2; 3; 4] | |
# List.(M.(()));; | |
- : M.t = M.() |
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
# type t = true of bool;; | |
type t = true of bool | |
# true true;; | |
- : t = true true | |
# type 'a t = true of 'a | |
;; | |
type 'a t = true of 'a | |
# true true;; | |
Characters 5-9: | |
true true;; |
OlderNewer