Comments (2)
Hello, @lsby, and welcome to the Sanctuary community.
I noticed that in "sanctuary-def", I can use the function "def" returned by "$ .create" to define a new function.
That's the way to do it. :)
So how do I define my own functions in a "sanctuary"?
Sanctuary itself does not provide this functionality; you need to depend on sanctuary-def. If you are using Sanctuary in your project, depending on sanctuary-def directly will not affect your bundle size as it is already a transitive dependency.
Here is a minimal example:
const $ = require ('sanctuary-def');
const def = $.create ({checkTypes: true, env: $.env});
// greet :: String -> String
const greet =
def ('greet')
({})
([$.String, $.String])
(name => `Hello, ${name}!`);
from sanctuary.
@davidchambers , I get it now, thanks!
from sanctuary.
Related Issues (20)
- @types/sancturay type error HOT 6
- Using ADT created by typescript with sanctuary? HOT 3
- Possible example bug HOT 3
- State and Reader ADTs
- ES5 => ES6 HOT 1
- Bundled version contains refetences to undefined self HOT 4
- Add "picks" to include certain key/value pairs from an object HOT 3
- Deno version HOT 2
- Add a function to split an Array into equally sized chunks
- Idea: Only treat objects without prototypes as StrMaps HOT 6
- Be more explicit about S.get(s) being an escape hatch from type safety HOT 1
- Question about S.concat HOT 4
- Support logging S.Nothing in deno
- feat: Make types accessible by name in `S` HOT 1
- Remove the need for require ('util') in browser environment HOT 4
- Check for empty structures? HOT 1
- Searchbar on website https://sanctuary.js.org/ HOT 1
- Implement Types for all new EcmaScript objects.
- match has changed from version 3.1.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanctuary.