paldepind / union-type

A small JavaScript library for defining and using union types.
MIT License
477 stars 28 forks source link

Remove dependency on ramda #37

Open jethrolarson opened 8 years ago

jethrolarson commented 8 years ago

I know you're cherry picking the curry function but ramda is a bit big for just the one function.

paldepind commented 8 years ago

Yes. You are right. But it is a fine curry function :sweat:

jethrolarson commented 8 years ago

Please

On Fri, Apr 15, 2016, 12:15 PM Texas Toland notifications@github.com wrote:

Haha I'd be willing to rewrite it if you want.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/paldepind/union-type/issues/37#issuecomment-210603699

paldepind commented 8 years ago

Ok :smile: We could copy and paste the curry function into union-type.

texastoland commented 8 years ago

I took a look and it'd be better to implement the subset of functionality you're using.

wavebeem commented 8 years ago

I would highly approve of this. Also, it would be really nice to provide the Ramda.T function on this lib. It could be called Type.Any, which would read really well imo.

var List = Type({
  Nil: {},
  Cons: {
    head: Type.Any,
    tail: undefined
  }
});

Maybe even a Type.Self alias which is just undefined for recursive types.