Created
September 19, 2017 05:58
-
-
Save szobov/fbc2c684f7ecc862f2d3ea03f810a365 to your computer and use it in GitHub Desktop.
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
We've found a bug for you! | |
/home/foo/dev/reason-tryies/src/index.re | |
1 │ external mediumEditor : string => 'a => 'b = "medium-editor" [@@bs.mod | |
ule][@@bs.new]; | |
2 │ external extend: 'a => 'b = "" [@@bs.module "medium-editor"][@@bs.scop | |
e "Extension"]; | |
3 │ let _ext = { | |
4 │ "name": "myext", | |
5 │ "init": (fun that => { | |
6 │ that##subscribe (); | |
7 │ Js.log "Here" | |
8 │ }), | |
9 │ "foo": (fun () => Js.log "Hello!") | |
10 │ }; | |
11 │ | |
12 │ let extension = extend _ext; | |
This expression's type contains type variables that can't be generalized: | |
Js.t | |
{. foo : unit => unit, | |
init : Js.t {_.. subscribe : Js.Internal.meth [ `Arity_0 ] '_a } => unit, | |
name : string } | |
This happens when the type system senses there's a mutation/side-effect, in combination with a polymorphic value. | |
Using or annotating that value usually solves it. More info: | |
https://realworldocaml.org/v1/en/html/imperative-programming-1.html#side-effects-and-weak-polymorphism |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment