Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type (official Ramda docs). You drop new at the call site so the factory fits map, compose, and friends.
Stable since v0.1.0:R.construct is a core Ramda helper — not deprecated, experimental, or non-standard. For variadic constructors (fn.length === 0), use R.constructN instead.
Syntax
Call R.construct. Start with this line.
Ramda
R.construct(fn)
Call
What it does
R.construct(fn)
Primary signature.
R.construct(...)
Call the function helper.
Prefer import { construct } from "ramda" when you want a named import.
Library declarations
Ramda
R.construct(fn)
Parameters
Parameter
Description
fn
Required. Constructor to wrap; arity from fn.length
Return Value
Return Value
Description
*
Curried factory; instance when fully applied
Ramda Examples
Example 1 — Official AnimalConstructor
Wrap the constructor, call without new, then use a prototype method.
Construct misfires. It calls new Salad() with no args — extras never arrive → [].
ConstructN sets arity.R.constructN(3, Salad) waits for three ingredients.
Rule of thumb. Named params → construct; variadic → constructN.
Compatibility
Browser & Runtime Support
R.construct() is ordinary JavaScript once Ramda is loaded. It needs no special browser API — only a JS runtime that can run Ramda (v0.1.0+).
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.construct()
Works in every modern browser and runtime where you can load Ramda (CDN or npm). Internet Explorer needs a build that targets that environment; there is no native IE API to polyfill.
100%With Ramda loaded
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
R.construct()Universal
Bottom line: Safe in any project that includes Ramda 0.1.0 or later. Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Bun, and Deno.
Frequently Asked Questions
R.construct(fn) wraps a constructor function in a curried factory. You call the factory with the same arguments the constructor expects and get back an instance of the same type — without writing new at the call site.
Wrap Animal with R.construct, then AnimalConstructor('Pig') is an Animal with kind Pig. Mapping R.compose(R.invoker(0, 'sighting'), AnimalConstructor) over Lion, Tiger, and Bear yields It's a Lion!, It's a Tiger!, and It's a Bear!. Added in v0.1.0. See also R.invoker.
Not at the call site. R.construct uses new for you when every argument is supplied. AnimalConstructor('Pig') is the same kind of object as new Animal('Pig').
R.construct reads fn.length to decide how many arguments to wait for. That fails for variadic constructors whose length is 0. R.constructN(n, fn) lets you set the arity yourself, like the official three-layer Salad sample.
Yes. The factory waits for fn.length arguments, one call or several. A two-argument Point can be MakePoint(3)(4) or MakePoint(3, 4). The result is a real instance, not another function.
No. R.construct is a stable Ramda function helper from v0.1.0. It is not deprecated, experimental, or non-standard.