Git Product home page Git Product logo

sanctuary-type-identifiers's People

Contributors

avaq avatar davidchambers avatar svozza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanctuary-type-identifiers's Issues

type(MyCustomError) === 'Object' ?

I get an error while using js-yaml lib with sanctury's encaseEither function:

const { safeLoad } = require('js-yaml');
const parseYaml = encaseEither(I, safeLoad);
parseYaml('Some invalid yaml');

Here what i get:

TypeError: Invalid value

encaseEither :: (Error -> l) -> (a -> r) -> a -> Either l r
                 ^^^^^
                   1

1)  YAMLException: end of the stream or a document separator is expected at line 2, column 8:
      redis:
           ^ :: Object, StrMap ???

The value at position 1 is not a member of ‘Error’.

YAMLException defined as MDN recommends in its examples: https://github.com/nodeca/js-yaml/blob/master/lib/js-yaml/exception.js and MDN examples https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types

type determines YAMLException as Object, and thats looks wierd

My runtime is node 8.1.3

publish to Bower registry

$ bower register sanctuary-type-identifiers git://github.com/sanctuary-js/sanctuary-type-identifiers.git

How to deal with versioning

When using Sanctuary-Type-Identifiers to determine whether something is member of a specific desired type, we get a nice advantage: Even if the value was created in a different context (like in another VM or another package), it will still be identifiable as being our type.

However! When the type was created by an outdated package, we currently have no way to tell that this is actually not the desired type, when using the recommended format for @@type (<vendor>/<type>).

I've therefore been thinking to add a version number to my @@type values (eg <vendor>/<type>@<major>). This would allow my type-checks to detect "older" versions of my type, which may no longer satisfy the interface I expect them to have. And it works both ways: An older version of my lib will not try to consume a newer version of its own type.

Is this something you would stand behind @davidchambers? Or does this somehow go against the purpose of @@type?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.