Closed safareli closed 6 years ago
This seems a bit questionable, as it should already be known from the types whether a path is Abs
or Rel
, should it not?
@garyb Not really e.g. forall s. Path s a b
. We can do following
class AbsOrRel s where
absOrRel :: forall a b s. Path s a b -> Either (Path Rel a b) (Path Abs a b)
Do you think it would be better?
I'm just not sure how we'd end up with a path value that already isn't Rel
or Abs
in the types? It makes sense that there can be functions that operate on Path
with polymorphic Abs
/Rel
, I just don't know how we'd actually have one that has it unspecified.
@garyb good point I went all they up and at some point the information was lost i.e. forall x was used instead of the Path.Rel
so the use case I had for it is not relevant any more.
But I the I like the idea of having one function which returns either vs two which return maybe. As Path is Either Rel or Abs and the function proposed describes that statement in more clear form then maybes.
But I the I like the idea of having one function which returns either vs two which return maybe
I agree with that, but I don't think we need maybeRel
/ maybeAbs
either :smile: (aside from an internal implementation thing perhaps).
will be fixed as part of #33
also express maybeRel maybeAbs using eitherRelAbs