Named Record Types
See original GitHub issueI work with a lot of objects, it’d be helpful to tag them with a name. It’d make for more terse signatures.
I still think we should show the complete interface if a type error occurs though. But when rendering the signature, it’d be preferable to just use the name, I’m finding type errors nearly always wrap the terminal/repl because I’m working with large records.
Then the ^^^^
don’t line up with the particular argument, so its not immediately obvious what is causing it to fail.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
DNS Record Types Cheat Sheet - Constellix
DNS Record Types · A Record (address) · AAAA Record (quad A) · CNAME Record (Canonical Name) · ANAME Record · SOA Record...
Read more >List of DNS record types - Wikipedia
This list of DNS record types is an overview of resource records (RRs) permissible in zone ... OpenPGP public key record, A DNS-based...
Read more >DNS Record Types: Defined and Explained - Site24x7
DNS record types · 1. A record · 2. AAAA record · 3. CNAME record · 4. NS record · 5. MX record....
Read more >Know the eight most common DNS records - BlueCat Networks
A and AAAA DNS records. Firstly, address (A) records are the most common record type by far. In brief, A records map domain...
Read more >DNS Record Types Explained {Complete List} | phoenixNAP KB
A (address) records are one of the most basic and commonly used DNS record types. They translate domain names and store them as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good idea.
An idea that just occurred to me is to have the representation span multiply lines:
As opposed to:
We could use the name of the record type in the signature, then expand the type in the description below and underline the invalid portion.
Some new thoughts:
I’m using this to validate API responses and there are a lot of fields, sometimes its hard to see what is wrong with a value when there are 50 keys with various levels of nesting.
It’s not that useful to render the complete type for large objects (say keys > 5, or levels of nesting greater than 2). It’d be a lot more useful to me to list the paths and types that were invalid, with the expected type and the actual value. Particularly when there are multiple validation issues.
It could also be handy to show the values in context, with the valid values filtered out.
It’d be great too if validate, or something similar could provide this metadata as an object of the form:
{ preview :: String, failures:: List { value:: Any, path: List String, type: Type } }
That way libraries like sum-type (and hopefully others) could build domain specific error messages without recreating a lot of what sanctuary-def already does very well.