Coder Social home page Coder Social logo

hm-def's People

Contributors

brusherru avatar davidchambers avatar ericlanduyt avatar evgenykochetkov avatar gipphe avatar nkrkv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

hm-def's Issues

Is a good idea to use lodash sub-packages ?

Hello,

One of the things introduced on the great PR #8 was some lodash deps. I understand that the intention was to minimize the dependencies introduced by using just two subpackages of lodash instead of the entire lodash.
However, I see this as an anti pattern for 3 main reasons:

  1. Lodash is a very spread dependency, and if any of your dependencies includes lodash you will end with the entire lodash library plus your independent packages, just the opposite you want.
  2. Independend lodash packages are pretty outdated and they do not have proper documentation
  3. Individual packages have been discontinued by lodash author (see lodash/lodash#3565 (comment))

So it may be a better idea to just use lodash.
What do you think ?

Support for Record types

It would be nice if there were a way to add RecordTypes, for example:

const User = $.RecordType({
  id: $.Number,
  first: $.String,
  last: $.String
})

const env = $.env.concat([User])

This doesn't work (as far as I can tell) because the Type name in the env is 'RECORD', so hm-def can't find a User type.

A workaround is to define a NullaryType, but to do this I have to provide my own test function (can't use the more declarative style like when creating a RecordType).

const R = require('ramda')

const User = $.NullaryType(
  'User',
  'https://github.com/blockchain/blockchain-wallet-v4-frontend#User',
  R.where({
    id: R.is(Number),
    first: R.is(String),
    last: R.is(String)
  })
)

const env = $.env.concat([User])

const def = hmDef.default.create({
  env: env,
  checkTypes: true
})

const getUserName = def(
  'getUserName :: User -> String',
  (user) => user.first + ' ' + user.last
)

Do you know if there is a better way to accomplish this?

Runtime performance hit regardless of checkTypes

The signature passed to the created def function is resolved regardless whether checkTypes is true or not, meaning there is currently a potential, unnecessary performance drain from resolving those signatures which are then subsequently discarded immediately in production environments.

import $ from 'sanctuary-def';
import {create} from 'hm-def';

const def = create ({
  checkTypes: false,
  env: $.env,
  typeClasses: [],
});

const foo = def
  // This signature will be parsed and resolved to an `Array Type`, regardless of `checkTypes` above.
  ('foo :: Boolean -> Boolean')
  (x => !x);

The resolved signature is never used by sanctuary-def's def when checkTypes is false anyways.

Update deps

Hello,
I noticed that you use several dependencies, like Ramda, and Ramda-fantasyland.

Ramda fantasyland has been recently deprecated, and since you are targeting sanctuary already, why not just using sanctuary ?

Regards

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.