Back to Purescript

0.15 Ecosystem Update

migration-guides/0.15-Ecosystem-Update.md

latest22.1 KB
Original Source

Global changes

The following changes are not listed below because they appear multiple times:

  • Migrate FFI to ES modules
  • Update project and dependencies to v0.15.0 PureScript
  • Added purs-tidy formatter
  • Dropped deprecated MonadZero instances
  • Dropped deprecated math dependency; updated imports
  • Miscellaneous CI fixes that aren't relevant to end-users

If a library's changes consisted only of the above entries, it was removed from this list.

purescript Libraries

arrays

Breaking changes:

  • Drop deprecated group' and empty (#219 by @JordanMartinez)

Other improvements:

  • Fixed minor documentation issue with find (#216 by @JamieBallingall)

console

New features:

  • Added debug (#36)

control

Breaking changes:

  • Make <|> right associative (#80 by @JordanMartinez)

foldable-traversable

Breaking changes:

  • Drop deprecated foldMap1Default (#147 by @JordanMartinez)

Other improvements:

  • Narrow down unnecessarily imprecise type of mapWithIndexArray (#145)

foreign

Other improvements:

  • Replace all usages of F and FT with Except/ExceptT (NonEmptyList ForeignError) (#87 by @JordanMartinez)

    Often times, the F and FT aliases did more to hinder usage of this library than help. These aliases haven't been deprecated, but usage of them is now discouraged. All code in the library now uses the full type that is aliased by F and FT.

free

Breaking changes:

  • Drop deprecated unfoldCofree; use buildCofree instead (#124 by @JordanMartinez)

graphs

New features:

  • Added Foldable and Traversable instances for Graph (#16 by @MaybeJustJames)

integers

Breaking changes:

  • Migrate trunc from math package (#51 by @JordanMartinez)

Other improvements:

  • Drop dependency on deprecated math package (#51 by @JordanMartinez)

lists

Breaking changes:

  • Drop deprecated group' and mapWithIndex (#206 by @JordanMartinez)
  • Change groupAllBy to use a comparison function (#191)

maybe

New features:

  • Added Semiring instance (#59)

newtype

New features:

  • Added modify (#19 by @dwhitney)

nonempty

Other improvements:

  • Drop deprecation warning on fold1 (#45 by @JordanMartinez)

numbers

New features:

  • Ported various functions & constants from purescript-math (#18 by @JamieBallingall)

    Specifically...

    • abs, sign
    • max, min (which work differently than Number's Ord instance)
    • ceil, floor, trunc, remainder/%, round
    • log
    • exp, pow, sqrt
    • acos, asin, atan, atan2, cos, sin, tan
    • Numeric constants: e, ln2, ln10, log10e, log2e, pi, sqrt1_2, sqrt2, and tau

ordered-collections

New features:

  • Exported Data.Map.Internal data constructors (#52 by @natefaubion)
  • Add unbiased Semigroup/Monoid instances to Map with Warn (#54 by @JordanMartinez)

Performance improvements:

  • Improved speed of foldr, foldl, foldMap, foldlWithIndex, foldrWithIndex, foldMapWithIndex, unionWith, keys and values (#60 by @xgrommx, #61 and #62 by @JordanMartinez)

prelude

Breaking changes:

  • Change Generic Rep's NoConstructors to newtype Void (#282 by @JordanMartinez)
  • Replaced polymorphic proxies with monomorphic Proxy (#281, #288 by @JordanMartinez)
  • Fix signum zero to return zero (#280 by @JordanMartinez)
  • Fix Show instance on records with duplicate labels by adding Nub constraint (#269 by @JordanMartinez)

New features:

  • Added the Data.Reflectable module for type reflection (#289 by @PureFunctor)

Other improvements:

  • Changed unit's FFI representation from {} to undefined (#267 by @JordanMartinez)
  • Added clearer docs for Prelude module (#270 by @JordanMartinez)
  • Clarify docs for flip (#271 by @JordanMartinez)
  • Add comment that Number is not a fully law abiding instance of Ord (#277 by @JamieBallingall)
  • The internal FFI function join in Data.Show has been renamed to intercalate to match the same function in Data.Show.Generic (#274 by @cdepillabout)

quickcheck

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#132 by @JordanMartinez)

  • Make frequency use NonEmptyArray (#131 by @JordanMartinez)

    Now oneOf and frequency both use NonEmptyArray rather than NonEmptyList.

Bugfixes:

  • quickCheckPure and quickCheckPure' stack safety (#127)

record

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#81 by @JordanMartinez)

strings

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#158 by @JordanMartinez)
  • In slice, drop bounds checking and Maybe return type (#145 by Quelklef)

Other improvements:

  • Surround code with backticks in documentation (#148)
  • Make RegexFlags a newtype and a Newtype instance for it(#159 by @mhmdanas)

transformers

New features:

  • Add Foldable, FoldableWithIndex, and Traversable instances for EnvT (#113 by @abaco)

typelevel-prelude

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#72 by @JordanMartinez)

New features:

  • Added # infix operator for FLIP (e.g. Int # Maybe == Maybe Int) (#73 by @JordanMartinez)

unfoldable

New features:

  • Add iterateN function (#20 by @matthewleon and @JordanMartinez)

validation

Breaking changes:

  • Drop deprecated unV; use validation instead (#38 by @JordanMartinez)

purescript-contrib Libraries

aff

Breaking changes:

  • Restrict the signature of launchAff_ to only work on Aff Unit (#203 by @i-am-the-slime)

Other improvements:

  • Ensure all directly-imported packages are included in the spago.dhall file (#205 by @ptrfrncsmrph)

affjax

Breaking changes:

  • Update all request functions to take a driver arg (#171 by @JordanMartinez)

    Affjax works on the Node.js and browser environments by relying on a require statement within a function. Depending on the environment detected, either XHR or XmlHttpRequest is used. Since ES modules do not allow one to call import within a function in a synchronous way, we cannot continue to use this approach.

    Rather, all request-related functions (e.g. request, get, etc.) now take as their first argument an AffjaxDriver value. Different environments will pass in their implementation for that driver and re-export the functionality defined in affjax.

    To fix your code, depend on the corresponding library below and update the imported module from Affjax to Affjax.Node/Affjax.Web:

affjax-node

New library for making purescript-affjax work on Node

affjax-web

New library for making purescript-affjax work on the browser

argonaut-core

Other improvements:

  • Fixed readme bug where jsonParser was imported from Data.Argonaut.Core instead of Data.Argonaut.Parser (#50 by @flip111)

argonaut-traversals

Other improvements:

  • Updated README.md to make the Quick start example runnable (#37 by @dk949)

arraybuffer

Breaking Changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#41 by @JordanMartinez)

colors

New features:

  • Support for alpha channel added to toHexString and fromHexString (#56 by @nsaunders)

css

Breaking changes:

  • Add support for calc expressions (#140 by @nsaunders)

  • Add table selector (#141 by @plurip-software)

  • Update the box-shadow implementation (#88 by @vyorkin)

  • Dropped almost all named colors (#156 by @JordanMartinez)

    These colors were originally defined in purescript-colors (i.e. one module per schema) because each schema should be defined as its own library. This change was propagated to this release.

New features:

  • Add smart constructors for generic font families (#68, #136 by @Unisay and @JordanMartinez)
  • Add support for text-direction (#83, #137 by @vyorkin and @JordanMartinez)
  • Add outline and constituent properties (#145 by @nsaunders)
  • Add support for visibility property (#148 by @nsaunders)

Other improvements:

  • Remove ending space in css output (e.g. padding: 1 2 3 4 ) (#135 by @chexxor and @JordanMartinez)

fork

Other improvements:

  • Ensure all imported packages are in the spago.dhall file (#17 by @artemisSystem)

now

Other improvements:

  • Added tests (#20 by @ntwilson)
  • Added quick start (#22 by @maxdeviant)

parsing

Breaking changes:

  • New optimized internals. ParserT now has a more efficient representation, resulting in (up to) 20x performance improvement. In addition to the performance, all parser execution is always stack-safe, even monadically, obviating the need to run parsers with Trampoline as the base Monad or to explicitly use MonadRec.

    Code that was parametric over the underlying Monad no longer needs to propagate a Monad constraint.

    Code that constructs parsers via the underlying representation will need to be updated, but otherwise the interface is unchanged and parsers should just enjoy the speed boost.

    (#154 by @natefaubion)

  • Make <??> right-associative (#164 by @JordanMartinez)

  • Drop <?> and <~?> prec from 3 to 4 (#163, #164 by @JordanMartinez)

    <|> was made right associative. Decreasing these two operators prevents a compiler error (i.e. MixedAssociativityError) without causing issues with <$>.

  • Rename module prefix from Text.Parsing.Parser to Parsing (#169 by @jamesdbrock)

  • Replace the regex parser. (#170 by @jamesdbrock)

  • Reorganize Combinators for #154 (#182 by @jamesdbrock)

  • Add the index field to Position. (#171 by @jamesdbrock)

  • Move the parsers

    • whiteSpace
    • skipSpaces
    • oneOf
    • oneOfCodePoints
    • noneOf
    • noneOfCodePoints from Parsing.String to Parsing.String.Basic. (#183 by @jamesdbrock)
  • Change MonadState instance (#187 by jamesdbrock)

    Users who stack a ParserT on a StateT base monad will call the MonadState members directly like get instead of needing to do lift <<< get.

    To get the ParserT internal state, call getParserT instead of get.

New features:

  • Add the anyTill primitive String combinator. (#186 by @jamesdbrock)

  • Add the Parsing.String.Replace module, copied from https://github.com/jamesdbrock/purescript-parsing-replace (#188 by @jamesdbrock) streamEditT can be written in terms of replaceT.

    streamEditT input sep editor = replaceT input (sep >>= editor >>> lift)

    (#188 by @jamesdbrock, #194 by @jamesdbrock)

  • Add the advance and manyIndex combinators. (#193 by @jamesdbrock)

Bugfixes:

  • Improve correctness and speed of number and intDecimal. (#189 by @jamesdbrock)

profunctor-lenses

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#141 by @JordanMartinez)

New features:

  • Add coerced (#140 by @ozkutuk)
  • Add sans and both (#97 by @xgrommx)

Bugfixes:

Other improvements:

  • Replace manual tests with automated tests using assert (#135 by @neppord)
  • Improve documentation for united (#134 by @neppord)
  • Add guide on impredicativity explaining difference between Lens vs ALens (#136 by @i-am-tom and @JordanMartinez)

quickcheck-laws

Breaking changes:

  • Drop Proxy2/Proxy3 usage in favor of just Proxy (#59 by @JordanMartinez)

New features:

  • Provide Arbitrary-less law checks (#36 by @matthewleon, #57 by @JordanMartinez)

Other improvements:

  • Fix integer overflow error in test for Ints (#58 by @JordanMartinez)

react

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#185 by @JordanMartinez)

routing

Other improvements:

  • Update readme to show how to use newtypes (#57 by @brodeuralexis and @JordanMartinez)

string-parsers

Breaking changes:

  • Change precedence of withError operator to accommodate associativity changes in Control.Alt (#92 by @thomashoneyman)

these

Breaking changes:

  • Replaced polymorphic proxies with monomorphic Proxy (#41 by @JordanMartinez)

uri

Bugfixes:

  • Made all parsers stack safe on long input (#63 by @garyb)
  • Exceptions are no longer thrown when using e.g. valueFromString with lone surrogates (#68 by @ysangkok)

Other improvements:

  • Update README.md rfc link (#67 @codingedgar)

purescript-web Libraries

canvas

Breaking changes:

  • Support arcs that are drawn counter-clockwise (#58, #83 by @karljs and @JordanMartinez)
  • The Transform type now uses the field names a, b, c, d, e and f, instead of m11, m12, m21, m22, m31 and m32 (#86 by @artemisSystem)

New features:

  • Added createImageDataWith (#81)

Other improvements:

  • Added ESLint config and fixed the resulting linter issues (#82)

web-cssom

Breaking changes:

  • Update CSSStyleDeclaration functions to take style arg last (#12 by @theqp)

    This follows the convention of "the thing being operated on" occurs last in function that take multiple arguments.

web-dom

Breaking changes:

  • Unwrap returned Effect for doctype (#52 by @JordanMartinez)
  • Port getBoundingClientRect from web-html; set arg to Element (#53 by @JordanMartinez)

web-events

New features:

  • Add FFI for CustomEvent constructor (#25 by @JordanMartinez)
  • Add addEventListenerWithOptions to expose more options (#25 by @JordanMartinez)

web-file

Other improvements:

  • Update Math import to use Data.Number (#20 by @JordanMartinez)

web-html

Breaking changes:

  • Move getBoundingClientRect to purescript-web-dom (#73 by @JordanMartinez)

  • Drop duplicated set/getClassName and classList (#74 by @JordanMartinez)

    These three entities are already defined in purescript-web-dom

purescript-node Libraries

node-fs-aff

Breaking changes:

  • Remove exists since the underlying Async.exists from purescript-node-fs has been removed (#36 by @sigma-andex)
  • Update mkdir' to take options arg (#34 by @JordanMartinez)

node-fs

Breaking changes:

  • Remove Async.exists (#61 by @sigma-andex)

  • Update mkdir to take an options record arg, exposing recursive option (#53, #55, #58 by @JordanMartinez)

    To get back the old behavior of mkdir', you would call mkdir' { recursive: false, mode: mkPerms all all all }

node-streams

Breaking changes:

  • Update write callback to include Error arg (#40 by @JordanMartinez)

Other improvements:

  • Fix Gzip example (#17, #36 by @matthewleon and @JordanMartinez)