Questions tagged [bucklescript]

BuckleScript was previously known as a compiler for compiling OCaml to efficient JavaScript code. It has now evolved into the ReScript language. Use the [rescript] tag instead.

BuckleScript was previously known as a back-end for which emits readable, modular and highly performant JavaScript.

On July 2020, BuckleScript (and some parts of the ReasonML syntax) evolved into the ReScript language platform. The term "BuckleScript" is therefore deprecated. Use the tag for BuckleScript specific questions instead.

Useful resources

Related tags

181 questions
0
votes
1 answer

How to declare functional parameters in OCaml/ReasonML?

There are two functions; funA and funB, respectively. a.i, a.o, ah, w, c are arrays in the function funA. The function funA shall be passed as a functional parameter to the function funB and the arrays should be able to be accessed by the function…
madeinQuant
  • 1,721
  • 1
  • 18
  • 29
0
votes
1 answer

How to correctly setup a local ReasonMl / Bucklescript dependencies

New to ReasonML, and I probably don't understand the bucklescript documentation for setting up a module as a dependency. ReasonML project, compiles correctly, with the file MyUtils.re in directory ~/ml/myutils/src. second ReasonML project in…
gash
  • 65
  • 7
0
votes
1 answer

String unicode with functions

I am trying to archive that a function is returning a unicode string and I want to log it into the console. But it just either displays the information about the function or just not a unicode string. let test = () =>…
0
votes
1 answer

JavaScript constructor behaviour in ReasonML using BuckleScript

I want to generate javascript function called Publisher from ReasonML so that i can use it in other files as for example: const publisher = new Publisher("Prasad", "email@email.com", "team@email.com", "rill") const req = Publisher.toAPI(publisher)…
REDDY PRASAD
  • 1,309
  • 2
  • 14
  • 29
0
votes
1 answer

How to use a reason module from local package

I’m looking for a way to use a local package (named bs-package) from my Reason React app (named ApplicationA). bs-package has a single file within src folder called ModuleA.re : let greet_me = (me) => Js.log("Hello, " ++ me ++ "!"); In ApplicationA…
Yvain
  • 882
  • 1
  • 10
  • 27
0
votes
0 answers

Whats the difference between `type a = { someType:someType }` and `type a = A(someType)`

Like for simple team and game types type team = | Team(string); type game1 = | Game(team, team); type game2 = { team1: team, team2: team, }; What is the difference between game1 and game2? In real world when to declare type game like…
amitdigga
  • 6,550
  • 4
  • 26
  • 31
0
votes
1 answer

Define a closure variable in buckle script

I'm trying to convert the following ES6 script to bucklescript and I cannot for the life of me figure out how to create a "closure" in bucklescript import {Socket, Presence} from "phoenix" let socket = new Socket("/socket", { params:…
Sampson Crowley
  • 1,244
  • 1
  • 9
  • 22
0
votes
1 answer

What are the Implications of Different ReasonML External Declarations?

In the examples below, both external declarations achieve the same functionality with slightly different ReasonML function structures. Does external declaration style impact anything (e.g. performance) beyond ReasonML function structure? Also, does…
Ari
  • 4,121
  • 8
  • 40
  • 56
0
votes
1 answer

Using ReasonML FFI

I'm trying to understand ReasonML's FFI (i.e. external) usage. To that end, I put together the following code (see Try ReasonML and Sketch.sh) type dom; type element; [@bs.val] external dom: dom = "document"; [@bs.send.pipe : dom] external…
Ari
  • 4,121
  • 8
  • 40
  • 56
0
votes
1 answer

Where is L defined in LeafletJs?

I'm looking inside LeafletJs source code and I cannot find where L is defined nor exported. L is referred many times and main functions are called against it. So where is L defined ? What is its nature (object, prototype) ? A little bit of context :…
Yvain
  • 882
  • 1
  • 10
  • 27
0
votes
1 answer

How does fillStyle work in bs-webapi Canvas2d

I'm wondering how to create a and set a fill style using bs-webapi and Canvas2d interface in ReasonML. I think the definition I might need is this: let fillStyle = (ctx: t) => ctx |> fillStyle |> reifyStyle; But I'm having trouble understanding…
Peter Lamberg
  • 8,151
  • 3
  • 55
  • 69
0
votes
1 answer

How to ignore sources in bsconfig.json file (reasonml)?

I want to use the "subdirs": true option in sources of my bsconfig.json file, but ignore a specific folder. (rather than doing the opposite and adding each subfolder to sources besides the one I want to ignore) Extra info (if you wondering why I am…
JasoonS
  • 1,432
  • 3
  • 13
  • 26
0
votes
1 answer

How to handle the result of a list of future with ReasonML?

I am trying to go over a list of items, cache the URL and then update the URL in the list before drawing it. However I don't seems to be able to do so. Any idea? external cache: option(string) => Js.Promise.t({. "uri": string, "filePath": string })…
Natim
  • 17,274
  • 23
  • 92
  • 150
0
votes
0 answers

Can't create reasonML project on Windows

I just started learning reasonML and I want to create my first project. I installed bs-platform globally with npm install -g bs-platform. I want to create the first project with the command bsb -init my-new-project -theme basic-reason but…
bonheury
  • 362
  • 1
  • 5
  • 14
0
votes
1 answer

Trouble installing BuckleScript on Windows

I am trying to install BuckleScript on Windows. I use the following command: npm install -g bs-platform and I get this error: [31mninja: fatal: [0mCreateProcess: Wersja %1 nie jest zgodna z wersją uruchomionego systemu Windows. Sprawdź informacje…
user2656304
  • 157
  • 8