purescript v0.14.7 Release Notes

  • ๐Ÿ†• New features:

    • ๐Ÿ‘‰ Make Prim.TypeError's Quote work on all kinds, not just kind Type. (#4142 by @xgrommx)

    • ๐Ÿ“„ Display role annotations in HTML docs (#4121 by @JordanMartinez)

    Previously, the HTML docs would not indicate which types could be safely coerced and which could not:

      -- cannot be coerced
      data Foo1 a = Foo1 a
      type role Foo1 nominal
    
      -- can be coerced
      data Foo2 a = Foo2
      type role Foo2 phantom
    
      -- can be coerced in some contexts
      data Foo3 a = Foo3 a
      type role Foo3 representational
    

    The HTML docs now display the role annotations either explicitly declared by the developer or those inferred by the compiler.

    Since role annotations are an advanced feature and since most type parameters' roles are the representational role, the phantom and nominal role annotations are displayed in documentation whereas the representational role is not, similar to "uninteresting" kind signatures.

    Lastly, FFI declarations like below...

      foreign import data Foo :: (Type -> Type) -> Type
      type role Foo nominal
    

    ...will be rendered as though they are data declarations:

      data Foo :: (Type -> Type) -> Type
      data Foo t0
      type role Foo nominal
    

    One can distinguish FFI declarations with roles separately from normal data declarations that have roles based on the name of the type parameters. Since FFI declarations' type parameters are implicit and thus unnamed, the compiler will generate their name: t0, t1, ..., tN where N is a zero-based index of the type parameter.

    Note: the resulting documentation will display the roles, but the roles will not be selectable when selecting the type in case one wants to copy-paste the type into source code.

    • Rewrite Partial optimization to be cleaner (#4208 by @rhendric)

    This feature shrinks the generated JS code for declarations that use empty type classes, such as Partial, but is otherwise not expected to have user-visible consequences.

    • โž• Add support for publishing via the purs.json manifest format (#4233 by @thomashoneyman)

    This feature expands compiler support for publishing packages with different manifest formats. Previously, packages had to have a bower.json manifest; now, packages can choose to have a purs.json manifest instead.

    This feature provides only partial support for packages published to the PureScript registry using the purs.json manifest format. Registry packages are allowed to be hosted anywhere (not just GitHub), and do not need to be Git repositories at all. However, purs publish and its primary consumer, Pursuit, both require packages to be available on GitHub and for their version to be a SemVer-compliant Git tag. Therefore, this feature only supports registry packages that are compatible with these restrictions.

    ๐Ÿ›  Bugfixes:

    • โž• Add missing source spans to data constructors when generating docs (#4202 by @PureFunctor)

    • Check role declarations arity during type checking (#4157 by @kl0tl)

    • โšก๏ธ Optimize newtype applications with the ($) operator (#4205 by @PureFunctor)

    • Properly deserialize unused identifiers in the CoreFn (#4221 by @sjpgarcia)

    This mostly affects downstream consumers of the CoreFn as discussed in #4201. This makes it so CoreFn deserialization properly reads $__unused into UnusedIdent instead of an Ident. This is particularly useful for downstream consumers of the CoreFn such as alternative backends that don't allow arguments to be omitted from functions.

    • ๐Ÿ›  Fix type operators in declaration param kinds (#4220 by @rhendric)

    This fixes an internal error triggered by using a type operator in the kind of a type parameter of a data declaration, type synonym declaration, or class declaration.

    • Scope type vars when type checking typed values (#4216 by @rhendric)

    When the compiler is checking an expression that is annotated with a type against another expected type, and the annotation introduces a type variable, the compiler needs to introduce that type variable to the scope of any types used inside the expression.

    One noteworthy case of this pattern is member signatures inside instances. This fix allows type variables introduced in member signatures to be used in the member declaration itself.

    Internal:

    • โฌ†๏ธ Bump PureScript to building with GHC-8.10.7, as well as from LTS-17 to LTS-18. (#4199 by @cdepillabout)

    • Prevent hangs on internal errors (#4126 by @rhendric)

    • ๐Ÿšš The explicit disabling of Nix has been removed from stack.yaml. (#4198 by @cdepillabout)

    For developers on NixOS, this means that you should be able to build PureScript by running stack build instead of stack build --nix. For other developers, this shouldn't affect you.

    • ๐Ÿ— Build the entire latest package set in CI (#4217 by @rhendric)

    See #4128.

    • โœ… Create test machinery for optimizations (#4205 by @PureFunctor)

    This adds machinery for testing code generation for optimizations.

    Partially extracted from #3915 to add tests for #4205.