possible new implementation?
safareli opened this issue · 14 comments
I have implemented something like daggy here
how is it different?:
- Instead of constructor Functions it uses
Object.create
- when sum type is created it returns type representative and you can call it as it's just an object
- values used to create object is stored as array and there is no need to allocate new array in cata
- type definition is stored in type representative and it allows to have only one
cata
andtoString
s
I believe it has a bit better performance too. would like to hear what others think.
np :P
I'm fine with this, it would be good if we can move sanctuary-type-classes
to fantasy-sorcery
, otherwise this seems like it's a good start.
@puffnfresh you mind if we do a radical thing like this, I'm more than happy for it to move forward!
Don't mind.
Irrelevant; but can it be typed with TypeScript?
I'm fine with this, it would be good if we can move sanctuary-type-classes to fantasy-sorcery, otherwise this seems like it's a good start.
/cc @davidchambers
Irrelevant; but can it be typed with TypeScript?
If you are asking about:
- sanctuary-type-classes, i think it's somehow possible.
- about this implementations, I think no.
What would be the best way to move forward on this?
- create PR here (it will be a breaking change)
- create new repo in FL and create PR there (then create a note here about new implementation)
- move
daggy
to FL and do1.
btw there is also a related work sanctuary-union-type and @JAForbes/sum-type which started as using sanctiary-def
for type ckecking on @paldepind/union-type
Question how does a typed union work with types i.e. M A -> M B
do you have to define new union types when this happens? I have no idea, some link to code would be amazing :) Really interested!
@SimonRichardson I think I didn't understand your question, if you want some example of union
here is Par, Seq, Concurrent from some from my free.
I was on about type checking versions and how it knows what to type check when you've provided a chain
for example.
ah, I think @davidchambers is the one who can answer that question :P
@safareli I vote we go for it, we can clean up as we go a long, nothings perfect, we just need forward momentum!
What would be the best way to move forward on this?
- create PR here (it will be a breaking change)
- create new repo in FL and create PR there (then create a note here about new implementation)
- move
daggy
to FL and do1.
ok will open PR here then, we can move it later too.