github purescript/purescript v0.13.4

latest releases: v0.15.16-1, v0.15.16-0, v0.15.15...
4 years ago

Enhancements

  • Use content hashes when determining whether a file needs rebuilding (#3708, @hdgarrood)

    We now calculate and store content hashes of input files during compilation. If a file's modification time has changed since the last compile, we compare the hash to the previous hash; if the hash is unchanged, this allows us to skip rebuilding this file, speeding up the build.

  • Include import declaration qualifiers in unused import warnings (#3685, @matthew-hilty)

    Previously, warnings didn't distinguish between import declarations from the same module. Code like the following

    import A.B (x) -- `x` is used.
    import A.B (y) as C -- `y` is not used.

    would induce a warning like The import of module A.B is redundant even though only the qualified import declaration C is actually redundant. The warning now would be The import of module A.B (qualified as C) is redundant.

  • Include kind imports when determining unused import warnings (#3685, @matthew-hilty)

    Previously, kind imports were ignored. The linter wouldn't emit any warnings for code like the following.

    import A.B (kind K) -- `kind K` is not used.

    And the linter, disregarding kind K, would emit an UnusedImport instead of an UnusedExplicitImport for code like the following.

    import A.B (x, kind K) -- `x` is not used, but `kind K` is.
  • Better reporting of I/O errors (#3730, @hdgarrood)

    If an unexpected I/O error occurs during compiling, we now include details in the error message. For example, when trying to write compilation results onto a device which has run out of space, we previously would have received a "CannotWriteFile" error with no further information. Now, we receive the underlying error message too:

    I/O error while trying to write JSON file: ./output/cache-db.json
    
      ./output/cache-db.json: hClose: resource exhausted (No space left on device)
    

Bug fixes

  • Improve type class resolution in the presence of constrained higher-order functions (#3558, @matthew-hilty)

    This is perhaps best illustrated with an example.

    newtype LBox row a = LBox (∀ r. (∀ lbl _1. Row.Cons lbl a _1 row  IsSymbol lbl  SProxy lbl  r)  r)
    
    unLBox   row a r. ( lbl _1. Row.Cons lbl a _1 row  IsSymbol lbl  SProxy lbl  r)  LBox row a  r
    unLBox g (LBox f) = f g
    
    read   row a. Record row  LBox row a  a
    read rec = unLBox \lbl → Record.get lbl rec

    The read function would previously fail with the error

    No type class instance was found for
    
        Prim.Row.Cons lbl4
                      a5
                      t2
                      row6
    

    although that dictionary should have been available in the function passed to unLBox. Now, it type checks successfully.

  • Fix cache invalidation false negatives by storing timestamps (#3705, @hdgarrood)

    Previously, an input file would be considered 'modified', and thus requiring rebuilding on a subsequent compile, if its modification time specifies a point in time after any of the modification times of the corresponding output files. This has turned out to be insufficient; files can often change in a way that this algorithm misses, because the input file might still have a timestamp older than the output files. Often this can happen by switching between git branches or by updating a dependency.

    This problem can manifest as compiler errors which don't appear to make sense or correspond to what is inside a source file, and which (until now) would need to be fixed by a clean rebuild (e.g. rm -r output).

    We now make a note of the modification time when we read an input file, and we consider that input file to have changed on a subsequent compile if the modification time is different to what it was before.

    The hope with this fix is that it should never be necessary to remove an output directory to get a build to run successfully. If you do run into this problem again, it is a bug: please report it.

  • Fix exports incorrectly being identified as unused in purs bundle (#3727, @rhendric)

    References to properties on the exports object would previously not be picked up by purs bundle as uses of those properties, which could lead to them being incorrectly removed. For example:

    'use strict';
    
    exports.foo = 1;
    exports.bar = exports.foo;

    would remove the exports.foo = 1; statement, breaking the assignment to exports.bar, if foo were not used elsewhere. This statement is now no longer removed.

  • Show entire rows in type errors in the presence of the --verbose-errors flag (#3722, @Woody88)

    The row diffing feature, which elides common labels in rows occurring in type errors, did not previously respect the --verbose-errors flag, giving the same output regardless of whether it was set or not. Now, if the flag has been supplied, we always show the entire row.

Other

Don't miss a new purescript release

NewReleases is sending notifications on new releases.