How to upgrade to Purescript 0.12
Before we begin, the type search in Pursuit is a great way to search for the functions you need.
Reset your tooling by deleting the bower_components/, .psci_modules/, .pulp-cache/, .psc-package/ and output/ folders. Then run psc-package build --only-dependencies.
Import changes and effects
Using sed or your other favourite global replace tool to search and replace all occurences in the list below will get you a long way.
All effect rows have been removed. For instance Aff e a has become Aff a. With some more ninja regexes
or a small parser you should be able to remove the effect rows.
Control.Monad.EffwithEffectEff ewithEffect
Control.Monad.AffwithEffect.AffData.StrMapwithForeign.Object- The type
StrMapis renamed toObject.
- The type
Package changes
If you use psc-package, remove packages from the depends field in your psc-package.json file until psc-package build stops telling you it can't find packages. Then you well get a lot of compile time errors which you can take care of by using typed holes.
purescript-maps and purescript-sets are merged into the new package purescript-ordered-collections.
StrMap is now called Object and moved into the new package purescript-foreign-object.
purescript-dom has become the purescript-web-* packages. Using typed holes will help you find the new functions.
Most other libraries have the relevant changes in their releases page on Github.
Missing functions
Where have all the functions gone? Programmers refactored them everyone.
liftEff'from Control.Monad.Aff has been moved into a quite elegant liftEffect instance function.
id has been renamed to identity.
Credits
- Kritzcreek in the Purescript channel was the main source for this. I just changed the format.
- @justinwoo for comments about typed holes.
- @dstcruz for having really sharp eyes.
This comment has been minimized.
justinwoo commentedJun 19, 2018
Suggesting type holes would also be good, since you can readily upgrade from purescript-dom to purescript-web-dom by using
?whatgoeshereand such over your existing uses of purescript-dom.Also worth pointing out a lot of the work can be done by replacing
Control.Monad.EffectwithEffectandEff ewithEffect