lpw25 / ocaml Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ocamllabs/ocaml
My experiments with and extensions to OCaml
This project forked from ocamllabs/ocaml
My experiments with and extensions to OCaml
In the following program the type of st
escapes its scope
effect state = Get : 's
let my_comp () = perform Get + 1
let state m =
match m () with
| v -> fun _ -> v
| effect Get, k -> fun st -> continue k st st
The computation my_comp
instantiates Get : 's
to Get : int
locally. Loading the above in OCaml repl with rlwrap, we can now crash the OCaml runtime:
- : int = 42
# state my_comp 'e';;
- : int = 102
# state my_comp "Hello World";;
rlwrap: warning: ocaml crashed, killed by SIGSEGV (core dumped).
rlwrap itself has not crashed, but for transparency,
it will now kill itself with the same signal
Trying to build merlin on ecaml-multicore I get a syntax error because in a pattern
| [x]-> ...
the lexer sees ]-> as a single token instead of two.
Baking the ocamldoc syntax into the compiler seems like unnecessary coupling. Perhaps a default-on ppx could be used to effect compile-time doc syntax checking?
The following program ascribes a type which is parameterised by an effect row and a type to a recursive computation:
type (!e, 'a) comp = unit -[ io | !e ]-> 'a
effect foo = Foo : unit
let rec do_foo : (![foo], 'a) comp
= fun () ->
perform Foo;
do_foo ()
This program is rejected with the following error message:
Error: This expression performs effect ![io | 'a]
but an expression was expected that performed ![foo | io]
The second type is an effect type
Note that in the error message the type variable 'a
appears in a row variable position in the effect row: ![io | 'a]
.
The inferred type of do_foo
is unit -[foo]-> 'a
. The type I am trying to ascribe is more conservative since it contains io
, however, if we expand the type alias comp
then it type checks, i.e.
let rec do_foo' : unit -[ io | foo ]-> 'a
= fun () ->
perform Foo;
do_foo' ()
Finally, the problem appears to be specific to recursive computations as the following non-recursive computation type checks:
let do_foo'' : (![foo], unit) comp
= fun () -> perform Foo
Remark: @lpw25 suggests the cause of the bug may be found in the handling of recursive functions.
The following actions will be performed:
- install merlin.2.0.0
=== + 1 ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ๐ซ
[merlin.2.0.0] Fetching git://github.com/the-lambda-church/merlin.git#merlin2
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ๐ซ
Building merlin.2.0.0:
./configure --prefix /Users/thomas/.opam/doc
rm -rf /Users/thomas/.opam/doc/share/ocamlmerlin
make -j 1
[ERROR] The compilation of merlin.2.0.0 failed.
Removing merlin.2.0.0.
Nothing to do.
#=== ERROR while installing merlin.2.0.0 ======================================#
# opam-version 1.2.0~beta4 (80a4cd97befa222647106f1475dee4ee61f72906)
# os darwin
# command make -j 1
# path /Users/thomas/.opam/doc/build/merlin.2.0.0
# compiler 4.02.0+doc
# exit-code 2
# env-file /Users/thomas/.opam/doc/build/merlin.2.0.0/merlin-24585-05296d.env
# stdout-file /Users/thomas/.opam/doc/build/merlin.2.0.0/merlin-24585-05296d.out
# stderr-file /Users/thomas/.opam/doc/build/merlin.2.0.0/merlin-24585-05296d.err
### stdout ###
# ...[truncated]
# Will install:
# ocamlmerlin binary in: /Users/thomas/.opam/doc/bin
# vim mode in: /Users/thomas/.opam/doc/share/ocamlmerlin/vim
#
# To customize directories, use:
# ./configure [--prefix <dir>] [--bindir <dir>] [--sharedir <dir>] [--vimdir <vimdir>] [--with-vimbufsync | --without-vimbufsync]
#
# For more informations rerun with --help.
# Now, type 'make' to compile then 'make install'.
# /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile.ocamlmakefile WITH_BIN_ANNOT="" WITH_DEBUG="" REALLY_QUIET=1 ocamlmerlin
### stderr ###
# ...[truncated]
#1 warning generated.
# File "src/kernel/preprocess/raw_lexer.mll", line 199, characters 15-27:
# Warning 3: deprecated: Std.String.set
# File "src/ocaml/typing/typecore.ml", line 3031, characters 24-41:
# Error: This function has type
# string -> ('a, 'b, 'c, 'd) CamlinternalFormat.fmt_ebb
# It is applied to too many arguments; maybe you forgot a `;'.
# make[2]: *** [src/ocaml/typing/typecore.cmx] Error 2
# make[1]: *** [native-code] Error 2
# make: *** [ocamlmerlin] Error 2
On opam-doc-base
, I get
File "_build/lib-opam-doc-base/opamDocXml.ml", line 1262, characters 753-755:
Warning 50: Documentation syntax error: unterminated comment
but opamDocXml.ml
is only 1250 lines long (and opamDocXml.mli
is much shorter at 35 lines).
Also, I don't think there are actually any unterminated comments in this file...
I can't seem to build the bin-doc branch any longer. I get:
# ../../boot/ocamlrun ../../ocamlc -nostdlib -I ../../stdlib -w +33..39 -warn-error A -bin-annot -safe-string -I ../../stdlib -I ../../utils -I ../../typing -I ../../bytecomp -I ../../asmcomp -pack -o dynlinkaux.cmo ../../utils/misc.cmo ../../utils/config.cmo ../../utils/clflags.cmo ../../utils/tbl.cmo ../../utils/consistbl.cmo ../../utils/terminfo.cmo ../../utils/warnings.cmo ../../parsing/asttypes.cmi ../../parsing/location.cmo ../../parsing/longident.cmo ../../parsing/ast_helper.cmo ../../parsing/ast_mapper.cmo ../../typing/ident.cmo ../../typing/path.cmo ../../typing/primitive.cmo ../../typing/types.cmo ../../typing/btype.cmo ../../typing/subst.cmo ../../typing/predef.cmo ../../typing/datarepr.cmo ../../typing/cmi_format.cmo ../../typing/env.cmo ../../bytecomp/lambda.cmo ../../bytecomp/instruct.cmo ../../bytecomp/cmo_format.cmi ../../bytecomp/opcodes.cmo ../../bytecomp/runtimedef.cmo ../../bytecomp/bytesections.cmo ../../bytecomp/dll.cmo ../../bytecomp/meta.cmo ../../bytecomp/symtable.cmo
# Makefile:62: recipe for target 'dynlinkaux.cmo' failed
# make[3]: Leaving directory '/home/dsheets/.opam/4.02.0+doc/build/ocaml/otherlibs/dynlink'
# Makefile:780: recipe for target 'otherlibraries' failed
# make[2]: Leaving directory '/home/dsheets/.opam/4.02.0+doc/build/ocaml'
# Makefile:131: recipe for target 'all' failed
# make[1]: Leaving directory '/home/dsheets/.opam/4.02.0+doc/build/ocaml'
# Makefile:139: recipe for target 'world' failed
### stderr ###
# File "_none_", line 1:
# Error: The files ../../stdlib/pervasives.cmi and ../../utils/misc.cmi
# make inconsistent assumptions over interface Pervasives
# make[3]: *** [dynlinkaux.cmo] Error 2
# make[2]: *** [otherlibraries] Error 2
# make[1]: *** [all] Error 2
# make: *** [world] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.