-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade to purescript 0.10 #10
base: master
Are you sure you want to change the base?
Conversation
@@ -60,14 +59,15 @@ instance functorTree :: Functor Tree where | |||
map f (Tree a ts) = Tree (f a) (map f <$> ts) | |||
|
|||
instance applyTree :: Apply Tree where | |||
apply (Tree f tf) t@(Tree a ta) = Tree (f a) (map (f <$>) ta <> map (<*> t) tf) | |||
apply (Tree f tf) t@(Tree a ta) = Tree (f a) (map (map f) ta <> map (applyFlipped t) tf) | |||
where applyFlipped x y = apply y x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find applyFlipped
in standard libs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated now - thanks @LiamGoodacre for pointing out the use of operator sections
go n = do | ||
sz <- Int.floor <<< Math.abs <$> arbitrary | ||
Tree <$> arbitrary <*> replicateM sz (go (n / (sz + 1))) | ||
|
||
replicateM n m | n < 1 = pure [] | ||
| otherwise = sequence $ replicate n m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find replicateM
in standard libs any more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to just do sequence (replicate sz (go (n / (sz + 1)))
. The replicate
function for arrays will already deal with sz < 1
. Alternatively there is replicateA
from unfoldable.
3c976f8
to
34da6e3
Compare
34da6e3
to
c21589e
Compare
package.json
(split intobuild
andtest
scripts & removeddoc
generation which is usually not expected from libs any more)