2018-10-10 08:16:00 -07:00
|
|
|
;**************************************************************************
|
|
|
|
;* *
|
|
|
|
;* OCaml *
|
|
|
|
;* *
|
|
|
|
;* Thomas Refis, Jane Street Europe *
|
|
|
|
;* *
|
|
|
|
;* Copyright 2018 Jane Street Group LLC *
|
|
|
|
;* *
|
|
|
|
;* All rights reserved. This file is distributed under the terms of *
|
|
|
|
;* the GNU Lesser General Public License version 2.1, with the *
|
|
|
|
;* special exception on linking described in the file LICENSE. *
|
|
|
|
;* *
|
|
|
|
;**************************************************************************
|
|
|
|
|
|
|
|
(library
|
|
|
|
(name ocamltoplevel)
|
|
|
|
(wrapped false)
|
|
|
|
(flags (:standard -principal -nostdlib))
|
|
|
|
(libraries stdlib ocamlcommon ocamlbytecomp)
|
|
|
|
(modules genprintval toploop trace topdirs topmain))
|
|
|
|
|
|
|
|
(executable
|
|
|
|
(name topstart)
|
|
|
|
(modes byte)
|
|
|
|
(flags (:standard -principal -nostdlib))
|
|
|
|
(libraries ocamlbytecomp ocamlcommon ocamltoplevel runtime stdlib)
|
|
|
|
(modules topstart))
|
|
|
|
|
|
|
|
(executable
|
|
|
|
(name expunge)
|
|
|
|
(modes byte)
|
|
|
|
(flags (:standard -principal -nostdlib))
|
|
|
|
(libraries ocamlbytecomp ocamlcommon runtime stdlib)
|
|
|
|
(modules expunge))
|
|
|
|
|
|
|
|
(rule
|
|
|
|
(targets ocaml.byte)
|
|
|
|
(action (run %{ocaml_where}/expunge %{dep:topstart.exe} %{targets}
|
|
|
|
; FIXME: inlined $(STDLIB_MODULES) ... minus Labels ones ...
|
|
|
|
stdlib__Arg
|
|
|
|
stdlib__Array
|
|
|
|
; stdlib__ArrayLabels
|
|
|
|
stdlib__Bigarray
|
|
|
|
stdlib__Buffer
|
|
|
|
stdlib__Bytes
|
|
|
|
; stdlib__BytesLabels
|
|
|
|
stdlib__Callback
|
|
|
|
camlinternalFormat
|
|
|
|
camlinternalFormatBasics
|
|
|
|
camlinternalLazy
|
|
|
|
camlinternalMod
|
|
|
|
camlinternalOO
|
|
|
|
stdlib__Char
|
|
|
|
stdlib__Complex
|
|
|
|
stdlib__Digest
|
Add `'a Either.t = Left of 'a | Right of 'b`
```ocaml
val left : 'a -> ('a, 'b) t
val right : 'b -> ('a, 'b) t
val is_left : ('a, 'b) t -> bool
val is_right : ('a, 'b) t -> bool
val find_left : ('a, 'b) t -> 'a option
val find_right : ('a, 'b) t -> 'b option
val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t
val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t
val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t
val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c
val equal :
left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) ->
('a, 'b) t -> ('a, 'b) t -> bool
val compare :
left:('a -> 'a -> int) -> right:('b -> 'b -> int) ->
('a, 'b) t -> ('a, 'b) t -> int
```
Unlike [result], no [either] type is made available in Stdlib,
one needs to access [Either.t] explicitly:
- This type is less common in typical OCaml codebases,
which prefer domain-specific variant types whose constructors
carry more meaning.
- Adding this to Stdlib would raise warnings in existing codebases
that already use a constructor named Left or Right:
+ when opening a module that exports such a name,
warning 45 is raised
+ adding a second constructor of the same name in scope kicks
in the disambiguation mechanisms, and warning 41 may now
be raised by existing code.
If the use becomes more common in the future we can always
revisit this choice.
2019-10-20 02:00:22 -07:00
|
|
|
stdlib__Either
|
2018-10-10 08:16:00 -07:00
|
|
|
stdlib__Ephemeron
|
|
|
|
stdlib__Filename
|
|
|
|
stdlib__Float
|
|
|
|
stdlib__Format
|
|
|
|
stdlib__Gc
|
|
|
|
stdlib__Genlex
|
|
|
|
stdlib__Hashtbl
|
|
|
|
stdlib__Int32
|
|
|
|
stdlib__Int64
|
|
|
|
stdlib__Lazy
|
|
|
|
stdlib__Lexing
|
|
|
|
stdlib__List
|
|
|
|
; stdlib__ListLabels
|
|
|
|
stdlib__Map
|
|
|
|
stdlib__Marshal
|
|
|
|
; stdlib__MoreLabels
|
|
|
|
stdlib__Nativeint
|
|
|
|
stdlib__Obj
|
|
|
|
stdlib__Oo
|
|
|
|
stdlib__Option
|
|
|
|
stdlib__Parsing
|
|
|
|
stdlib__Pervasives
|
|
|
|
stdlib__Printexc
|
|
|
|
stdlib__Printf
|
|
|
|
stdlib__Queue
|
|
|
|
stdlib__Random
|
|
|
|
stdlib__Result
|
|
|
|
stdlib__Scanf
|
|
|
|
stdlib__Seq
|
|
|
|
stdlib__Set
|
|
|
|
stdlib__Stack
|
|
|
|
; stdlib__StdLabels
|
|
|
|
stdlib
|
|
|
|
stdlib__Stream
|
|
|
|
stdlib__String
|
|
|
|
; stdlib__StringLabels
|
|
|
|
stdlib__Sys
|
|
|
|
stdlib__Uchar
|
|
|
|
stdlib__Weak
|
|
|
|
; the rest
|
|
|
|
outcometree topdirs toploop
|
|
|
|
)))
|