Last active
August 29, 2015 14:08
-
-
Save nomaddo/e7682796abe03f9021e1 to your computer and use it in GitHub Desktop.
unit1
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 | |
but an expression was expected of type float |
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 | |
# if true then 1 else 2;; | |
- : int = 1 |
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) | |
# () (():unit);; | |
- : unit t = () () | |
# module M () = struct end;; | |
module M : functor () -> sig end |
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.() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment