Comments (6)
This definitely need a StrMap ({...props})
constructor. It is already cumbersome to work with other libraries and being even stricter will not make it less cumbersome. However, if this makes the code base leaner and improve error messages, I am all for it.
But please make it simple to convert a foreign object to a StrMap
.
from sanctuary.
I like this idea!
How would we describe the type of the data constructor?
StrMap :: ??? -> StrMap a
Would S.StrMap ({x: 'abc', y: 123})
throw an exception when evaluated?
from sanctuary.
I vote for a way to convert all properties to String but S.Left
in the normal case. My thinking is that this might be wrong input that I need to handle but when I have made certain it is not, let me get a StrMap String
.
You often get a foreign object such as:
{
fill: '#f06'
, 'fill-opacity': 0.5
, stroke: '#000'
, 'stroke-width': 10
}
from sanctuary.
@dotnetCarpenter, are you suggesting that the data constructor's return type should be Either String (StrMap a)
or Either Error (StrMap a)
rather than StrMap a
?
from sanctuary.
Would
S.StrMap ({x: 'abc', y: 123})
throw an exception when evaluated?
It might be fine just to have it return a mixed-type StrMap. It's possible to work with mixed-type StrMaps outside of Sanctuary, or using S.unchecked
.
from sanctuary.
It's just like the Array constructor; We allow users to do ['abc', 123]
, but then it's checked for consistency when this value is passed into a Sanctuary function.
from sanctuary.
Related Issues (20)
- Possible example bug HOT 3
- How to create a function in 'sanctuary'? HOT 2
- 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
- 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
- Refactor documentation to be more independent and catchy
- ECMAScript modules 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.