Closed goodmind closed 6 years ago
We can have sort
without the -1
/0
/1
ugliness required by Array#sort
. ;)
@davidchambers but you can derive compare
from lte
What's the advantage of compare
over lte
?
I think most of the discussion about this happened at https://github.com/fantasyland/fantasy-land/pull/235 . And seems like the summary as David pointed out is that boolean
is better as return type than number
.
Also, we try to avoid breaking changes as much as possible, so this change is unlikely to happen, and I'm going to close this issue for now.
Sanctuary also doesn't seem to support static-land
Sanctuary also doesn't seem to support static-land
I'm not intimately familiar with Static Land, so please correct me if I am wrong, but my understanding is that the Sanctuary module is a polymorphic Static Land module.
We can create values of type Maybe a
or Either a b
by using the of
function of the S
module:
> S.of (S.Maybe) (64)
Just (64)
> S.of (S.Either) (64)
Right (64)
We can interact with these values by using the map
function of the S
module:
> S.map (Math.sqrt) (S.of (S.Maybe) (64))
Just (8)
> S.map (Math.sqrt) (S.of (S.Either) (64))
Right (8)
If this does not count as Static Land support, I'd love to know what more Sanctuary could provide.
@davidchambers if I have static land Ord
module, how do I use sanctuary sort?
Good question, @goodmind! I see the problem now. @rpominov, perhaps you could help with this. How would one change sort :: (Ord a, Applicative m, Foldable m, Monoid (m a)) => m a -> m a
to work with Static Land? Must it take TypeRep m
and TypeRep a
as additional arguments?
-S.sort (['foo', 'bar', 'baz'])
+S.sort (Array) (String) (['foo', 'bar', 'baz'])
Right, since #45 isn't resolved yet, the only way to implement sort
is to pass modules/TypeReps for both types explicitly.
Thanks, Roman. #45 will be terrific, in that case. :D
what about
Ord
'scompare
function?In Haskell's hackage about
Data.Ord